Compare commits

..

1 Commits

Author SHA1 Message Date
Mariusz B
8105920759 lin reg 2021-05-01 16:52:09 +00:00
3 changed files with 2024 additions and 0 deletions

1000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

24
main.py Normal file
View 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

File diff suppressed because it is too large Load Diff