Commit 3dcf1905 authored by Larry Schultheis's avatar Larry Schultheis
Browse files

Added recall, accuracy, precision to JSON return and table

parent 6c059fe7
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -41,9 +41,16 @@ def correctPrediction():
def getTopFiveAlgorithms():
    name = ["This (in use)", "Comes", "From", "The", "Server"]
    f1 = ["5", "4", "3", "2", "1"]
    precision = ["1", "2", "3", "4", "5"]
    recall = ["1", "2", "3", "4", "5"]
    accuracy = ["1", "2", "3", "4", "5"]

    val = {
        "name": name,
        "f1": f1
        "f1": f1,
        "precision": precision,
        "recall": recall,
        "accuracy": accuracy
    }
    return val

+20 −1
Original line number Diff line number Diff line
@@ -40,11 +40,14 @@
        <div id="top_algorithm">
            <p>Algorithm currently in use: </p><p name="algorithmInUse"></p>
            <br>
            <table class="table table-bordered table-hover" style="width: 50%;">
            <table class="table table-bordered table-hover" style="width: 75%;">
                <thead class="thead-dark">
                    <tr>
                        <th>Algorithm Name</th>
                        <th>F1 score</th>
                        <th>Recall</th>
                        <th>Accuracy</th>
                        <th>Precision</th>
                    </tr>
                </thead>

@@ -52,22 +55,38 @@
                    <tr>
                        <td id="alg1_name"><b>Neural Network (in use)</b></td>
                        <td id="alg1_f1"><b>1.0</b></td>
                        <td id="alg1_recall"></td>
                        <td id="alg1_acc"></td>
                        <td id="alg1_precision"></td>

                    </tr>
                    <tr>
                        <td id="alg2_name">Neural Network</td>
                        <td id="alg2_f1">1.0</td>
                        <td id="alg2_recall"></td>
                        <td id="alg2_acc"></td>
                        <td id="alg2_precision"></td>
                    </tr>
                    <tr>
                        <td id="alg3_name">Neural Network</td>
                        <td id="alg3_f1">1.0</td>
                        <td id="alg3_recall"></td>
                        <td id="alg3_acc"></td>
                        <td id="alg3_precision"></td>
                    </tr>
                    <tr>
                        <td id="alg4_name">Neural Network</td>
                        <td id="alg4_f1">1.0</td>
                        <td id="alg4_recall"></td>
                        <td id="alg4_acc"></td>
                        <td id="alg4_precision"></td>
                    </tr>
                    <tr>
                        <td id="alg5_name">Neural Network</td>
                        <td id="alg5_f1">1.0</td>
                        <td id="alg5_recall"></td>
                        <td id="alg5_acc"></td>
                        <td id="alg5_precision"></td>
                    </tr>
                </tbody>

+19 −2
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ function getTopFiveAlgorithms() {

            // JSON -> JS object
            replyObj = JSON.parse(replyString);

            console.log(replyObj)
            // put the algorithm names in their ranked order
            document.getElementById("alg1_name").innerHTML = "<b>" + replyObj.name[0] + "</b>";
            document.getElementById("alg2_name").innerText = replyObj.name[1];
@@ -127,6 +127,24 @@ function getTopFiveAlgorithms() {
            document.getElementById("alg4_f1").innerText = replyObj.f1[3];
            document.getElementById("alg5_f1").innerText = replyObj.f1[4];

            document.getElementById("alg1_acc").innerHTML = "<b>" + replyObj.accuracy[0] + "</b>";
            document.getElementById("alg2_acc").innerText = replyObj.accuracy[1];
            document.getElementById("alg3_acc").innerText = replyObj.accuracy[2];
            document.getElementById("alg4_acc").innerText = replyObj.accuracy[3];
            document.getElementById("alg5_acc").innerText = replyObj.accuracy[4];

            document.getElementById("alg1_precision").innerHTML = "<b>" + replyObj.precision[0] + "</b>";
            document.getElementById("alg2_precision").innerText = replyObj.precision[1];
            document.getElementById("alg3_precision").innerText = replyObj.precision[2];
            document.getElementById("alg4_precision").innerText = replyObj.precision[3];
            document.getElementById("alg5_precision").innerText = replyObj.precision[4];

            document.getElementById("alg1_recall").innerHTML = "<b>" + replyObj.recall[0] + "</b>";
            document.getElementById("alg2_recall").innerText = replyObj.recall[1];
            document.getElementById("alg3_recall").innerText = replyObj.recall[2];
            document.getElementById("alg4_recall").innerText = replyObj.recall[3];
            document.getElementById("alg5_recall").innerText = replyObj.recall[4];                        

            loadAlgGraph(replyObj)
        }
    }
@@ -177,7 +195,6 @@ function getTopFiveWords() {
function initializeIndex() {
    getTopFiveAlgorithms();
    getTopFiveWords();
    //loadGraphs(topAlgs);
}

// when the Clear button is pressed, clear the message textarea