simple linear regression 10% of train

This commit is contained in:
Kacper Dudzic 2022-04-28 22:47:06 +02:00
parent 33b70ce7b1
commit 8669834305
4 changed files with 45803 additions and 0 deletions

19998
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

11562
dev-1/out.tsv Normal file

File diff suppressed because it is too large Load Diff

24
run.py Normal file
View File

@ -0,0 +1,24 @@
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LinearRegression
import sys
import pandas as pd
train_file = sys.argv[1]
pred_file = sys.argv[2]
train = pd.read_csv(train_file, sep='\t', header=None)
pred_x = pd.read_csv(pred_file, sep='\t', header=None)
train_x, train_y = train[4], train[0]
#pred_x = pred[4]
pred_x = pred_x.stack()
vectorizer = TfidfVectorizer()
train_x = vectorizer.fit_transform(train_x)
pred_x = vectorizer.transform(pred_x)
model = LinearRegression()
model.fit(train_x, train_y)
pred_y = model.predict(pred_x)
pd.DataFrame(pred_y).to_csv('out.tsv', header=False, index=None)

14219
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff