22 lines
1.3 KiB
Python
22 lines
1.3 KiB
Python
import csv
|
|
import model_training as mt
|
|
import pandas as pd
|
|
import price_evaluation as pe
|
|
|
|
def eval(filename_in, filename_out):
|
|
data_eval = pd.read_table(filename_in, delimiter='\t', header=None)
|
|
data_eval.rename(columns={0: 'stan', 1: 'czynsz', 2: 'x3', 3: 'cenazam', 4: 'link', 5: 'pietro', 6: 'x7', 7: 'metraz', 8: 'rynek', 9: 'liczba pokoi', 10: 'budynek', 11: 'x12', 12: 'x13', 13: 'x14', 14: 'x15', 15: 'x16', 16: 'x17', 17: 'x18', 18: 'x19', 19: 'x20', 20: 'x21', 21: 'x22', 22: 'x23', 23: 'x24', 24: 'x25'}, inplace=True)
|
|
|
|
data_eval.drop(['x3','cenazam','link','pietro','budynek','x7','x12','x13','x14','x15','x16','x17','x18','x19','x20','x21','x22','x23','x24','x25'], inplace=True, axis=1)
|
|
data_eval['czynsz'] = data_eval['czynsz'].str.extract('(\d+)')
|
|
data_eval['stan'] = data_eval['stan'].map({'do zamieszkania': 2, 'do remontu': 1, 'do wykończenia': 2})
|
|
data_eval['rynek'] = data_eval['rynek'].map({'wtórny': 0, 'pierwotny': 1})
|
|
data_eval.dropna(inplace=True)
|
|
data_eval = data_eval[['stan', 'czynsz', 'liczba pokoi', 'metraz', 'rynek']]
|
|
|
|
out = mt.model.predict(data_eval)
|
|
pd.DataFrame(out).to_csv(filename_out, sep='\t', index=False, header=False)
|
|
|
|
eval('dev-0/in.tsv', 'dev-0/out.tsv')
|
|
eval('test-A/in.tsv', 'test-A/out.tsv')
|