Beispiel #1
0
	def fit(self):
		kf = KFold(n_splits=n_splits, random_state=random_state, shuffle=shuffle)
		for train_index, test_index in kf.split(self.X):
			self.clf.fit(self.X[train_index], self.ys[train_index])
			self.scores.append(evaluation.get_regressor_accuracy(np.around(self.clf.predict(self.X[test_index])), self.ys[test_index]))
		self.print_cross_val_scores()
		self.scores = []
 def print_evaluation(self):
     y_pred = self.clf.predict(self.X)
     print(
         "Accuracy: ",
         evaluation.get_regressor_accuracy(self.ys, np.around(y_pred)) *
         100)
     print()
Beispiel #3
0
 def print_evaluation(self):
     print("Accuracy: ")
     for i, weight in enumerate(self.weights):
         y_pred = []
         print("Model", i + 1)
         for x in self.X:
             y_pred.append(np.matmul(weight.transpose(), x))
         print(
             evaluation.get_regressor_accuracy([self.ys[:, i]],
                                               [np.around(y_pred)]) * 100)
     print()