This commit is contained in:
Maciej Czajka 2022-05-17 22:49:20 +02:00
parent 33b70ce7b1
commit f055e54100
4 changed files with 45832 additions and 0 deletions

20000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

11563
dev-1/out.tsv Normal file

File diff suppressed because it is too large Load Diff

49
run.py Normal file
View File

@ -0,0 +1,49 @@
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LinearRegression
with open('train/train.tsv', 'r', encoding='utf8') as f:
train = f.readlines()
with open('train/meta.tsv', 'r', encoding='utf8') as f:
expected = f.readlines()
for i in range(0, len(expected)):
expected[i] = expected[i].split('\t')[5]
vectorizer = TfidfVectorizer()
train = vectorizer.fit_transform(train)
model = LinearRegression()
model.fit(train, expected)
with open('dev-0/in.tsv', 'r', encoding='utf8') as f:
dev_0 = f.readlines()
dev_0 = vectorizer.transform(dev_0)
predicted_dev_0 = model.predict(dev_0)
with open('dev-0/out.tsv', 'wt') as f:
for p in predicted_dev_0:
f.write(str(p) + '\n')
f.close()
with open('dev-1/in.tsv', 'r', encoding='utf8') as f:
dev_1 = f.readlines()
dev_1 = vectorizer.transform(dev_1)
predicted_dev_1 = model.predict(dev_1)
with open('dev-1/out.tsv', 'wt') as f:
for p in predicted_dev_1:
f.write(str(p) + '\n')
f.close()
with open('test-A/in.tsv', 'r', encoding='utf8') as f:
test_A = f.readlines()
test_A = vectorizer.transform(test_A)
predicted_test_A = model.predict(test_A)
with open('test-A/out.tsv', 'wt') as f:
for p in predicted_test_A:
f.write(str(p) + '\n')
f.close()

14220
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff