Compare commits
No commits in common. "master" and "master" have entirely different histories.
5272
dev-0/out.tsv
5272
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
28
result.py
28
result.py
@ -1,28 +0,0 @@
|
|||||||
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
5152
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user