#NEWLINE# def predict( self , x_test , k = 5 , wt = 'distance' ) : #NEWLINE# #INDENT# '\n        Similar to SKlearn we assume that we have X_tr, Y_tr and X_test. Here it is assumed that target is the last\n        column in the codebook and data has dim-1 columns\n\n        :param x_test: input vector\n        :param k: number of neighbors to use\n        :param wt: method to use for the weights (more detail in KNeighborsRegressor docs)\n        :returns: predicted values for the input data\n        ' #NEWLINE# target = ( self . data_raw . shape [ 1 ] - 1 ) #NEWLINE# x_train = self . codebook . matrix [ : , : target ] #NEWLINE# y_train = self . codebook . matrix [ : , target ] #NEWLINE# clf = neighbors . KNeighborsRegressor ( k , weights = wt ) #NEWLINE# clf . fit ( x_train , y_train ) #NEWLINE# x_test = self . _normalizer . normalize_by ( self . data_raw [ : , : target ] , x_test ) #NEWLINE# predicted_values = clf . predict ( x_test ) #NEWLINE# return self . _normalizer . denormalize_by ( self . data_raw [ : , target ] , predicted_values )