Compare commits

...

1 Commits

Author SHA1 Message Date
acf1abb36d solution 2021-05-18 20:23:59 +02:00
7 changed files with 153297 additions and 0 deletions

View File

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}

20000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

11563
dev-1/out.tsv Normal file

File diff suppressed because it is too large Load Diff

BIN
geval Executable file

Binary file not shown.

38
program.py Normal file
View File

@ -0,0 +1,38 @@
import pandas as pd
import numpy as np
import csv
from sklearn.linear_model import LinearRegression
from stop_words import get_stop_words
from sklearn.feature_extraction.text import TfidfVectorizer
train = pd.read_csv("train/train.tsv", names = ['start_date', 'end_date', 'title', 'sort_title', 'data'], sep = "\t")
vectorizer = TfidfVectorizer(stop_words=get_stop_words('polish'))
linear_reg = LinearRegression()
date = (train['start_date'] + train['end_date']) / 2
train_vec = vectorizer.fit_transform(train['data'])
linear_reg.fit(train_vec, date)
dev_0 = pd.read_csv("dev-0/in.tsv", error_bad_lines = False, header = None, sep = "\t", quoting=csv.QUOTE_NONE)
pred_dev_0 = linear_reg.predict(vectorizer.transform(dev_0[0]))
pd.DataFrame(pred_dev_0).to_csv('dev-0/out.tsv', sep = "\t", index = False, header = False)
dev_1 = pd.read_csv("dev-1/in.tsv", error_bad_lines = False, header = None, sep = "\t", quoting=csv.QUOTE_NONE)
pred_dev_1 = linear_reg.predict(vectorizer.transform(dev_1[0]))
pd.DataFrame(pred_dev_1).to_csv('dev-1/out.tsv', sep = "\t", index = False, header = False)
test = pd.read_csv("test-A/in.tsv", names = ['data'], sep = "\t")
pred_test = linear_reg.predict(vectorizer.transform(test['data']))
pd.DataFrame(pred_test).to_csv('test-A/out.tsv', sep = "\t", index = False, header = False)
#./geval -t dev-0
#21.8069
#./geval -t dev-1
#22.0247

14219
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff

107471
train/train.tsv Normal file

File diff suppressed because one or more lines are too long