Highlights
Task:
Question 1 (100 pts)
Sentiment Analysis helps data scientists to analyze any kind of data i.e., Business, Politics, Social Media, etc., For example, the IMDb dataset "movie_data.csv" file contains 25,000 highly polar ‘positive’ (12500) and ‘negative’ (12500) IMDB movie reviews (label negative review as ‘0’ and positive review as ‘1’). Similarly, “amazon_data.txt” and “yelp_data.txt” contain 1000 labeled negative review as ‘0’ and positive review as ‘1’
For further help, explore the link: https://medium.com/@vasista/sentiment-analysis- using-svm-338d418e3ff1
Answer the following:
a)
• Read all the data files (.csv and .txt) in python Pandas DataFrame.
• Perform the necessary pre-processing task using NLTK library to clean the text (such as, stop word removal and word stemming)
• Find the 10 most frequent words (terms) and generate the Frequency Distribution Plot of each dataset.
• For each dataset, make 70% as training and 30% as test sets.
b) By using both CountVectorizer and TfidfVectorizer separately of the sklearn library , perform the Logistic regression classification in the IMDb dataset and evaluate the accuracies in the test set.
c) Classify the Amazon dataset using Logistic Regression and Random Forest and compare the performances and show the confusion matrices.
d) Generate classification model for the Yelp dataset with K-NN algorithms. Fit and test the model for different values for K (from 1 to 5) using a for loop and record and plot the KNN’s testing accuracy in a variable (scores).
e) Generate prediction for the following reviews based Logistic regression classifier in Amazon dataset:
Review1 = "SUPERB, I AM IN LOVE IN THIS PHONE"
Review 2 = "Do not purchase this product. My cell phone blast when I switched the charger"
Question 2 (60 pts)
The 20 Newsgroups data set is a collection of approximately 20,000 newsgroup documents, partitioned (nearly) evenly across 20 different newsgroups. This data set is in-built in scikit, so you don’t need to download it explicitly. You can check the code here:
https://towardsdatascience.com/machine-learning-nlp-text-classification-using-scikit- learn-python-and-nltk-c52b92a7c73a
to load the data set directly in notebook (this might take few minutes, so patience). For example, from sklearn.datasets import fetch_20newsgroups twenty_train = fetch_20newsgroups(subset='train', shuffle=True)
a) By using both CountVectorizer and TfidfVectorizer separately of the sklearn library, perform the Logistic regression classification on the training set and show the confusing matrix and accuracy by predicting the class labels in the test set.
b) Perform a Logistic Regression classification and show the accuracy of the test set.
c) Perform a K-means Clustering in the training set with K =20
d) Plot the accuracy (Elbow method) of different cluster sizes (5, 10, 15, 20, 25, 30) and determine the best cluster size.
Question 3 (40 pts)
The Medical dataset “image_caption.txt” contains captions for 1000 images (ImageID). Let’s build a small search engine (you may explore to get some help:
https://towardsdatascience.com/create-a-simple-search-engine-using-python- 412587619ff5 and https://www.machinelearningplus.com/nlp/cosine-similarity/) by
performing the following:
a) Read all the data files in python Pandas DataFrame.
b) Perform the necessary pre-processing task (e.g., stop word removal, etc.)
c) Create Term-Document Matrix with TF-IDF weighting
d) Calculate the similarity using cosine similarity and show the top ranked ten
(10) images Based on the following query
This Management Assignment has been solved by our Management Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment Experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.