From Wikipedia, the free encyclopedia
Brain.js
Developer(s)Open-source contributors
Initial releaseMay 10, 2010; 13 years ago (2010-05-10)
Repository Brain.js Repository
Written in JavaScript, TypeScript
Platform Node.js, Web browser
Type Neural Networking
License MIT License
Website brain.js.org

Brain.js is a JavaScript library used for neural networking, which is released as free and open-source software under the MIT License. [1] It can be used in both the browser and Node.js backends. [2] [3]

Brain.js is most commonly used as a simple introduction to neural networking, as it hides complex mathematics and has a familiar modern JavaScript syntax. [4] [5] It is maintained by members of the Brain.js organization and open-source contributors.

Examples

Creating a feedforward neural network with backpropagation:

const net = new brain.NeuralNetwork();

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

console.log(net.run([1, 0]));

Creating a recurrent neural network:

const net = new brain.recurrent.RNN();

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

let output = net.run([0, 0]); // [0]
output = net.run([0, 1]); // [1]
output = net.run([1, 0]); // [1]
output = net.run([1, 1]); // [0]

Train the neural network on RGB color contrast:

const net = new brain.NeuralNetwork();

net.train([{
    input: {
      r: 0.03,
      g: 0.7,
      b: 0.5
    },
    output: {
      black: 1
    }
  },
  {
    input: {
      r: 0.16,
      g: 0.09,
      b: 0.2
    },
    output: {
      white: 1
    }
  },
  {
    input: {
      r: 0.5,
      g: 0.5,
      b: 1.0
    },
    output: {
      white: 1
    }
  }
]);

const output = net.run({
  r: 1,
  g: 0.4,
  b: 0
}); // { white: 0.99, black: 0.002 }

console.log(output)

External links

References

  1. ^ Eschweiler, Sebastian (2020-09-09). "Beginner's Guide To Neural Networks In JavaScript With Brain.js". CodingTheSmartWay.com Blog. Retrieved 2022-03-19.
  2. ^ Dijkhuizen, Bryan (2021-11-02). "Machine Learning in JavaScript Using Brain.js for Simple Applications". Medium. Retrieved 2022-03-19.
  3. ^ "Neural Networks In JavaScript - Brain.js Tutorial". Scrimba. Retrieved 2022-03-13.
  4. ^ "Build and train a neural network with nothing but JavaScript using Brain.js". IBM Developer. Retrieved 2022-03-19.
  5. ^ "Brain.js". www.w3schools.com. Retrieved 2022-03-19.
From Wikipedia, the free encyclopedia
Brain.js
Developer(s)Open-source contributors
Initial releaseMay 10, 2010; 13 years ago (2010-05-10)
Repository Brain.js Repository
Written in JavaScript, TypeScript
Platform Node.js, Web browser
Type Neural Networking
License MIT License
Website brain.js.org

Brain.js is a JavaScript library used for neural networking, which is released as free and open-source software under the MIT License. [1] It can be used in both the browser and Node.js backends. [2] [3]

Brain.js is most commonly used as a simple introduction to neural networking, as it hides complex mathematics and has a familiar modern JavaScript syntax. [4] [5] It is maintained by members of the Brain.js organization and open-source contributors.

Examples

Creating a feedforward neural network with backpropagation:

const net = new brain.NeuralNetwork();

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

console.log(net.run([1, 0]));

Creating a recurrent neural network:

const net = new brain.recurrent.RNN();

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

let output = net.run([0, 0]); // [0]
output = net.run([0, 1]); // [1]
output = net.run([1, 0]); // [1]
output = net.run([1, 1]); // [0]

Train the neural network on RGB color contrast:

const net = new brain.NeuralNetwork();

net.train([{
    input: {
      r: 0.03,
      g: 0.7,
      b: 0.5
    },
    output: {
      black: 1
    }
  },
  {
    input: {
      r: 0.16,
      g: 0.09,
      b: 0.2
    },
    output: {
      white: 1
    }
  },
  {
    input: {
      r: 0.5,
      g: 0.5,
      b: 1.0
    },
    output: {
      white: 1
    }
  }
]);

const output = net.run({
  r: 1,
  g: 0.4,
  b: 0
}); // { white: 0.99, black: 0.002 }

console.log(output)

External links

References

  1. ^ Eschweiler, Sebastian (2020-09-09). "Beginner's Guide To Neural Networks In JavaScript With Brain.js". CodingTheSmartWay.com Blog. Retrieved 2022-03-19.
  2. ^ Dijkhuizen, Bryan (2021-11-02). "Machine Learning in JavaScript Using Brain.js for Simple Applications". Medium. Retrieved 2022-03-19.
  3. ^ "Neural Networks In JavaScript - Brain.js Tutorial". Scrimba. Retrieved 2022-03-13.
  4. ^ "Build and train a neural network with nothing but JavaScript using Brain.js". IBM Developer. Retrieved 2022-03-19.
  5. ^ "Brain.js". www.w3schools.com. Retrieved 2022-03-19.

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook