Kaggle competition: Bag of Words Meets Bags of Popcorn
test['count'] = np.exp(rf3.predict(test[feats]))
test[['datetime', 'count']].to_csv('rf3.csv', index=False )<concatenate>
train = pd.read_csv('.. /input/labeledTrainData.tsv', delimiter="\t")
 test = pd.read_csv('.. /input/testData.tsv', delimiter="\t")
 print(train.head())
 print(train.shape)
 print(test.shape )
df_total = df.append(test)
 df_total.sort_values('datetime', inplace=True )<feature_engineering>
tfidf = TfidfVectorizer(
 ngram_range=(1, 3),
use_idf=1,
smooth_idf=1,
sublinear_tf = 1,
stop_words ='english')
 train_data_count = tfidf.fit_transform(train_data)
 test_data_count = tfidf.transform(test_data)
 print(train_data_count.shape)
 print(test_data_count.shape )
df_total['rolling_temp'] = df_total['temp'].rolling(3, min_periods=1 ).mean()
df_total['rolling_atemp'] = df_total['atemp'].rolling(3, min_periods=1 ).mean()
df_total['rolling_humidity'] = df_total['humidity'].rolling(3, min_periods=1 ).mean()
df_total['rolling_windspeed'] = df_total['windspeed'].rolling(3, min_periods=1 ).mean()<filter>
clf = MultinomialNB()
clf.fit(train_data_count, train_labels)
 pred_labels = clf.predict(test_data_count)
 print(pred_labels.shape )
train = df[df['day'] <= 15]
valid = df[df['day'] > 15]
train.shape, valid.shape<compute_train_metric>
df = pd.DataFrame({"id": test['id'],"sentiment": pred_labels})
 df.to_csv('submission.csv',index = False, header=True )