-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnn.php
97 lines (75 loc) · 2.31 KB
/
nn.php
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
<html>
<head>
<meta charset="UTF-8">
<title> Neural network </title>
<link rel="stylesheet" href="styles.css">
<link rel="icon" href="images/logo_transparent.png">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<?php
// Learning rate field
$learning_rate = $_REQUEST['learning_rate'];
echo "<input type='hidden' id ='learning_rate' value='".$learning_rate."'>";
$hidden_neurons = $_REQUEST['hidden_neurons'];
echo "<input type='hidden' id ='hidden_neurons' value='".$hidden_neurons."'>";
// Table containing the training input data
echo "<table id='training_inputs' style='display: none;'>";
if ( isset($_FILES["training_inputs_file"]) && $_FILES['training_inputs_file']['tmp_name'] != null) {
$file = $_FILES['training_inputs_file']['tmp_name'];
}
else {
$file = "example_data/training_inputs.csv";
}
$output = "";
if( ($handle = fopen($file, "r")) !== false) {
while (($line = fgetcsv($handle)) !== false) {
$output .= "<tr>";
foreach ($line as $cell) {
$output .= "<td>" . htmlspecialchars($cell) . "</td>";
}
$output .= "</tr>\n";
}
fclose($handle);
}
echo $output;
echo " </table>";
// Table containing the training output data
echo "<table id='training_outputs' style='display: none;'>";
if ( isset($_FILES["training_outputs_file"]) && $_FILES['training_outputs_file']['tmp_name'] != null) {
$file = $_FILES['training_outputs_file']['tmp_name'];
}
else {
$file = "example_data/training_outputs.csv";
}
$output = "";
if( ($handle = fopen($file, "r")) !== false) {
while (($line = fgetcsv($handle)) !== false) {
$output .= "<tr>";
foreach ($line as $cell) {
$output .= "<td>" . htmlspecialchars($cell) . "</td>";
}
$output .= "</tr>\n";
}
fclose($handle);
}
echo $output;
echo " </table>";
?>
<!-- JS -->
<div class="center">
<h1> Artificial neural network </h1>
<canvas id='canvas' width="800" height="600"> Your broswer sucks </canvas>
<br>
<input type="button" value="Reset" id="reset_button">
<br><br>
<form action="index.php">
<input type="submit" value="Return">
</form>
<script type="text/javascript" src="script.js"></script>
</div>
<?php
include("signature.php");
?>
</body>
</html>