text_plain_output_1.png
from preprocess import DataPreprocessModule

from sklearn.metrics import mean_squared_error

import numpy as np

data_preprocess_module = DataPreprocessModule(train_path='../input/hdb-resale-price-prediction/train.csv', test_path='../input/hdb-resale-price-prediction/test.csv')
X_train, X_val, X_test, y_train, y_val = data_preprocess_module.get_preprocessed_data()

metric = lambda y1_real, y2_real: np.sqrt(mean_squared_error(y1_real, y2_real))
y_trfm = lambda y: np.expm1(y)
def get_score(model, X, y):
    preds = model.predict(X)
    preds = y_trfm(preds)
    y = y_trfm(y)
    return metric(preds, y)

pipeline_reg = data_preprocess_module.build_pipeline(LinearRegression())
pipeline_reg.fit(X_train, y_train)
get_score(pipeline_reg, X_val, y_val)