Question: PROBLEM 1 : Sentiment Analysis ( 5 0 points ) Dataset: We ll use the Sentiment Labelled Sentences Data Set from the UCI Machine Learning

PROBLEM 1: Sentiment Analysis(50 points)
Dataset: Well use the Sentiment Labelled Sentences Data Set from the UCI Machine Learning Repository. This dataset includes 3,000 sentences labeled as positive or negative, collected from three sources: IMDb, Amazon, and Yelp. Each source contributes 1,000 sentences. [Download Link]
We will use Pytorch to implement and train a Multi-layer Perceptron (MLP) on this dataset. Please follow the instructions of the code templete (p1-template.py) and implement the parts denoted by Your code here. The output of your implementation should like follows:
First 5 rows of the dataset:
sentence label
0 So there is no way for me to plug it in here i...0
1 Good case, Excellent value. 1
2 Great for the jawbone. 1
3 Tied to charger for conversations lasting more... 0
4 The mic is great. 1
Missing values in each column:
sentence 0
label 0
dtype: int64
Number of duplicate rows:
17
Label distribution:
label
11386
01362
Name: count, dtype: int64
Epoch [(1)/(20)], Loss: 0.6935
Epoch [(2)/(20)], Loss: 0.6883
Epoch [(3)/(20)], Loss: 0.6784
Epoch [(4)/(20)], Loss: 0.6634
Epoch [(5)/(20)], Loss: 0.6372
Epoch [(6)/(20)], Loss: 0.6035
Epoch [(7)/(20)], Loss: 0.5657
Epoch [(8)/(20)], Loss: 0.5188
Epoch [(9)/(20)], Loss: 0.4699
Epoch [(10)/(20)], Loss: 0.4224
Epoch [(11)/(20)], Loss: 0.3816
Epoch [(12)/(20)], Loss: 0.3367
Epoch [(13)/(20)], Loss: 0.3002
Epoch [(14)/(20)], Loss: 0.2716
Epoch [(15)/(20)], Loss: 0.2457
Epoch [(16)/(20)], Loss: 0.2331
Epoch [(17)/(20)], Loss: 0.2210
Epoch [(18)/(20)], Loss: 0.2027
Epoch [(19)/(20)], Loss: 0.2035
Epoch [(20)/(20)], Loss: 0.1813
Evaluation Metrics:
Accuracy : 76.36%
However, feel free to use other models or training techniques as long as the final accuracy improves. This program should be able to run on the local cpu.
PROBLEM 1: Sentiment Analysis(50 points)
Dataset: We'll use the Sentiment Labelled Sentences Data Set from the UCI Machine Learning
Repository. This dataset includes 3,000 sentences labeled as positive or negative, collected from
three sources: IMDb, Amazon, and Yelp. Each source contributes 1,000 sentences. [Download
Link]
We will use Pytorch to implement and train a Multi-layer Perceptron (MLP) on this dataset.
Please follow the instructions of the code templete (
p1-template.py) and implement the parts
denoted by "Your code here". The output of your implementation should like follows:
First 5 rows of the dataset:
sentence label
0 So there is no way for me to plug it in here i...0
1 Good case, Excellent value. 1
2 Great for the jawbone. 1
3 Tied to charger for conversations lasting more... 0
4
The mic is great. 1
Missing values in each column:
sentence 0
label 0
dtype: int64
Number of duplicate rows:
17
Label distribution:
label
11386
0,1362
Name: count, dtype: int64
Epoch [(1)/(20)], Loss: 0.6935
Epoch [(2)/(20)], Loss: 0.6883
Epoch [(3)/(20)], Loss: 0.6784
Epoch [(4)/(20)], Loss: 0.6634
Epoch [(5)/(20)], Loss: 0.6372
Epoch [(6)/(20)], Loss: 0.6035
Epoch [(7)/(20)], Loss: 0.5657
Epoch [(8)/(20)], Loss: 0.5188
Epoch [(9)/(20)], Loss: 0.4699
Epoch [(10)/(20)], Loss: 0.4224
Epoch [(11)/(20)], Loss: 0.3816
Epoch [(12)/(20)], Loss: 0.3367
Epoch [(13)/(20)], Loss: 0.3002
Epoch [(14)/(20)], Loss: 0.2716
Epoch [(15)/(20)], Loss: 0.2457
Epoch [(16)/(20)], Loss: 0.2331
Epoch [(17)/(20)], Loss: 0.2210
Epoch [(18)/(20)], Loss: 0.2027
Epoch [(19)/(20)], Loss: 0.2035
Epoch [(20)/(20)], Loss: 0.1813
Evaluation Metrics:
Accuracy :( 76.36)/(%)
However, feel free to use other models or training techniques as long as the final accuracy
improves. This program should be able to run on the local cpu.
PROBLEM 1 : Sentiment Analysis ( 5 0 points )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!