Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matiasvlevi/Dann
Deep Neural Network Library for JavaScript.
https://github.com/matiasvlevi/Dann
dann dannjs deep-learning deep-neural-networks javascript js machine-learning neural-network nodejs
Last synced: 3 months ago
JSON representation
Deep Neural Network Library for JavaScript.
- Host: GitHub
- URL: https://github.com/matiasvlevi/Dann
- Owner: matiasvlevi
- License: mit
- Archived: true
- Created: 2020-09-04T17:59:49.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-01T03:48:38.000Z (about 2 years ago)
- Last Synced: 2024-07-05T15:46:37.074Z (4 months ago)
- Topics: dann, dannjs, deep-learning, deep-neural-networks, javascript, js, machine-learning, neural-network, nodejs
- Language: JavaScript
- Homepage: https://dannjs.org
- Size: 3.57 MB
- Stars: 427
- Watchers: 8
- Forks: 23
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - Dann
README
Deep Neural Network Library for Javascript
Train a neural network with your data & save its trained state!
Demo •
Installation •
Documentation •
Contribute •
Discord •
License
## Installation
### CDN :
```html```
### Node :
```
npm i dannjs
```
[dannjs on npmjs.com](https://www.npmjs.com/package/dannjs)## Getting started
### Require package
Components from the library can be imported like this
```js
const { Dann } = require('dannjs');
```
### Basic model construction
Setting up a small (4,6,6,2) neural network.
```js
const nn = new Dann(4, 2);
nn.addHiddenLayer(6, 'leakyReLU');
nn.addHiddenLayer(6, 'leakyReLU');
nn.outputActivation('tanH');
nn.makeWeights();
nn.lr = 0.0001;
nn.log({details:true});
```### Train by backpropagation
Training with a dataset.
```js
//XOR 2 inputs, 1 output
const dataset = [
{
input: [0, 0],
output: [0]
},
{
input: [1, 0],
output: [1]
},
{
input: [0, 1],
output: [1]
},
{
input: [1, 1],
output: [0]
}
];//train 1 epoch
for (data of dataset) {
nn.backpropagate(data.input, data.output);
console.log(nn.loss);
}
```
### Train by mutation
For neuroevolution simulations. Works best with small models & large population size.
```js
const populationSize = 1000;
let newGeneration = [];for (let i = 0; i < populationSize; i++) {
// parentNN would be the best nn from past generation.
const childNN = parentNN;
childNN.mutateRandom(0.01, 0.65);newGeneration.push(childNN);
}
```
### Standalone function
Convert a Neural Network to a JS function that can output predictions without the library.
```js
let strfunc = nn.toFunction();
console.log(strfunc);
```
### Save JSON
```js
let json = nn.toJSON();
console.log(json);
```
### Demo:
[AI predicts San-francisco Housing prices.](https://dannjs.org/livedemo.html)
more examples & demos [here](https://dannjs.org/#exm)### Online editor:
[https://dannjs.org/sandbox](https://dannjs.org/sandbox)
### Socials
### Graph Dann models with this library
[Dann-p5](https://github.com/matiasvlevi/Dann-p5)
### Stickers
[Get Dannjs stickers!](https://www.redbubble.com/people/Dannjs/shop)
## Contributors
Matias Vazquez-Levi
💻 📖 ⚠️ ✅
Francesco Ciulla
📢
Labnan
🐛 💻 ⚠️
sharkAce
💻
Hasnain Iqbal
💻 ⚠️
EL Ramos
🐛 ⚠️ 💻
viabhinav
✅
and1can
💻 ⚠️
Any contributions are welcome! See [CONTRIBUTING.md](https://github.com/matiasvlevi/Dann/blob/master/CONTRIBUTING.md).
## License
MIT