Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
sauber/deno-neuronsPure-deno implementation of neural network inspired by Micrograd.
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




JSR Score
100%
Published
a year ago (1.2.6)
deno-neurons
Pure-deno implementation of neural network.
Example
Neural network to recognize a circular wave.
import { Network, Train } from "jsr:@sauber/neurons"; // Generate training inputs and outputs const inputs: number[][] = []; const outputs: number[][] = []; for (let i = 0; i < 100; ++i) { const [x, y] = [Math.random() * 14 - 7, Math.random() * 14 - 7]; inputs.push([x, y]); outputs.push([-Math.sin(Math.sqrt(x * x + y * y))]); } // Define neural network const network = new Network(2).dense(8).lrelu.dense(6).lrelu.dense(1).tanh; // Perform training of neural network const train = new Train(network, inputs, outputs); train.epsilon = 0.01; train.callback = (iteration: number, loss: number[]) => console.log(`Iteration: ${iteration}, Loss: ${loss[loss.length - 1]}`); const max_iteration = 20000; const learning_rate = 0.2; train.run(max_iteration, learning_rate);
See Also
Use ML-CLI-Dashboard for ascii dashboard visualization during training.
Credits
Based on MicrogradTS
License
See LICENSE.
Built and signed on
GitHub Actions
Add Package
deno add jsr:@sauber/neurons
Import symbol
import * as neurons from "@sauber/neurons";
Import directly with a jsr specifier
import * as neurons from "jsr:@sauber/neurons";
Add Package
pnpm i jsr:@sauber/neurons
pnpm dlx jsr add @sauber/neurons
Import symbol
import * as neurons from "@sauber/neurons";
Add Package
yarn add jsr:@sauber/neurons
yarn dlx jsr add @sauber/neurons
Import symbol
import * as neurons from "@sauber/neurons";
Add Package
vlt install jsr:@sauber/neurons
Import symbol
import * as neurons from "@sauber/neurons";
Add Package
npx jsr add @sauber/neurons
Import symbol
import * as neurons from "@sauber/neurons";
Add Package
bunx jsr add @sauber/neurons
Import symbol
import * as neurons from "@sauber/neurons";