text_plain_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.feature_extraction.text import CountVectorizer

from sklearn.metrics import accuracy_score

from sklearn.model_selection import train_test_split

import pandas as pd

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

traindata = pd.read_csv('/kaggle/input/word2vec-nlp-tutorial/labeledTrainData.tsv.zip', delimiter='\t')
testdata = pd.read_csv('/kaggle/input/word2vec-nlp-tutorial/testData.tsv.zip', header=0, delimiter='\t')
unlabledata = pd.read_csv('/kaggle/input/word2vec-nlp-tutorial/unlabeledTrainData.tsv.zip', header=0, delimiter='\t', quoting=3)
submissoin = pd.read_csv('/kaggle/input/word2vec-nlp-tutorial/sampleSubmission.csv', header=0, delimiter='\t')

totaldata = pd.concat([traindata, testdata], axis=0)
totaldata.shape

from sklearn.feature_extraction.text import CountVectorizer
cv = CountVectorizer()
vec = cv.fit_transform(totaldata['cleanreview'])

X = vec[:len(traindata)]
Y = traindata.sentiment
x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.1)

model = RandomForestClassifier()
model.fit(x_train, y_train)
pred = model.predict(x_test)
accuracy_score(pred, y_test)

data = vec[len(traindata):]
data.shape

pred = model.predict(data)
submissoin['sentiment'] = pred

submission = pd.read_csv('/kaggle/input/word2vec-nlp-tutorial/sampleSubmission.csv', header=0, delimiter='\t')

output = pd.DataFrame(data={'id': testdata.id, 'sentiment': pred})
output