text_plain_output_1.png
from sklearn import feature_extraction

from sklearn.linear_model import RidgeClassifier

from sklearn.model_selection import cross_val_score

import pandas as pd

train_df = pd.read_csv('../input/nlp-getting-started/train.csv')
test_df = pd.read_csv('../input/nlp-getting-started/test.csv')

count_vectorizer = feature_extraction.text.CountVectorizer()
example_train_vectors = count_vectorizer.fit_transform(train_df['text'][0:5])

train_vectors = count_vectorizer.fit_transform(train_df['text'])
test_vectors = count_vectorizer.transform(test_df['text'])

clf = RidgeClassifier()
scores = cross_val_score(clf, train_vectors, train_df['target'], cv=3, scoring='f1')

clf.fit(train_vectors, train_df['target'])