brain.js not showing a result + showing "output" as wrong

110 Views Asked by At

I have to say "I just started working with neural nets and I have almost zero clue what I'm doing."

My Code: index.html

<!DOCTYPE html>
<html lang ="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=safari">
    <title>Document</title> 
    <script src="//unpkg.com/brain.js" defer></script>
    <script src="brain.js" defer></script>
</head>
<body>
    <div id="diagram"></div>
</body>
</html>

brain.js

const config = {
    binaryThresh: 0.5,
    hiddenLayers: [3], 
    activation: 'sigmoid' 
};
  
const net = new brain.NeuralNetwork(config);

net.train([
    {
        input: [0, 0]
        output: [0]
    },
    {
        input: [1, 0]
        output: [1]
    },
    {
        input: [0, 1]
        output: [1]
    },
    {
        input: [1, 1]
        output: [0]
    }
])

const diagram = document.getElementById("diagram")
diagram.innerHTML = brain.utilities.toSVG()

im tring to use brain.js details: On a Mac, on visual studio, can't find a answer online

1

There are 1 best solutions below

1
MoonLightning On

I forgot to put a comma after the inputs

so sorry