const net = new brain.NeuralNetwork();
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(net)
This should show me the neural network diagram but it doesn't I do have the HTML all set up and it's supposed to be working correctly but when I run it first it loads for longer than usual code does but I suppose its because I'm working with more complex stuff than usual and well I just get a blank screen so I would like if someone would help me out by telling me what the problem is
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Storm</title>
<script src="//unpkg.com/brain.js" defer></script>
<script src="index.js" defer> </script>
</head>
<body>
<div id="diagram">Diagram </div>
</body>
</html>
Your import is this:
<script src="//unpkg.com/brain.js" defer></script>
But needs to be this:
<script src="https://unpkg.com/brain.js@1.0.0-rc.3/browser.js"></script>
https://
implies it will download it from a website, whereas yours
//
implies it will look on your local machine (your computer) for the file.
Since you didn't download the file, it won't load anything.
Maybe you want to use a different package, but the main issue is the import.