Compare commits

...

2 Commits

Author SHA1 Message Date
Vojtaz
f7d2d56f0c fix dev-0 2021-05-17 00:26:08 +02:00
Vojtaz
f8dda8b786 done 2021-05-16 23:50:55 +02:00
4 changed files with 2084 additions and 0 deletions

1000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

43
skrypt-dev-0.py Normal file
View File

@ -0,0 +1,43 @@
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]
lines = [line.replace('[', '') for line in lines]
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
View 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

File diff suppressed because it is too large Load Diff