-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
71 lines (68 loc) · 2.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Confusion Matrix Generator</title>
</head>
<body>
<h1>Confusion Matrix Generator</h1>
<form action="calcConfusionMatrix.py" method="post">
<label for="classifierType">Is this a binary type classification? (Y/N): </label>
<input type="text" id="classifierType" name="classifierType"><br><br>
<!-- For binary classification -->
<div id="binary" style="display: none;">
<label for="tP">True Positive: </label>
<input type="text" id="tP" name="tP"><br>
<label for="fP">False Positive: </label>
<input type="text" id="fP" name="fP"><br>
<label for="tN">True Negative: </label>
<input type="text" id="tN" name="tN"><br>
<label for="fN">False Negative: </label>
<input type="text" id="fN" name="fN"><br>
</div>
<!-- For multi-class classification -->
<div id="multi" style="display: none;">
<!-- Input fields for multi-class confusion matrix -->
</div>
<br>
<button type="submit">Submit</button>
</form>
<!-- Output section -->
<div id="output" style="display: none;">
<h2>Output</h2>
<p id="precision"></p>
<p id="recall"></p>
<p id="f1"></p>
<h3>Confusion Matrix</h3>
<table id="confusionMatrix">
<!-- Confusion matrix will be displayed here -->
</table>
</div>
<script>
document.getElementById('classifierType').addEventListener('change', function () {
var binaryDiv = document.getElementById('binary');
var multiDiv = document.getElementById('multi');
if (this.value === 'Y') {
binaryDiv.style.display = 'block';
multiDiv.style.display = 'none';
} else {
binaryDiv.style.display = 'none';
multiDiv.style.display = 'block';
}
});
// Function to update the confusion matrix
function updateConfusionMatrix(matrix) {
var table = document.getElementById("confusionMatrix");
table.innerHTML = "";
for (var i = 0; i < matrix.length; i++) {
var row = table.insertRow();
for (var j = 0; j < matrix[i].length; j++) {
var cell = row.insertCell();
cell.appendChild(document.createTextNode(matrix[i][j]));
}
}
}
</script>
</body>
</html>