Explorar el Código

Fix: test 01 is useful after delete net options

Unclear reason to get empty result after set any options in neural network
Jason Xing hace 3 años
padre
commit
559e6a4234
Se han modificado 1 ficheros con 8 adiciones y 14 borrados
  1. 8 14
      brain-js.test-01.html

+ 8 - 14
brain-js.test-01.html

@@ -9,8 +9,8 @@
       #network {
         background: #ccc;
         border: 1px solid red;
-        width: 80%;
-        height: 400px;
+        width: 640px;
+        height: 480px;
       }
     </style>
   </head>
@@ -29,18 +29,13 @@
   </body>
   <script src="brain-browser.js"></script>
   <script type="text/javascript">
-    // provide optional config object (or undefined). Defaults shown.
-    const config = {
-      binaryThresh: 0.5,
-      hiddenLayers: [5], // array of ints for the sizes of the hidden layers in the network
-      activation: "relu", // supported activation types: ['sigmoid', 'relu', 'leaky-relu', 'tanh'],
-      leakyReluAlpha: 0.01, // supported for activation type 'leaky-relu'
-      // inputSize: 2,
-      // outputSize: 2,
+    const svg_config = {
+      height: 480,
+      width: 640,
     };
 
     // create a simple feed forward neural network with backpropagation
-    const net = new brain.NeuralNetwork(config);
+    const net = new brain.NeuralNetwork();
 
     net.train([
       { input: [0, 0], output: [0] },
@@ -50,15 +45,14 @@
     ]);
 
     const input = [1, 0];
-
     const output = net.run(input); // [0.987]
 
     document.getElementById("output").innerHTML =
-      "Input:" + input + "<br/>" + "output is " + output;
+      `Input: [${input}] <br/>Output is ${output}`;
 
     document.getElementById("network").innerHTML = brain.utilities.toSVG(
       net,
-      config
+      svg_config
     );
   </script>
 </html>