Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3542d203c6 |
19
Main.py
Normal file
19
Main.py
Normal file
@ -0,0 +1,19 @@
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from stop_words import get_stop_words
|
||||
|
||||
import pandas as pd
|
||||
|
||||
meh = TfidfVectorizer(stop_words = get_stop_words('polish'))
|
||||
linReg = LinearRegression()
|
||||
colnames = ['start_date', 'end_date', 'title', 'sort_title', 'data']
|
||||
t = pd.read_csv('test-A/in.tsv', sep = "\t", names = colnames)
|
||||
datFin = pd.read_csv('train/train.tsv', sep = "\t", names = colnames)
|
||||
date = (datFin['start_date'] + datFin['end_date']) / 2
|
||||
trn = meh.fit_transform(datFin['data'])
|
||||
linReg.fit(trn, date)
|
||||
r = meh.transform(t['data'])
|
||||
x = linReg.predict(r)
|
||||
with open('test-A/out.tsv', 'w') as file:
|
||||
for each in x:
|
||||
file.write("%f\n" % each)
|
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
14220
test-A/out.tsv
Normal file
14220
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
107471
train/meta.tsv
Normal file
107471
train/meta.tsv
Normal file
File diff suppressed because it is too large
Load Diff
107471
train/train.tsv
Normal file
107471
train/train.tsv
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user