Interactive neural network decision-boundary visualiser. Build, train, and inspect small neural networks in the browser β watch the decision boundary evolve epoch by epoch, flip between 2D and 3D views, follow gradient flow, and export trained models. Built with Hexagonal Architecture (Ports & Adapters) so the ML core has no dependency on TensorFlow.js, D3, or the DOM.
π Live Demo π Feature Guide Β· Architecture Β· Roadmap
Status. All 9 feature phases and the 5-phase improvement roadmap are complete (99 features shipped, architecture consolidated). See
docs/ROADMAP.mdfor the full delivery status anddocs/archive/for historical audit reports.
- Optimizers β SGD (with momentum), Adam, RMSprop, Adagrad
- Regularisation β L1, L2, dropout (per-layer), batch normalisation, gradient clipping
- Learning-rate control β exponential / step / cosine schedules, warmup, cyclic LR (triangle + cosine), LR finder with sensitivity curve
- Training flow β configurable batch size, epoch limit, FPS-capped training speed, early stopping on validation-loss patience, train/validation split, step-by-step single-epoch mode
- Activations β ReLU, Sigmoid, Tanh, ELU, with per-layer selection
- Multi-class classification up to 10 classes via softmax output
- Built-in patterns β Circle, XOR, Spiral, Gaussian clusters, N-cluster blobs
- Real-world samples β Iris and Wine (PCA-reduced to 2D, bundled)
- Custom input β draw your own points by clicking, or upload CSV
- Controls β noise level, sample count, class-imbalance ratio, feature normalisation + standardisation toggles, train/test split visualisation
- Real-time decision boundary with colour-scheme presets (default, viridis, plasma, cool, warm), heatmap opacity and contour-count sliders, misclassified-point highlighting, confidence circles
- Interactive chart β zoom, pan, hover tooltips, click-for-prediction details
- 3D view (Three.js) β height encodes prediction confidence
- Network diagram β interactive D3 node graph with weight-magnitude colour coding
- Activation heatmaps β per-layer neuron activations in real time
- Voronoi overlay β alternative boundary view
- Gradient flow animation β backprop visualisation
- Boundary evolution recording β record and replay training
- Loss chart β training loss + dashed validation loss overlay
- Accuracy, precision, recall, F1 (macro-averaged)
- Confusion matrix heatmap
- ROC curve with AUC (binary classification)
- Training history with JSON + CSV export
- Weight histograms and model-complexity metrics
- Overfitting / underfitting detection with suggested fixes
- Model download / upload β TensorFlow.js JSON + weights format
- ONNX export for cross-platform use
- Python codegen β produces a matching Keras/TensorFlow script
- Image export β PNG, SVG, and screenshot-with-metadata overlay
- Session save/load β auto-save to localStorage
- Shareable config code β copy/paste Base64 string
- Learn / Experiment / Advanced mode selector (persisted) β progressively reveals controls as the user graduates between surfaces
- Preset configurations β five quick-start templates + bookmarkable named presets
- Guided tutorials and challenge mode for self-directed learning
- ELI5 tooltips on hyperparameters
- Keyboard shortcuts β Space, S, R, F, Escape
- Dark / light theme, fullscreen mode, responsive mobile layout
- Browser notifications on training completion
- Model comparison (A/B) panel β side-by-side training runs
- Model ensemble voting visualisation
- Feature importance (permutation), LIME-style explanations, saliency maps
- Adversarial examples (FGSM), Bayesian NNs (MC Dropout), neural architecture search
- Web-Worker-backed training for a non-blocking UI
- WebGL-accelerated rendering and progressive grid chunking
- REST API via
window.neurovizAPI, WebSocket live collaboration, plugin system for custom extensions
A full per-feature reference lives in docs/FEATURES.md.
Delivery status by phase is tracked in docs/ROADMAP.md.
NeuroViz follows Hexagonal Architecture (Ports & Adapters). Core business logic has zero dependency on TensorFlow.js, D3, Three.js, or the DOM β adapters live at the edges and are wired up in a composition root.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation β
β (controllers, modals, toast, workflow UI) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Composition Root β
β (main.ts + ApplicationBuilder) β
β Wires adapters to ports via dependency injection β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββΌββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β TFNeuralNet β β D3Chart β β DatasetRepo β
β (TensorFlow.js)β β (D3 + Three.js) β β (mock + real) β
ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ
β implements β implements β implements
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β INeuralNetwork β β IVisualizer β β IDatasetRepo β
β Service β β Service β β β
ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ
βββββββββββββββββββββΌββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Core β
β Domain (entities) Β· Ports (interfaces) Β· Application β
β TrainingSession facade β SessionStateStore, β
β DatasetPreparationService, ExperimentService, LRFinderService β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
See docs/ARCHITECTURE.md for the full layer
breakdown, port contracts, and extension points.
src/
βββ core/ # Framework-agnostic business logic
β βββ domain/ # Point, Prediction, Hyperparameters, ...
β βββ ports/ # INeuralNetworkService, IVisualizerService, ...
β βββ application/ # TrainingSession facade + extracted services
β βββ training/ # SessionStateStore, DatasetPrep, Experiment, LRFinder
β
βββ infrastructure/ # Framework-specific adapters
β βββ tensorflow/ # TFNeuralNet (TensorFlow.js)
β βββ d3/ # D3Chart, Voronoi, gradient flow
β βββ three/ # 3D boundary view (Three.js)
β βββ api/ # Dataset repositories
β βββ education/ # Tutorials, challenges, explain-this-moment
β
βββ presentation/ # Controllers, modals, toasts, workflow UI
βββ main.ts # Composition root
| Decision | Rationale |
|---|---|
| Ports & Adapters | Core logic never imports TensorFlow.js, D3, or Three.js. |
| Constructor injection | All dependencies arrive via TrainingSession facade. |
| Service extraction | TrainingSession delegates to four SRP services. |
| Async training loop | Guard-rail pattern prevents overlapping GPU calls. |
| Immutable domain | Point, Prediction, Hyperparameters are readonly. |
| Observer state fan-out | Controllers subscribe via onStateChange, never poll. |
- Node.js 20+ (LTS recommended)
- npm 10+
git clone https://github.com/DevilsDev/NeuroViz.git
cd NeuroViz
npm install
npm run devThe app will open at http://localhost:3000.
| Command | Description |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build for production |
npm run preview |
Preview production build locally |
npm run typecheck |
Run TypeScript type checking |
npm test |
Run unit tests (Vitest) |
npm run test:coverage |
Run tests with coverage report |
npm run test:e2e |
Run E2E tests (Playwright) |
npm run test:e2e:ui |
Run E2E tests with interactive UI |
- Pick a dataset β Circle, XOR, Spiral, Gaussian, Clusters, Iris, Wine, or draw your own.
- Pick a preset (optional) β five quick-start configurations cover common learning scenarios.
- Configure the network β set optimizer, learning rate, hidden
layers (e.g.
8, 4), activation, regularisation, batch size. - Initialise β creates the model with the chosen hyperparameters.
- Train β click Start to run the training loop, or Step to advance one epoch at a time.
- Observe β watch the boundary, loss chart, confusion matrix, activation heatmaps, and gradient flow update in real time.
- Analyse β flip to the Analyze tab for confusion matrix, precision / recall / F1, and model-complexity metrics.
- Export β save the model, the session, an image, or generate Python code.
New users should stay in Learn Mode (the default) to see a calm subset of controls. Experiment and Advanced modes progressively reveal regularisation, LR-schedule, gradient flow, and research tools.
| Layer | Technology |
|---|---|
| ML framework | TensorFlow.js |
| 2D visualisation | D3.js |
| 3D visualisation | Three.js |
| Styling | CSS variables + Tailwind CSS |
| Build tool | Vite |
| Unit testing | Vitest |
| E2E testing | Playwright |
| Language | TypeScript 5.6 |
npm testCoverage focuses on:
TrainingSessionorchestration and lifecycle transitions- Port contract compliance
- Domain entity validation
- Application-layer services (early stopping, LR scheduling, data split)
- Presentation controllers (with mocked ports)
Full browser tests across Chromium, Firefox, and WebKit:
npm run test:e2eTest categories:
- Happy path β full training cycle, pause/resume, reset
- Deterministic datasets β seeded mock repository
- Mode switching β Learn / Experiment / Advanced
- Export flows β model, image, session
- Accessibility β keyboard navigation, ARIA labels
The GitHub Actions workflow runs on every push and PR:
- Lint & type check β ESLint +
tsc --noEmit - Unit tests β Vitest with coverage
- Build β Vite production build
- E2E tests β Playwright across Chromium, Firefox, WebKit
- Deploy β GitHub Pages (main branch only)
All 9 feature phases (99 features) and the 5-phase improvement roadmap are complete:
- Phases 1β9 β Training, metrics, visualisation, data management, model capabilities, UX, education, performance, research features
- Improvement Phase 2 β Repo hygiene, README reconciliation
- Improvement Phase 3 β State cues (stale badge, validation badge,
dataset source label, WebGL banner), Learn Mode
data-min-modeexpansion - Improvement Phase 4 β First-run onboarding modal, workflow spine
(
Prepare β Configure β Train β Analyze), Learn Mode presets + captions - Improvement Phase 5 β
TrainingSessionextraction intoSessionStateStore,DatasetPreparationService,ExperimentService - Improvement Phase 6 β
LRFinderServiceextraction, docs polish
Full per-feature status lives in docs/ROADMAP.md.
Historical audit reports are archived under docs/archive/.
- Create an adapter implementing
INeuralNetworkService:
// src/infrastructure/onnx/ONNXNeuralNet.ts
export class ONNXNeuralNet implements INeuralNetworkService {
async initialize(config: Hyperparameters): Promise<void> { /* ... */ }
async train(data: Point[]): Promise<number> { /* ... */ }
async predict(grid: Point[]): Promise<Prediction[]> { /* ... */ }
}- Swap the adapter in
ApplicationBuilder:
// const neuralNetService = new TFNeuralNet();
const neuralNetService = new ONNXNeuralNet();No changes required in TrainingSession or any core logic.
- Implement
IVisualizerService:
// src/infrastructure/canvas/CanvasChart.ts
export class CanvasChart implements IVisualizerService {
renderData(points: Point[]): void { /* ... */ }
renderBoundary(predictions: Prediction[], gridSize: number): void { /* ... */ }
}- Inject in
ApplicationBuilder:
const visualizerService = new CanvasChart('viz-container', 500, 500);Apache 2.0 Β· DevilsDev
See LICENSE for details.