Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. // provide optional config object (or undefined). Defaults shown.
  2. const config = {
  3. binaryThresh: 0.5,
  4. hiddenLayers: [3], // array of ints for the sizes of the hidden layers in the network
  5. activation: 'sigmoid', // supported activation types: ['sigmoid', 'relu', 'leaky-relu', 'tanh'],
  6. leakyReluAlpha: 0.01 // supported for activation type 'leaky-relu'
  7. };
  8.  
  9. // create a simple feed forward neural network with backpropagation
  10. const net = new brain.NeuralNetwork(config);
  11.  
  12. net.train([{input: [0, 0], output: [0]},
  13. {input: [0, 1], output: [1]},
  14. {input: [1, 0], output: [1]},
  15. {input: [1, 1], output: [0]}]);
  16.  
  17. const output = net.run([1, 0]); // [0.987]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement