forked from kubapok/retroc2
first
This commit is contained in:
commit
ad43a91670
20000
dev-0/expected.tsv
Normal file
20000
dev-0/expected.tsv
Normal file
File diff suppressed because it is too large
Load Diff
20000
dev-0/in.tsv
Normal file
20000
dev-0/in.tsv
Normal file
File diff suppressed because one or more lines are too long
BIN
dev-0/meta.tsv.xz
Normal file
BIN
dev-0/meta.tsv.xz
Normal file
Binary file not shown.
11563
dev-1/expected.tsv
Normal file
11563
dev-1/expected.tsv
Normal file
File diff suppressed because it is too large
Load Diff
11563
dev-1/in.tsv
Normal file
11563
dev-1/in.tsv
Normal file
File diff suppressed because one or more lines are too long
BIN
dev-1/meta.tsv.xz
Normal file
BIN
dev-1/meta.tsv.xz
Normal file
Binary file not shown.
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/in.tsv
Normal file
14220
test-A/in.tsv
Normal file
File diff suppressed because one or more lines are too long
14220
test-A/out.csv
Normal file
14220
test-A/out.csv
Normal file
File diff suppressed because it is too large
Load Diff
BIN
train/meta.tsv.xz
Normal file
BIN
train/meta.tsv.xz
Normal file
Binary file not shown.
BIN
train/train.tsv.xz
Normal file
BIN
train/train.tsv.xz
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user