• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    Rust
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A neural network library written from scratch in Rust along with a web-based application for building + training neural networks + visualizing their outputs

Neural Network from Scratch in the Browser

A screenshot of the neural network web application itself which shows the full UI, network response visualization, and cost plot

Try it yourself: https://nn-viz.ameo.design

About

The goal of this project was to understand neural networks better by building them from the ground up. I wanted to be able to see dynamically how choosing different network architectures + training parameters affects network performance and how well networks can various functions.

It allows users to define a neural network infrastructure by adding hidden layers, picking neuron counts + activation function types, and setting training parameters like learning rate. The network then learns one of a variety of selectable target functions from which examples are randomly sampled to train it.

The "response" of the network over the entire range of possible inputs is then plotted as a 3D surface along with the target function to show how well the network has learned.

Technical Details

The neural network implementation itself is built in Rust and compiled to WebAssembly using Wasm SIMD to accelerate training.

The training takes place on a dedicated thread by using a web worker and the excellent Comlink library to communicate between the main/render thread and the training thread.

All the charts + visualizations are created using the excellent echarts library.

The UI is created using react-control-panel which is a React port of the excellent control-panel library for easy GUI creation.

Building + Developing

You'll need Rust nightly with WebAssembly support. You can install Rust via easily via rustup: https://rustup.rs/

Then, add the latest nightly toolchain + switch to it:

rustup default nightly

Add WebAssembly support:

rustup target add wasm32-unknown-unknown

This project uses the just command runner to simplify many tasks. Install it with:

cargo install just.

You'll also need wasm-bindgen:

cargo install wasm-bindgen --version=0.2.74

You'll need to install the wasm-opt tool from binaryen. You can download the executable from the Releases section on Github or build it yourself with CMake.

Then, you'll need tools for the web stack. I use yarn for node package management, and you can either update the Justfile to change yarn to npm or install yarn 1.0 from here: https://classic.yarnpkg.com/en/docs/install/

That should be all you need! To start the webpack dev server for hot-reloading and development, execute just run in the project root.

To create a release build, execute just build in the project root. That will produce a fully functional static website in the dist directory.

References

This is a list of some of the resources that I made use of while learning about neural networks and building this project:

More Repositories

1

robintrack

Scrapes the Robinhood API to retrieve + store popularity and price data.
JavaScript
683
star
2

tickgrinder

Low-latency algorithmic trading platform written in Rust
Rust
522
star
3

web-synth

A web-based sound synthesis, music production, and audio experimentation platform
TypeScript
350
star
4

three-good-godrays

Screen-space raymarched godrays for three.js using the pmndrs postprocessing library
TypeScript
152
star
5

cryptoviz

A web-based Depth-Of-Market visualization for data of the Poloniex cryptocurrency exchange.
JavaScript
73
star
6

spotifytrack

A personal homepage showing users' top songs and artists, providing a shareable link that they can use to show it off to friends.
TypeScript
65
star
7

rust-cloud-run-demo

A demo project showing off a Google Cloud Run-compatible web server using Rust, Rocket, Diesel, and MySQL
Rust
34
star
8

svelte-todo

Full-stack to-do app to try out SvelteKit. Minimal with SQLite database + HTTP basic auth
TypeScript
25
star
9

osutrack-api

API for osu!track https://ameobea.me/osutrack/
TypeScript
21
star
10

sketches

Various coding experiments and artsy things
Rust
17
star
11

phost

Small project hoster. Can deploy static websites + Dockerfiles and provide a management TUI client.
Python
17
star
12

polotrack

A web-based dashboard for analyzing Poloniex portfolio holdings + trade history to provide useful insights
JavaScript
15
star
13

io-game

A .io game written using Elixir/Phoenix and WebAssembly
Rust
12
star
14

rocket_async_compression

Implements response compression with gzip and brotli via the `async-compression` crate
Rust
11
star
15

noise-asmjs

Uses `noise-rs` library rendered to render noise to a canvas, allowing users to select and configure the utilized noise functions.
JavaScript
11
star
16

rnn-viz

Interactive visualizations and demos that are used in a blog post I wrote about logic in the context of neural networks
Jupyter Notebook
11
star
17

minutiae

Simulation engine involving a 2D universe populated by cells and entities
Rust
10
star
18

osutrack_irc_v2

Utility to provide osu! players with access to osu!track via in the in-game chat system.
JavaScript
7
star
19

FXCMDataDownloader

A Node/Java utility that downloads and stores historical price data from the FXCM API
Java
6
star
20

homepage

My personal website
JavaScript
6
star
21

algobot3

Third iteration of the algorithmic trading bot I've been working on.
JavaScript
5
star
22

ameotrack

Personal data storage and utility platform.
JavaScript
5
star
23

sprout

AI-powered anime recommendation website for MyAnimeList + AniList with other tools, visualizations, and profile analytics
Jupyter Notebook
5
star
24

sketches-3d

Experiments and demos of 3D game-like things. Mostly using Blender + Three.JS with custom shaders and interactive bits.
TypeScript
5
star
25

jantix

A fully-featured TypeScript library defining a modular, self-contained, 100% type-safe Redux architecture
TypeScript
4
star
26

GAWTrack

Events history tracker for GAW cloud miners.
PHP
4
star
27

algobot_elixir

Second iteration of the forex trader bot implemented in elixir
Elixir
4
star
28

advent-of-code-2018

https://adventofcode.com/
Rust
3
star
29

bot4

REPOSITORY MOVED -> https://github.com/ameobea/tickgrinder
2
star
30

paper_parser

Processes scientific papers and determines regions of interest in them.
Python
2
star
31

rust-stackdriver-logging-utils

Utilities and functions that make logging to Google Stackdriver from Rust using fern easier.
Rust
2
star
32

network_research

Misc. files and scripts used for network research
Python
2
star
33

snapmeo

A screenshotter and image uploader for my personal file hosting platform.
Rust
1
star
34

kouffee-bot

Bot for the discord server
TypeScript
1
star
35

hazbin

Website that randomly picks images from my personal collection of screenshots from the pilot episode of Hazbin Hotel. I have hundreds.
JavaScript
1
star
36

amc-web-ui

Main repository for the AutoMultipleChoice-based application being built for CS358
Python
1
star
37

bittrex-orderbook-importer

imports orderbook updates from bittrex
JavaScript
1
star
38

mysql-log-visualization

Tool for creating a live, web-based visualization of a MySQL server's activity.
Rust
1
star
39

Calculator-Programs

A collection of TI graphing calculator programs made by me during my early years of programming.
1
star
40

quavertrack

Quavertrack is a tool for tracking your stats progression in the rhythm game Quaver, allowing you to see how you and other players improve over time.
TypeScript
1
star
41

algobot

Algorithmic trading platform
JavaScript
1
star