Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dd7b246c4e |
20000
dev-0/out.tsv
Normal file
20000
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
11563
dev-1/out.tsv
Normal file
11563
dev-1/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
20
program.py
Normal file
20
program.py
Normal file
@ -0,0 +1,20 @@
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from stop_words import get_stop_words
|
||||
import pandas as pd
|
||||
|
||||
|
||||
|
||||
vectorizer = TfidfVectorizer(stop_words=get_stop_words('polish'))
|
||||
reg = LinearRegression()
|
||||
colnames = ['start_date', 'end_date', 'title', 'sort_title', 'data']
|
||||
t = pd.read_csv('test-A/in.tsv', sep="\t", names=colnames)
|
||||
df = pd.read_csv('train/train.tsv', sep="\t", names=colnames)
|
||||
date = (df['start_date'] + df['end_date']) / 2
|
||||
train = vectorizer.fit_transform(df['data'])
|
||||
reg.fit(train, date)
|
||||
r = vectorizer.transform(t['data'])
|
||||
pred = reg.predict(r)
|
||||
with open('test-A/out.tsv', 'w') as file:
|
||||
for e in pred:
|
||||
file.write("%f\n" % e)
|
14220
test-A/out.tsv
Normal file
14220
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user