How hedgehogdubz/riverml-machine-learning-pipeline works
Purpose and Compatibility Contract
RiverML is a lightweight, visual ML training and inference pipeline with equivalent C++ and TypeScript implementations. Models are trained interactively, serialized to portable seed strings, then reconstructed for low-overhead inference in either runtime. Cross-language seed compatibility is the central contract.
• README.md
• CPP Desktop Version/neuralnetwork.h
• Typescript Web Version/neuralnetwork.ts
Two Application Entry Points
The repository ships two independently runnable visualizers rather than a shared service/backend.
• Native desktop application: CPP Desktop Version/main.cpp, built through CPP Desktop Version/Makefile; uses C++23 and raylib.
• Browser application: Typescript Web Version/index.ts, loaded by Typescript Web Version/index.html and styled via Typescript Web Version/index.css. Its checked-in bundle is Typescript Web Version/dist/bundle.js.
Interactive Training and Visualization Layer
Each entry point owns UI state, user-editable model architecture/training settings, live training iterations, and rendering of model/data views. The UI is a boundary around the model APIs: it creates, trains, exports, loads, and runs models, while model implementations remain usable without a visualizer.
• CPP Desktop Version/main.cpp
• Typescript Web Version/index.ts
Neural Network Engine
The neural-network implementation provides configurable layer shapes and activations, prediction, training methods, and seed serialization/deserialization. Construction from a seed parses once and retains model parameters, making subsequent run() calls arithmetic-only.
• CPP Desktop Version/neuralnetwork.h
• Typescript Web Version/neuralnetwork.ts
Tree and Boosting Engine
XGBoost-style ensembles are modeled separately from neural networks. Decision trees provide the structural prediction primitive; the boosting layer manages trees, output aggregation, training, and XGBSEED1 serialization. The UI selects behavior based on the loaded seed type.
• CPP Desktop Version/decisiontree.h
• CPP Desktop Version/xgboost.h
• Typescript Web Version/decisiontree.ts
• Typescript Web Version/xgboost.ts
Seed Exchange and Inference Boundary
Seeds are the portable artifact between training and deployment: NNSEED1 carries network topology/parameters, while XGBSEED1 carries ensemble metadata and trees. Both language implementations expose model construction from a seed and run(inputs) inference, enabling headers or TypeScript modules to be embedded in other applications without the UI.
• CPP Desktop Version/neuralnetwork.h
• CPP Desktop Version/xgboost.h
• Typescript Web Version/neuralnetwork.ts
• Typescript Web Version/xgboost.ts
Runtime and Deployment
The desktop runtime depends on raylib and produces an mlvisualizer executable. The TypeScript runtime executes entirely in the browser, is package-managed through npm, and is intended for GitHub Pages deployment. GitHub Actions contains static-site workflow infrastructure.
• CPP Desktop Version/Makefile
• Typescript Web Version/package.json
• .github/workflows/static.yml
Components 17
C++ Desktop
- Desktop build · Builds the mlvisualizer executable.
CPP Desktop Version/Makefile - Desktop visualizer · Owns editable settings, training, rendering, seed import, and inference.
CPP Desktop Version/main.cpp - C++ neural network · Configurable network training, prediction, and NNSEED1 import/export.
CPP Desktop Version/neuralnetwork.h - C++ decision tree
CPP Desktop Version/decisiontree.h - C++ boosting ensemble · Manages trees, aggregation, training, and XGBSEED1 import/export.
CPP Desktop Version/xgboost.h
TypeScript Browser
- Browser page shell
Typescript Web Version/index.html - Browser visualizer · Owns editable settings, training, rendering, seed import, and inference.
Typescript Web Version/index.ts - Browser styling
Typescript Web Version/index.css - Checked-in bundle
Typescript Web Version/dist/bundle.js - TypeScript neural network · Configurable network training, prediction, and NNSEED1 import/export.
Typescript Web Version/neuralnetwork.ts - TypeScript decision tree
Typescript Web Version/decisiontree.ts - TypeScript boosting ensemble · Manages trees, aggregation, training, and XGBSEED1 import/export.
Typescript Web Version/xgboost.ts - Browser package runtime
Typescript Web Version/package.json - Static-site workflow · Supports GitHub Pages deployment.
.github/workflows/static.yml
Portable Model Contract
Seed formats keep trained models compatible across both runtimes.
- NNSEED1 · Topology and learned neural-network parameters.
- XGBSEED1 · Boosting metadata and serialized trees.
Other components
- Project contract · Defines the cross-language seed compatibility goal.
README.md
Connections 18
- Project contract → NNSEED1: defines compatibility
- Project contract → XGBSEED1: defines compatibility
- Desktop build → Desktop visualizer: builds
- Desktop visualizer → C++ neural network: trains and runs
- Desktop visualizer → C++ boosting ensemble: trains and runs
- C++ boosting ensemble → C++ decision tree: manages
- C++ neural network → NNSEED1: exports / imports
- C++ boosting ensemble → XGBSEED1: exports / imports
- Browser page shell → Checked-in bundle: loads
- Browser styling → Browser page shell: styles
- Checked-in bundle → Browser visualizer: contains
- Browser package runtime → Checked-in bundle: packages
- Browser visualizer → TypeScript neural network: trains and runs
- Browser visualizer → TypeScript boosting ensemble: trains and runs
- TypeScript boosting ensemble → TypeScript decision tree: manages
- TypeScript neural network → NNSEED1: exports / imports
- TypeScript boosting ensemble → XGBSEED1: exports / imports
- Static-site workflow → Checked-in bundle: deploys