Compare commits

...

4 Commits

Author SHA1 Message Date
Łukasz Jędyk
ee39a6ffd5 ver 4 full train + stop words 2021-05-13 11:16:26 +02:00
Łukasz Jędyk
78ae1c52a8 ver 3 full train set 2021-05-12 22:46:20 +02:00
Łukasz Jędyk
9dfe8fe3b5 ver 2 10000 train 2021-05-12 21:22:41 +02:00
Łukasz Jędyk
a2d5d926d0 ver 1 - 10000 train set 2021-05-12 21:00:14 +02:00
3 changed files with 34249 additions and 0 deletions

20000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

29
main.py Normal file
View File

@ -0,0 +1,29 @@
import csv
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
from stop_words import get_stop_words
col_names = ['start_date', 'end_date', 'title', 'source', 'content']
train_set = pd.read_table('train/train.tsv.xz', error_bad_lines=False, header=None, names=col_names)
dev_set = pd.read_table('dev-0/in.tsv', error_bad_lines=False, header=None, names=col_names[4:], quoting=csv.QUOTE_NONE,)
test_set = pd.read_table('test-A/in.tsv', error_bad_lines=False, header=None, names=col_names[4:], quoting=csv.QUOTE_NONE,)
X_train = train_set['content']
y_train = (train_set['start_date'] + train_set['end_date']) / 2
X_dev = dev_set['content']
X_test = test_set['content']
print('Trenowanie modelu...')
model = make_pipeline(TfidfVectorizer(stop_words=get_stop_words('polish')), LinearRegression())
model.fit(X_train, y_train)
print('Predykcje...')
dev_prediction = model.predict(X_dev)
test_prediction = model.predict(X_test)
dev_prediction.tofile('./dev-0/out.tsv', sep='\n')
test_prediction.tofile('./test-A/out.tsv', sep='\n')

14220
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff