dziala
This commit is contained in:
parent
756ef4277a
commit
5e66be7f46
5272
dev-0/in.tsv
Normal file
5272
dev-0/in.tsv
Normal file
File diff suppressed because one or more lines are too long
5272
dev-0/out.tsv
Normal file
5272
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
24
main.py
Normal file
24
main.py
Normal file
@ -0,0 +1,24 @@
|
||||
from sklearn import preprocessing
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
from sklearn.naive_bayes import MultinomialNB
|
||||
from sklearn.pipeline import make_pipeline
|
||||
|
||||
import numpy as np
|
||||
|
||||
eng = preprocessing.LabelEncoder()
|
||||
|
||||
with open("train/in.tsv") as myFile:
|
||||
tmp = myFile.readlines()
|
||||
with open("train/expected.tsv") as finFile:
|
||||
fin = finFile.readlines()
|
||||
fin = eng.fit_transform(fin)
|
||||
with open("test-A/in.tsv") as tFile:
|
||||
fic = tFile.readlines()
|
||||
gnb = make_pipeline(TfidfVectorizer(),MultinomialNB())
|
||||
model = gnb.fit(tmp, fin)
|
||||
fin_pred = model.predict(fic)
|
||||
fin_pred = np.array(fin_pred)
|
||||
np.set_printoptions(threshold = np.inf)
|
||||
eFile = np.array2string(fin_pred.flatten(), precision = 2, separator = '\n',suppress_small = True)
|
||||
myFile = open("test-A/out.tsv", "a")
|
||||
myFile.write(eFile)
|
5152
test-A/in.tsv
Normal file
5152
test-A/in.tsv
Normal file
File diff suppressed because one or more lines are too long
10304
test-A/out.tsv
Normal file
10304
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
289579
train/in.tsv
Normal file
289579
train/in.tsv
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user