done
This commit is contained in:
parent
5c4bb10ddf
commit
f8dda8b786
1000
dev-0/out.tsv
Normal file
1000
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
41
skrypt-dev-0.py
Normal file
41
skrypt-dev-0.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
from scipy.sparse import data
|
||||||
|
from sklearn import linear_model
|
||||||
|
from sklearn import preprocessing
|
||||||
|
from sklearn.pipeline import make_pipeline
|
||||||
|
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||||
|
from sklearn import linear_model
|
||||||
|
import csv
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
regression = linear_model.LinearRegression()
|
||||||
|
|
||||||
|
train_file = pd.read_csv('train/train.tsv', delimiter='\t', names=['price', 'mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
train_data_frame = pd.DataFrame(train_file, columns=['price', 'mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
|
||||||
|
Y = train_data_frame[['price']]
|
||||||
|
X = train_data_frame[['year', 'mileage', 'engineCapacity']]
|
||||||
|
|
||||||
|
regression.fit(X, Y)
|
||||||
|
|
||||||
|
in_file = pd.read_csv('dev-0/in.tsv', delimiter='\t', names=['mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
in_data_frame = pd.DataFrame(in_file, columns=['mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
|
||||||
|
reshape = in_data_frame[['year', 'mileage', 'engineCapacity']]
|
||||||
|
|
||||||
|
y_predict = regression.predict(reshape)
|
||||||
|
y_predict = np.concatenate(y_predict)
|
||||||
|
|
||||||
|
|
||||||
|
labels = np.array2string(y_predict, separator='\n', suppress_small=True)
|
||||||
|
|
||||||
|
file_out = open("dev-0/out.tsv", 'w')
|
||||||
|
file_out.write(labels[1:-1])
|
||||||
|
|
||||||
|
with open("dev-0/out.tsv", 'r') as fix_space:
|
||||||
|
lines = fix_space.readlines()
|
||||||
|
|
||||||
|
lines = [line.replace(' ', '') for line in lines]
|
||||||
|
with open("dev-0/out.tsv", 'w') as fix_space:
|
||||||
|
fix_space.writelines(lines)
|
41
skrypt-test-a.py
Normal file
41
skrypt-test-a.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
from scipy.sparse import data
|
||||||
|
from sklearn import linear_model
|
||||||
|
from sklearn import preprocessing
|
||||||
|
from sklearn.pipeline import make_pipeline
|
||||||
|
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||||
|
from sklearn import linear_model
|
||||||
|
import csv
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
regression = linear_model.LinearRegression()
|
||||||
|
|
||||||
|
train_file = pd.read_csv('train/train.tsv', delimiter='\t', names=['price', 'mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
train_data_frame = pd.DataFrame(train_file, columns=['price', 'mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
|
||||||
|
Y = train_data_frame[['price']]
|
||||||
|
X = train_data_frame[['year', 'mileage', 'engineCapacity']]
|
||||||
|
|
||||||
|
regression.fit(X, Y)
|
||||||
|
|
||||||
|
in_file = pd.read_csv('test-A/in.tsv', delimiter='\t', names=['mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
in_data_frame = pd.DataFrame(in_file, columns=['mileage', 'year', 'brand', 'engineType', 'engineCapacity'])
|
||||||
|
|
||||||
|
reshape = in_data_frame[['year', 'mileage', 'engineCapacity']]
|
||||||
|
|
||||||
|
y_predict = regression.predict(reshape)
|
||||||
|
y_predict = np.concatenate(y_predict)
|
||||||
|
|
||||||
|
|
||||||
|
labels = np.array2string(y_predict, separator='\n', suppress_small=True)
|
||||||
|
|
||||||
|
file_out = open("test-A/out.tsv", 'w')
|
||||||
|
file_out.write(labels[1:-1])
|
||||||
|
|
||||||
|
with open("test-A/out.tsv", 'r') as fix_space:
|
||||||
|
lines = fix_space.readlines()
|
||||||
|
|
||||||
|
lines = [line.replace(' ', '') for line in lines]
|
||||||
|
with open("test-A/out.tsv", 'w') as fix_space:
|
||||||
|
fix_space.writelines(lines)
|
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