def compute(self): import timeit start = timeit.default_timer() XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData(self.args, False) classifier = DecisionTree.computeModel(XTrain, yTrain, self.args.criterion) yPred = ClassificationModel.predictModel(classifier, XTest) confusionMatrix = ClassificationModel.getConfusionMatrix(yPred, yTest) rocCurve = ClassificationModel.getRocCurve(yPred, yTest) if(self.args.print_accuracy): print(confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix)) stop = timeit.default_timer() return confusionMatrix, rocCurve, ClassificationModel.getAccuracy(confusionMatrix), stop - start, classifier
def compute(self): import timeit start = timeit.default_timer() XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData( self.args, True) classifier = KNN.computeModel( XTrain, yTrain, self.args.n_neighbors, self.args.power_parameter_minkowski_metric) yPred = ClassificationModel.predictModel(classifier, XTest) confusionMatrix = ClassificationModel.getConfusionMatrix(yPred, yTest) rocCurve = ClassificationModel.getRocCurve(yPred, yTest) if (self.args.print_accuracy): print(confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix)) stop = timeit.default_timer() return confusionMatrix, rocCurve, ClassificationModel.getAccuracy( confusionMatrix), stop - start, classifier