This commit is contained in:
MikolajPaterka 2022-05-26 23:47:37 +02:00
parent 33b70ce7b1
commit 3b814045a7
5 changed files with 153289 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

35
run.py Normal file
View File

@ -0,0 +1,35 @@
from sklearn.linear_model import LinearRegression
from sklearn.feature_extraction.text import TfidfVectorizer
import pandas as pd
def regresja(path):
# dnae do modelu
train = pd.read_csv('train/train.tsv', sep='\t', header=None)
y_train = train[0]
x_train = train[4]
# dane do predykcji
x_predict = []
with open(f"{path}/in.tsv", encoding='utf-8') as f:
for line in f:
x_predict.append(line)
# tfidf
vectorizer = TfidfVectorizer()
x_train = vectorizer.fit_transform(x_train)
x_predict = vectorizer.transform(x_predict)
# model regresji
model = LinearRegression()
model.fit(x_train, y_train)
# przewidywanie wyniku
y_predict = model.predict(x_predict)
pd.DataFrame(y_predict).to_csv(f"{path}/out.tsv", header=False, index=None)
regresja("dev-0")
regresja("dev-1")
regresja("test-A")

14220
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff

107471
train/train.tsv Normal file

File diff suppressed because one or more lines are too long