Merge branch 'ISI-33' of git.wmi.amu.edu.pl:s152483/paranormal-or-skeptic into ISI-33
This commit is contained in:
commit
634a2cb69a
10545
dev-0/out.tsv
10545
dev-0/out.tsv
File diff suppressed because it is too large
Load Diff
@ -3,28 +3,22 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import csv
|
import csv
|
||||||
import pickle
|
import pickle
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
def predict():
|
def predict():
|
||||||
dev0 = pd.read_csv("dev-0/in.tsv", delimiter="\t", header=None, names=["document","date"], quoting=csv.QUOTE_NONE)
|
dev0 = pd.read_csv("dev-0/in.tsv", delimiter="\t", header=None, names=["document","date"], quoting=csv.QUOTE_NONE)["document"]
|
||||||
testA = pd.read_csv("test-A/in.tsv", delimiter="\t", header=None, names=["document","date"], quoting=csv.QUOTE_NONE)
|
testA = pd.read_csv("test-A/in.tsv", delimiter="\t", header=None, names=["document","date"], quoting=csv.QUOTE_NONE)["document"]
|
||||||
devdoc = dev["document"]
|
|
||||||
testdoc = testA["document"]
|
|
||||||
|
|
||||||
clf = pickle.load(open("clf.model", "rb"))
|
clf = pickle.load(open("clf.model", "rb"))
|
||||||
vectorizer = pickle.load(open("vectorizer.model", "rb"))
|
vectorizer = pickle.load(open("vectorizer.model", "rb"))
|
||||||
|
|
||||||
dev0_vectorizer = vectorizer.transform(devdoc)
|
dev0_vectorizer = vectorizer.transform(dev0)
|
||||||
testA_vectorizer = vectorizer.transform(testdoc)
|
testA_vectorizer = vectorizer.transform(testA)
|
||||||
|
|
||||||
y_dev = clf.predict_proba(dev0_vectorizer)
|
y_dev = clf.predict_proba(dev0_vectorizer)[:, 1]
|
||||||
y_test = clf.predict_proba(testA_vectorizer)
|
y_test = clf.predict_proba(testA_vectorizer)[:, 1]
|
||||||
|
|
||||||
with open("dev-0/out.tsv", "w") as devout:
|
np.savetxt('test-A/out.tsv', y_test, '%f')
|
||||||
for line in y_dev:
|
np.savetxt('dev-0/out.tsv', y_dev, '%f')
|
||||||
devout.write(str(line[1])+"\n")
|
|
||||||
|
|
||||||
with open("test-A/out.tsv", "w") as testaout:
|
|
||||||
for line in y_test:
|
|
||||||
testaout.write(str(line[1])+"\n")
|
|
||||||
|
|
||||||
predict()
|
predict()
|
||||||
|
10305
test-A/out.tsv
10305
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user