Compare commits

...

5 Commits

Author SHA1 Message Date
1ad7202746 out tsv 2nd 2021-05-26 23:51:20 +02:00
3e27215304 out tsv 2021-05-26 23:48:31 +02:00
22fcbc1ddc add dev0 out 2021-05-26 23:47:05 +02:00
fd0845cc62 Merge branch 'master' of https://git.wmi.amu.edu.pl/s426289/retroc2 2021-05-18 00:36:25 +02:00
ad43a91670 first 2021-05-18 00:28:01 +02:00
4 changed files with 34264 additions and 0 deletions

20000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

43
main.py Normal file
View File

@ -0,0 +1,43 @@
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LinearRegression
from stop_words import get_stop_words
import pandas as pd
import numpy as np
import csv
lm_model = LinearRegression()
tfidvectorizer = TfidfVectorizer(stop_words=get_stop_words('polish'))
train_nm = ['start_date', 'end_date', 'title', 'sort_title', 'data']
train_nm_test = ['data']
dataset = []
processed = []
new_text = ""
train_file = pd.read_csv('train/train.tsv', sep="\t", names=train_nm)
print('DONE20!')
date = (train_file['start_date'] + train_file['end_date']) / 2
print('DONE22!')
vectorizer= tfidvectorizer.fit_transform(train_file['data'])
print('DONE24!')
lm_model.fit(vectorizer, date)
print('DONE26!')
dev_0 = pd.read_csv("dev-0/in.tsv", error_bad_lines = False, header = None, sep = "\t", quoting=csv.QUOTE_NONE)
dev_1 = pd.read_csv("dev-1/in.tsv", error_bad_lines = False, header = None, sep = "\t", quoting=csv.QUOTE_NONE,)
test = pd.read_csv("test-A/in.tsv", names = train_nm, sep = "\t")
print('DONE31!')
test_file= tfidvectorizer.transform(test['data'])
test_file_predict = lm_model.predict(test_file)
with open('test-A/out.tsv', 'w') as file:
for i in test_file_predict:
file.write("%f\n" % i)
print('DONE38!')

1
python-stop-words Submodule

@ -0,0 +1 @@
Subproject commit 7b30f5b953ef02b62dfb4b8a158ea5f1218d11e7

14220
test-A/out.csv Normal file

File diff suppressed because it is too large Load Diff