def computeExample(filename): XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData( filename, True) classifier = KNN.computeModel(XTrain, yTrain) yPred = ClassificationModel.predictModel(classifier, XTest, False) return ClassificationModel.evaluateModel(yPred, yTest)
def computeExample(filename, kernel): XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData( filename) classifier = SVM.computeModel(XTrain, yTrain, kernel) yPred = ClassificationModel.predictModel(classifier, XTest) return ClassificationModel.evaluateModel(yPred, yTest)
def computeExample(filename): XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData( filename) classifier = LogisticRegression.computeModel(XTrain, yTrain) yPred = ClassificationModel.predictModel(classifier, XTest) return ClassificationModel.evaluateModel(yPred, yTest)
def compute(self): import timeit start = timeit.default_timer() XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData(self.args, False) classifier = RandomForest.computeModel(XTrain, yTrain, self.args.n_estimators, self.args.criterion) yPred = ClassificationModel.predictModel(classifier, XTest) confusionMatrix = ClassificationModel.evaluateModel(yPred, yTest) if(self.args.print_accuracy): print(confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix)) stop = timeit.default_timer() return confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix), stop - start
def compute(self): import timeit start = timeit.default_timer() XTrain, XTest, yTrain, yTest = ClassificationModel.preprocessData(self.args, True) classifier = LogisticRegression.computeModel(XTrain, yTrain, self.args.solver) yPred = ClassificationModel.predictModel(classifier, XTest) confusionMatrix = ClassificationModel.evaluateModel(yPred, yTest) if(self.args.print_accuracy): print(confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix)) stop = timeit.default_timer() return confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix), stop - start
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.evaluateModel(yPred, yTest) if(self.args.print_accuracy): print(confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix)) stop = timeit.default_timer() return confusionMatrix, ClassificationModel.getAccuracy(confusionMatrix), stop - start
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