simple linear regression 10% of train
This commit is contained in:
parent
33b70ce7b1
commit
8669834305
19998
dev-0/out.tsv
Normal file
19998
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
11562
dev-1/out.tsv
Normal file
11562
dev-1/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
24
run.py
Normal file
24
run.py
Normal 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
14219
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user