Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
1ad7202746 | |||
3e27215304 | |||
22fcbc1ddc | |||
fd0845cc62 | |||
ad43a91670 |
20000
dev-0/out.tsv
Normal file
20000
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
43
main.py
Normal file
43
main.py
Normal 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
1
python-stop-words
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 7b30f5b953ef02b62dfb4b8a158ea5f1218d11e7
|
14220
test-A/out.csv
Normal file
14220
test-A/out.csv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user