Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8105920759 |
1000
dev-0/out.tsv
Normal file
1000
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
24
main.py
Normal file
24
main.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import numpy
|
||||||
|
import pandas
|
||||||
|
import sys
|
||||||
|
from sklearn.linear_model import LinearRegression
|
||||||
|
|
||||||
|
def trainModel(filePath):
|
||||||
|
trainFrame = pandas.read_csv(filePath, sep='\t', names=['price','mileage','year','brand','engineType','engineCapacity'])
|
||||||
|
dataY = trainFrame[['price']]
|
||||||
|
dataX = trainFrame[['year','mileage','engineCapacity']]
|
||||||
|
model = LinearRegression()
|
||||||
|
model.fit(dataX, dataY)
|
||||||
|
return model
|
||||||
|
|
||||||
|
def predictModel(model, filePathIn, filePathOut):
|
||||||
|
inFrame = pandas.read_csv(filePathIn, sep='\t', names=['mileage','year','brand','engineType','engineCapacity'])
|
||||||
|
data = inFrame[['year','mileage','engineCapacity']]
|
||||||
|
prediction = model.predict(data)
|
||||||
|
numpy.savetxt(filePathOut, prediction, fmt='%d', delimiter='\n')
|
||||||
|
|
||||||
|
model = trainModel("train/train.tsv")
|
||||||
|
predictModel(model, "dev-0/in.tsv", "dev-0/out.tsv")
|
||||||
|
predictModel(model, "test-A/in.tsv", "test-A/out.tsv")
|
||||||
|
|
||||||
|
|
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