Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
664548c299 |
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
program-dev0.py
Normal file
24
program-dev0.py
Normal file
@ -0,0 +1,24 @@
|
||||
import numpy as np
|
||||
from sklearn import preprocessing
|
||||
from sklearn.pipeline import make_pipeline
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn import linear_model
|
||||
import pandas as pd
|
||||
|
||||
|
||||
train=pd.read_csv('train/train.tsv',sep='\t',names=['price','mileage','year','brand','engineType','engineCapacity'])
|
||||
df = pd.DataFrame(train,columns=['price','mileage','year','brand','engineType','engineCapacity'])
|
||||
Y=df[['price']]
|
||||
X=df[['year','mileage','engineCapacity']]
|
||||
reg = linear_model.LinearRegression()
|
||||
reg.fit(X, Y)
|
||||
inn=pd.read_csv('dev-0/in.tsv',sep='\t',names=['mileage','year','brand','engineType','engineCapacity'])
|
||||
df = pd.DataFrame(inn,columns=['mileage','year','brand','engineType','engineCapacity'])
|
||||
r=df[['year','mileage','engineCapacity']]
|
||||
y_pred=reg.predict(r)
|
||||
y_pred=np.concatenate(y_pred)
|
||||
t=np.array2string(y_pred, precision=5, separator='\n',suppress_small=True)
|
||||
t=t.lstrip('[').rstrip(']')
|
||||
f = open("dev-0/out.tsv", "a")
|
||||
f.write(t)
|
24
program-testA.py
Normal file
24
program-testA.py
Normal file
@ -0,0 +1,24 @@
|
||||
import numpy as np
|
||||
from sklearn import preprocessing
|
||||
from sklearn.pipeline import make_pipeline
|
||||
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn import linear_model
|
||||
import pandas as pd
|
||||
|
||||
|
||||
train=pd.read_csv('train/train.tsv',sep='\t',names=['price','mileage','year','brand','engineType','engineCapacity'])
|
||||
df = pd.DataFrame(train,columns=['price','mileage','year','brand','engineType','engineCapacity'])
|
||||
Y=df[['price']]
|
||||
X=df[['year','mileage','engineCapacity']]
|
||||
reg = linear_model.LinearRegression()
|
||||
reg.fit(X, Y)
|
||||
inn=pd.read_csv('test-A/in.tsv',sep='\t',names=['mileage','year','brand','engineType','engineCapacity'])
|
||||
df = pd.DataFrame(inn,columns=['mileage','year','brand','engineType','engineCapacity'])
|
||||
r=df[['year','mileage','engineCapacity']]
|
||||
y_pred=reg.predict(r)
|
||||
y_pred=np.concatenate(y_pred)
|
||||
t=np.array2string(y_pred, precision=5, separator='\n',suppress_small=True)
|
||||
t=t.lstrip('[').rstrip(']')
|
||||
f = open("test-A/out.tsv", "a")
|
||||
f.write(t)
|
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