naive bayes

This commit is contained in:
Kacper Dudzic 2022-04-23 16:00:33 +02:00
parent 9cb2fb2612
commit 898e74309d
3 changed files with 10918 additions and 0 deletions

5452
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

19
run.py Normal file
View File

@ -0,0 +1,19 @@
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import make_pipeline
import sys
import pandas as pd
train_file = sys.argv[1]
pred_x_file = sys.argv[2]
train = pd.read_csv(train_file, sep='\t', header=None)
pred_x = pd.read_csv(pred_x_file, sep='\t', header=None)
train_x, train_y = train[1], train[0]
model = make_pipeline(TfidfVectorizer(), MultinomialNB())
model.fit(train_x, train_y)
pred_y = model.predict(pred_x.stack())
pd.DataFrame(pred_y).to_csv('out.tsv', header=False, index=None)

5447
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff