Loading ml.py +10 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ def makePrediction(message): print(pred_y) """ return str(pred_y.count(1)) + ' out of 4 modes predict this message to be spam.' return str(pred_y.count(1)) + ' out of 4 models predict this message to be spam.' # declaring, training, fitting each algorithm Loading @@ -227,3 +227,12 @@ def partialFitNewData(message, label): def switchCurrentAlgorithm(): pass def getPerformanceMetrics(): if len(X) == 0: preprocessing() if tree == None: loadModels() No newline at end of file server.py +3 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ def correctPrediction(): label = json["label"] print(json) response = {'response': ml.partialFitNewData(message, label)} return json # just for debugging TODO integrate the code with ml.py to get a response return response # TODO make this get the actual ranking of algorithms @app.route('/getAlgorithms', methods=["GET"]) Loading @@ -56,6 +56,8 @@ def getTopAlgorithms(): recall = ["1", "2", "3", "4", "5"] accuracy = ["1", "2", "3", "4", "5"] name, f1, precision, recall, accuracy = ml.getPerformanceMetrics() val = { "name": name, "f1": f1, Loading Loading
ml.py +10 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ def makePrediction(message): print(pred_y) """ return str(pred_y.count(1)) + ' out of 4 modes predict this message to be spam.' return str(pred_y.count(1)) + ' out of 4 models predict this message to be spam.' # declaring, training, fitting each algorithm Loading @@ -227,3 +227,12 @@ def partialFitNewData(message, label): def switchCurrentAlgorithm(): pass def getPerformanceMetrics(): if len(X) == 0: preprocessing() if tree == None: loadModels() No newline at end of file
server.py +3 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ def correctPrediction(): label = json["label"] print(json) response = {'response': ml.partialFitNewData(message, label)} return json # just for debugging TODO integrate the code with ml.py to get a response return response # TODO make this get the actual ranking of algorithms @app.route('/getAlgorithms', methods=["GET"]) Loading @@ -56,6 +56,8 @@ def getTopAlgorithms(): recall = ["1", "2", "3", "4", "5"] accuracy = ["1", "2", "3", "4", "5"] name, f1, precision, recall, accuracy = ml.getPerformanceMetrics() val = { "name": name, "f1": f1, Loading