naive bayes solution
This commit is contained in:
parent
9cb2fb2612
commit
76d0840340
5452
dev-0/out.tsv
Normal file
5452
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
23
main.py
Normal file
23
main.py
Normal file
@ -0,0 +1,23 @@
|
||||
import pandas as pd
|
||||
from sklearn.naive_bayes import MultinomialNB
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
from sklearn.pipeline import make_pipeline
|
||||
|
||||
train_set = pd.read_table('train/train.tsv.gz', error_bad_lines=False, header=None)
|
||||
dev_set = pd.read_table('dev-0/in.tsv', error_bad_lines=False, header=None)
|
||||
test_set = pd.read_table('test-A/in.tsv', error_bad_lines=False, header=None)
|
||||
|
||||
X_train = train_set[1].values
|
||||
y_train = train_set[0].values
|
||||
|
||||
X_dev = dev_set[0].values
|
||||
X_test = test_set[0].values
|
||||
|
||||
model = make_pipeline(TfidfVectorizer(), MultinomialNB())
|
||||
model.fit(X_train, y_train)
|
||||
|
||||
dev_prediction = model.predict(X_dev)
|
||||
test_prediction = model.predict(X_test)
|
||||
|
||||
dev_prediction.tofile('./dev-0/out.tsv', sep='\n')
|
||||
test_prediction.tofile('./test-A/out.tsv', sep='\n')
|
5445
test-A/out.tsv
Normal file
5445
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user