ML: Sentimental Analysis (Personal Project)

Personal Project - I

ML: Sentimental Analysis – A Review Analysis

-        Shanmugarajan B

Aim:

         This project aims at modelling the machine to capture the sentiment of the human reviews or comments at a beginner level.

Abstract:

          This machine learning project focuses on performing sentiment analysis on telescope reviews, employing basic techniques to classify comments as either positive or negative. The primary methodology involves the use of TF-IDF vectorization coupled with Random Forest classification.

          The first step involves preprocessing the text data from telescope reviews, including tasks such as text cleaning, tokenization and removal of specific stop words. Subsequently, the TF-IDF vectorization technique is applied to convert the textual data into numerical vectors, considering the importance of terms within the corpus.

          To perform sentiment classification, a Random Forest is trained on the TF-IDF transformed data. Random Forest is chosen for its effectiveness, and its ability to discern complex patterns within the feature space and overcome the problem of overfitting.


Photo by Markus Winkler on Unsplash


Methodology and Theory:

Click to access the methodology and theory along with the full report

Python Code:

Click to access the python code image along with the full report

Output:

The following is output run for one random seed. On running the operation several times with different random seed from 0 to 100, the output predicted for the foreign data set is also shown below.

Click to access the output image along with the full report

For 100 runs:

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0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 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1]

[0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

So, the most common or most probable outcome for all the 18 reviews is this:

[0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1]

Result:

Note: We use the convention:

          HS – Human Sentiment

          PS – Predicted Sentiment

          1 – Positive

          0 – Negative 

Comments

HS

PS

"Over all good, lense was not available. purchased outside."

1

0

"I regret buying this item. The quality is super, and it didn't meet my expectations. Additionally, the customer support was unhelpful when I reached out about the issues I faced."

0

0

"The telescope provided by this company is outstanding. I had an issue with my order, and they quickly resolved it, going above and beyond my expectations.!"

1

1

"I'm all satisfied..completely super nice wonderful"

1

1

"Supercool!! I'm able to capture the moon quite clearly"

1

1

"I bought a few months ago and I really do not regret, ideal for those who want to start to be introduced in astronomy. At an affordable price you can see the planets with great clarity and definition. Pros: great picture, moon and planets are sharp. Cons: EQ-2 mount vibrates too much and the barlow lens that comes bundled is nearly useless otherwise meets my expectations."

1

1

"My first telescope as beginner... Giving review after 15 days tries and serach. Very good for looking at moon but other planets are not visible.... i was aware this is 60mm apature so will be not able to view... But as per other comment we can see at least 2 3 plannets.... i tried but its not visible as expected... It looks same as we can see with bear eyes... Just little brighter with telescope.... take only if you want to see moon in the less price ..."

0*

 

0

"Not to my expectation, but overall good"

0

0

"Its a wastage of money! Instructions on how to build is very hard and all you can see is something grey! DO NOT BUY!!!"

0

0

"Good Value for money, and good for beginners and kids, Can see the moon, Saturn, Jupiter, remaining planets not yet spotted, Bad Adjustments points are very poor difficult to point the target, 4mm eye piece totally useless, target lens you have to adjust it by some paper wedges to fix the target"

0*

0

"Very good product of beginners who likes to discover telescope and it's important....this product is really value for money....my children love and like it very much.. Thanks."

1

1

"Final Result is okayish"

1

1

"Really worth enough for money"

1

1

"This was the 2nd telescope I bought, first was returned due to a shaky base and hard to adjust. I chose this one because of the sturdy looking base....and wasn't disappointed! Sets up easy and the turn knob adjustments are great. The spotting scope is useless, but they all are and I never use it anyway. Great variety in eye-pieces (3 vs normal 2 + doppler). We built a view house and I love being able to see accross the city and the sky......Jupiter's moons are clearly visible and fun to watch be in different places every night. The wireless eyepiece seems to work fine (read directions carefully in app setup...you won't realize the network to use..it isn't obvious), I just haven't used it enough to comment much more on it.....I am old and I usually just go to the eyepiece. I will use it for pictures eventually.....images will be cool."

1

1

"I will us 2 nights sleep. Trying to put this thing together following directions. And it lousy junk. It's not even what twenty five dollars The price will make you we'll make you sick. Parts are plastic first of all most don't fit. I lost 3 nights sleep trying to put this together with no luck.. Please don't waste your money not even meant for a child."

0

0

"Product was very well packed in multiple boxes to protect it. Was easy to get put together. Haven’t had a chance to look at night sky with it. Love that it takes a cel phone on which you can view what you are looking at. Only drawback is that the body if it is a little touchy on getting it tightened enough to stay where you want it."

1

1

"The quality of this telescope is very poor. Almost all the pieces are made out of flimsy plastic. Assembly/instruction manual is written in poorly-worded English and is confusing. The tripod mount is easy to adjust, but very flimsy. Any slight gust of wind will shake the scope, making viewing impossible. Image quality of this scope is very poor. Even on the clearest night with minimal light pollution, I couldn't even use half of the advertised magnification with any reasonable clarity. The Barlow lense is completely useless. I'm hoping a higher-quality eyepiece will allow me to view planets in better detail. I'm honestly not sure how this product has 4+ stars... it's a little concerning."

0

0

"Overall that's to say this is a good product, I myself on the other hand, I've gotten use it for a short while noticing that I had a defect on my aperture lens so I sent it back but also in the meantime of using it I come to find that the tripod was made out of very thin metal which made it very flimsy caused it to shake for a period of time until being able to actually look through the scope even twisting the knobs it would make it shake and wobble."

1

1

* - indicates that the comments are a complex mixture of both the emotions - positive and negative. The most predominant one is chosen.

So, 17 instances of the foreign data are predicted correctly. It predicted 17 / 18 review’s sentiments correctly, i.e., about 94.44% of the data is classified correctly.

Challenges and Future Upgradation:

          The model is not completely good in predicting the complex mixture of positive and negative emotion, like, 60% of negative statements and 40% of positive statements. One can overcome this by increasing the target variable from positive and negative comments to positive, median, and negative comments. Increasing the number of training data, helps increasing the efficiency of the model. Use of more advanced techniques can help overcome the problem. I would try to overcome the following challenges as I keep increasing the knowledge in Machine Learning.

Thank You


Python Machine Learning

Enjoy Machine Learning

Post a Comment

Previous Post Next Post