BrainJS / BrainJS/brain.js

Add Deno support

Open
#794 1 comment 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
14.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

## Summary

This probably would take way too much time, but [Deno](https://deno.land/) is a simple, modern and secure runtime for JavaScript, TypeScript, and WebAssembly that uses V8 and is built in Rust and I would like that brain.js would be ported to Deno without [a CDN](https://cdn.esm.sh/brain.js) and [compatibility mode](https://deno.land/manual/node/compatibility_mode).

### Basic example

```ts
import brain from 'https://deno.land/x/brainjs/mod.[ts/js]'

// provide optional config object (or undefined). Defaults shown.
const config = {
binaryThresh: 0.5,
hiddenLayers: [3], // array of ints for the sizes of the hidden layers in the network
activation: 'sigmoid', // supported activation types: ['sigmoid', 'relu', 'leaky-relu', 'tanh'],
leakyReluAlpha: 0.01, // supported for activation type 'leaky-relu'
};

// create a simple feed forward neural network with backpropagation
const net = new brain.NeuralNetwork(config);

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

const output = net.run([1, 0]); // [0.987]
```

### Motivation

To add support for Deno so developers that use Deno can use this library easier.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.