text_html_output_1.png
import pandas as pd

import sklearn as sk

def print_summary(opt_reg_object):
    params = opt_reg_object.best_estimator_.get_params()
    score = -opt_reg_object.best_score_
    return

hp = pd.read_csv('../input/london-house-prices/hpdemo.csv')
hp

scaler = SS()
scaler.fit(hp[['east', 'north', 'fl_area']])
hp_sc = scaler.transform(hp[['east', 'north', 'fl_area']])

mod1 = NN(n_neighbors=6, weights='uniform', p=2)
price = hp['price'] / 1000.0
mod1.fit(hp_sc, price)

mae = sk.metrics.make_scorer(sk.metrics.mean_absolute_error, greater_is_better=False)
mod_list = sk.model_selection.GridSearchCV(estimator=NN(), scoring=mae, param_grid={'n_neighbors': range(1, 35), 'weights': ['uniform', 'distance'], 'p': [1, 2]})
mod_list.fit(hp[['east', 'north', 'fl_area']], price)
print_summary(mod_list)