Compare commits

..

1 Commits

Author SHA1 Message Date
f979826241 21 geval RMSE score 2021-05-16 12:45:16 +02:00
6 changed files with 153284 additions and 0 deletions

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 Normal file

Binary file not shown.

30
result.py Normal file
View File

@ -0,0 +1,30 @@
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LinearRegression
import numpy as np
import pandas as pd
import csv
def getData(path):
with open(path, encoding="utf-8") as source:
return source.readlines()
def changeToDf(input):
return pd.read_csv(input, sep="\t")
vectorizer = TfidfVectorizer()
linear = LinearRegression()
train = pd.read_csv("./train/train.tsv", sep="\t", names=['start_date', 'end_date', 'title', 'sort_title', 'data'])
mean = (train['start_date'] + train['end_date']) / 2
tv = vectorizer.fit_transform(train['data'])
linear.fit(tv, mean)
def calculateResult(in_, out):
tmp = getData(in_)
df = pd.DataFrame(data = tmp)
data = vectorizer.transform(df[0])
evaluate = linear.predict(data)
np.savetxt(out, evaluate, fmt='%f', delimiter='\n')
calculateResult("./dev-0/in.tsv", "./dev-0/out.tsv")
calculateResult("./dev-1/in.tsv", "./dev-1/out.tsv")
calculateResult("./test-A/in.tsv", "./test-A/out.tsv")

14220
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