Commit b244e12e authored by Larry Schultheis's avatar Larry Schultheis
Browse files

Algorithm metrics sent to client side

parent f003d9e1
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ sgd = None
nn = None
tree = None

def getPerformanceMetrics(y_actual, y_pred):
def getPerformanceMetrics():
    if len(X) == 0:
        preprocessing()
    
@@ -268,8 +268,8 @@ def partialFitNewData(message, label):
def switchCurrentAlgorithm():
    pass

def getPerformanceMetrics():
    pass
# def getPerformanceMetrics():
#     pass

def getSampleMessages():
    pass
 No newline at end of file
+21 −2
Original line number Diff line number Diff line
@@ -56,8 +56,25 @@ def getTopAlgorithms():
    # recall = ["1", "2", "3", "4", "5"]
    # accuracy = ["1", "2", "3", "4", "5"]
    
    name = "Perceptron", "Stochastic Gradient Descent", "Neural Network", "Decision Tree"
    accuracy, precision, recall, f1 = ml.getPerformanceMetrics()
    name = ["Perceptron", "Stochastic Gradient Descent", "Neural Network", "Decision Tree"]
    # accuracy, precision, recall, f1 = ml.getPerformanceMetrics()
    result = ml.getPerformanceMetrics()
    print(result)
    accuracy = result[0]
    precision = result[1]
    recall = result[2]
    f1 = result[3]
    # print(accuracy)
    # print(precision)

    # print(recall)
    # print(f1)

    # name = "test"
    # f1 = "test"
    # precision = "test"
    # recall = "test"
    # accuracy = "test"
    
    val = {
        "name": name,
@@ -66,6 +83,8 @@ def getTopAlgorithms():
        "recall": recall,
        "accuracy": accuracy
    }
    

    return val

# TODO make this get the actual top feature words
+0 −2
Original line number Diff line number Diff line
@@ -93,10 +93,8 @@ function getTopAlgorithms() {
    var replyObj

    var http = new XMLHttpRequest();

    http.open("GET", url + endpoint, true);
    http.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');

    http.onreadystatechange = function () {
        var DONE = 4;       // 4 means that the request is done
        var OK = 200;       // 200 means a successful return