SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 198 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top