Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ML - Empty Results
#1
Hey Guys,

I'm newbie to the ML world and I'm confronting an annoying problem which is when I run the code, nothing happens, just an empty screen. The code is below:


import pandas as pd
import numpy as np
import gensim
import spacy
import nltk
import text_normalizer as tn
from afinn import Afinn

np.set_printoptions(precision=2, linewidth=80)

dataset = pd.read_csv(r'movie_reviews.csv')
reviews = np.array(dataset['review'])
sentiments = np.array(dataset['sentiment'])
# extract data for model evaluation
test_reviews = reviews[35000:]
test_sentiments = sentiments[35000:]
sample_review_ids = [7626, 3533, 13010]
# normalize dataset
norm_test_reviews = tn.normalize_corpus(test_reviews)

afn = Afinn(emoticons=True)

for review, sentiment in zip(test_reviews[sample_review_ids], test_sentiments[sample_review_ids]):
    print('REVIEW:', review)
    print('Actual Sentiment:', sentiment)
    print('Predicted Sentiment polarity:', afn.score(review))
    print('-'*60)


And I'm using PyCharm, Any Ideas?
Reply


Messages In This Thread
ML - Empty Results - by BadWhite - May-18-2020, 02:10 AM
RE: ML - Empty Results - by BadWhite - May-19-2020, 12:13 AM
RE: ML - Empty Results - by scidam - May-19-2020, 10:28 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020