def predict(self): print 'Predicting' if self.classifier == 'knn': train_score = self.model.score(self.x_train, self.y_train) print 'KNN train score:', train_score if self.do_validation(): val_score = self.model.score(self.x_validate, self.y_validate) print 'KNN val score: ', val_score else: import pprint self.predict_train = self.model.predict_proba(self.x_train) print 'Training Score logloss: ', functions.logloss(self.predict_train, self.y_train), ',', print 'Training Score precision: ', functions.precision(self.predict_train, self.y_train), ',', if self.do_validation(): self.predict_validate = self.model.predict_proba(self.x_validate) precision = functions.logloss(self.predict_validate, self.y_validate) print 'Validation Score: ', precision, ',', precision = functions.precision(self.predict_validate, self.y_validate) print 'Validation Score precision: ', precision, ',',
def print_accuracy(predicted, y): print "logloss: ", functions.logloss(predicted, y) print "precision: ", functions.precision(predicted, y)