put the train, test, predict together
if self.training_dataset is None:
self.ret["error"] = "training dataset is missing! please provide it"
return self.ret
X_train, y_train, label_to_class = multiclass_get_points_and_labels(self.training_dataset, self.class_labels)
X_test, y_test, label_to_class = multiclass_get_points_and_labels(self.test_dataset, self.class_labels)
self.multiclass_classifier.train(X_train, y_train)
if self.test_dataset is not None:
success_ratio = self.multiclass_classifier.test(X_test, y_test)
self.ret["test_success_ratio"] = success_ratio
if self.datapoints is not None:
predicted_labels = self.multiclass_classifier.predict(X_test)
predicted_labelclasses = [label_to_class[x] for x in predicted_labels]
self.ret["predicted_labels"] = predicted_labelclasses
return self.ret
After Change
put the train, test, predict together
self.train(self.training_dataset[0], self.training_dataset[1])
if self.test_dataset is not None:
self.test(self.test_dataset[0], self.test_dataset[1])
if self.datapoints is not None:
predicted_labels = self.predict(self.datapoints)