-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappengine.html
More file actions
134 lines (124 loc) · 4.1 KB
/
Copy pathappengine.html
File metadata and controls
134 lines (124 loc) · 4.1 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>NeuralGo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
modelId = "";
serializedNetwork = ""
function getSerializedNetwork(event) {
reader = new FileReader();
reader.onload = function() {
serializedNetwork = reader.result;
}
reader.readAsText(event.target.files[0]);
}
trainingExamples = ""
function getTrainingExamples(event) {
reader = new FileReader();
reader.onload = function() {
trainingExamples = reader.result;
}
reader.readAsText(event.target.files[0]);
}
testingExamples = ""
function getTestingExamples(event) {
reader = new FileReader();
reader.onload = function(event) {
testingExamples = reader.result;
}
reader.readAsText(event.target.files[0]);
}
function create(form) {
$.post(
"/create",
{ serializedNetwork: serializedNetwork },
function(data) {
modelId = data;
},
"text");
}
// TODO(ariw): Add MNIST data.
function train(form) {
$.post(
"/train",
{ modelId: modelId,
trainingExamples: trainingExamples,
trainingIterations: form.trainingIterations.value,
learningRate: form.learningRate.value,
weightDecay: form.weightDecay.value,
batchSize: form.batchSize.value,
errorName: form.errorName.value },
function(data) {
$("#output").val($("#output").val() + data);
},
"text");
}
function test(form) {
$.post(
"/test",
{ modelId: modelId,
testingExamples: testingExamples },
function(data) {
$("#output").val($("#output").val() + data);
},
"text");
}
function evaluate(form) {
$.post(
"/evaluate",
{ modelId: modelId, features: form.features.value },
function(data) {
$("#output").val($("#output").val() + data);
},
"text");
}
function get(form) {
$.post(
"/get",
{ modelId: modelId },
function(data) {
$("#output").val($("#output").val() + data);
},
"text");
}
</script>
</head>
<body>
This application allows you to create and train a <a href="https://en.wikipedia.org/wiki/Artificial_neural_network">neural network</a> using the <a href="https://github.com/evilrobot69/NeuralGo">NeuralGo library</a>.<br><br>
<form action="javascript:create(this)">
<b>Create the network</b><br>
Serialized network file (<a href="https://raw.githubusercontent.com/evilrobot69/NeuralGo/master/examples/circle/network.txt">example</a>): <input type="file" id="serializedNetwork" onchange="getSerializedNetwork(event)"><br>
<input type="submit" value="Create">
</form><br><br>
<form action="javascript:train(this)">
<b>Train the network</b><br>
Training file (<a href="https://raw.githubusercontent.com/evilrobot69/NeuralGo/master/examples/circle/training.txt">example</a>): <input type="file" id="trainingExamples" onchange="getTrainingExamples(event)"><br>
Training iterations: <input type="number" id="trainingIterations" value=1000 min=0><br>
Learning rate: <input type="number" id="learningRate" value=0.001 step="any" min=0><br>
Weight decay: <input type="number" id="weightDecay" value=0 step="any" min=0><br>
Batch size: <input type="number" id="batchSize" value=1 min=0><br>
Error function:
<select id="errorName">
<option value="0">Quadratic</option>
<option value="1">Cross-entropy</option>
</select><br>
<input type="submit" value="Train">
</form><br><br>
<b>Test the network</b><br>
<form action="javascript:test(this)">
Testing file (<a href="https://raw.githubusercontent.com/evilrobot69/NeuralGo/master/examples/circle/testing.txt">example</a>): <input type="file" id="testingExamples" onchange="getTestingExamples(event)"><br>
<input type="submit" value="Test">
</form><br><br>
<b>Evaluate the neural network at a point</b><br>
<form action="javascript:evaluate(this)">
<input type="text" id="features" value="[1, 1]">
<input type="submit" value="Evaluate">
</form><br><br>
<b>Output</b><br>
<form action="javascript:get(this)">
<input type="submit" value="Get network">
</form><br>
<textarea id="output" cols=80 rows=40 readonly></textarea>
</body>
</html>