Compare commits

..

1 Commits

Author SHA1 Message Date
Łuaksz Góreczny
4b9abc42d4 Dodanie rozwiązania 2021-05-07 17:33:57 +02:00
3 changed files with 10452 additions and 0 deletions

5272
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

28
result.py Normal file
View File

@ -0,0 +1,28 @@
from sklearn import preprocessing
from sklearn.naive_bayes import MultinomialNB
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import lzma
def openXZ(path):
with lzma.open(path, mode='rt') as f:
return f.readlines()
def readFile(path):
with open(path) as source:
return source.readlines()
lines = openXZ('./paranormal-or-skeptic-ISI-public/dev-0/in.tsv.xz')
inData = openXZ('./paranormal-or-skeptic-ISI-public/train/in.tsv.xz')
expData = readFile('./paranormal-or-skeptic-ISI-public/train/expected.tsv')
expected = LabelEncoder().fit_transform(expData)
pipeline = make_pipeline(TfidfVectorizer(),MultinomialNB())
model = pipeline.fit(inData, expected)
result = model.predict(lines)
np.savetxt('./paranormal-or-skeptic-ISI-public/dev-0/out.tsv', result, fmt='%d', delimiter='\n')
lines = openXZ('./paranormal-or-skeptic-ISI-public/test-A/in.tsv.xz')
result = model.predict(lines)
np.savetxt('./paranormal-or-skeptic-ISI-public/test-A/out.tsv', result, fmt='%d', delimiter='\n')
#dla dev wynik był: 0.7367223065250379, ściezki sa troche dziwne, ponieważ pracowałem na google colab

5152
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff