text_plain_output_1.png
from cuml.linear_model import LogisticRegression

from cuml.linear_model import LogisticRegression

from sklearn.feature_extraction.text import CountVectorizer

import cudf as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

train_df = pd.read_csv('/kaggle/input/sentiment-analysis-on-movie-reviews/train.tsv.zip', sep='\t')
test_df = pd.read_csv('/kaggle/input/sentiment-analysis-on-movie-reviews/test.tsv.zip', sep='\t')

train_df.shape

test_df.shape

train_df.isnull().sum()

test_df.isnull().sum()

train_df.isnull().any().any()

test_df.isnull().any().any()

train = train_df.to_pandas()

test = test_df.to_pandas()

vectorizer = CountVectorizer(analyzer='word', tokenizer=None, preprocessor=None, stop_words=None, max_features=5000)

train_data = vectorizer.fit_transform(train['Phrase'])

train_data.shape

test_data = vectorizer.fit_transform(test['Phrase'])

test_data.shape

log_reg = LogisticRegression()
log_reg.fit(train_data, train_df['Sentiment'])

y_pred = log_reg.predict(test_data)

len(y_pred)