Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e9739d0cdb | ||
|
e9683a0e7d |
1000
dev-0/out.tsv
Normal file
1000
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
26
solution.py
Normal file
26
solution.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import numpy
|
||||||
|
import pandas
|
||||||
|
import sys
|
||||||
|
from sklearn.linear_model import LinearRegression
|
||||||
|
|
||||||
|
def predict(model, dir):
|
||||||
|
df = pandas.read_csv(dir+"/in.tsv", sep='\t', header=None, index_col=None)
|
||||||
|
input_x = numpy.array(df[1].tolist()).reshape(-1, 1)
|
||||||
|
pred = model.predict(input_x)
|
||||||
|
numpy.savetxt(dir + "/out.tsv", pred, fmt='%d', delimiter='\n')
|
||||||
|
|
||||||
|
|
||||||
|
trainCsv = pandas.read_csv("train/train.tsv", sep='\t', header=None, index_col=None)
|
||||||
|
data = {
|
||||||
|
'x': trainCsv[2].tolist(),
|
||||||
|
'y': trainCsv[0].tolist(),
|
||||||
|
}
|
||||||
|
|
||||||
|
x = numpy.array(data.get('x')).reshape(-1, 1)
|
||||||
|
y = numpy.array(data.get('y')).reshape(-1, 1)
|
||||||
|
|
||||||
|
model = LinearRegression()
|
||||||
|
model.fit(x, y)
|
||||||
|
|
||||||
|
predict(model, "dev-0")
|
||||||
|
predict(model, "test-A")
|
1000
test-A/out.tsv
Normal file
1000
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user