test set predictions[- - - - - - we can also evaluate the model using the score methodwhich for regressors returns the score the scorealso known as the coefficient of determinationis measure of goodness of prediction for regression modeland yields score between and value of corresponds to perfect predictionand value of corresponds to constant model that just predicts the mean of the training set responsesy_trainin[ ]print("test set ^ { }format(reg score(x_testy_test))out[ ]test set ^ herethe score is which indicates relatively good model fit analyzing kneighborsregressor for our one-dimensional datasetwe can see what the predictions look like for all possible feature values (figure - to do thiswe create test dataset consisting of many points on the linein[ ]figaxes plt subplots( figsize=( )create , data pointsevenly spaced between - and line np linspace(- reshape(- for n_neighborsax in zip([ ]axes)make predictions using or neighbors reg kneighborsregressor(n_neighbors=n_neighborsreg fit(x_trainy_trainax plot(linereg predict(line)ax plot(x_trainy_train'^' =mglearn cm ( )markersize= ax plot(x_testy_test' ' =mglearn cm ( )markersize= ax set_title"{neighbor( )\ train score{ ftest score{ }formatn_neighborsreg score(x_trainy_train)reg score(x_testy_test))ax set_xlabel("feature"ax set_ylabel("target"axes[ legend(["model predictions""training data/target""test data/target"]loc="best"supervised machine learning algorithms