ForgeCurves Machine Learning Guide

Curves for Machine Learning

A comprehensive guide to client-side, zero-install machine learning in ForgeCurves. Train classification and regression models, optimize deep neural networks, evaluate with diagnostic ROC/confusion plots, and export to production ONNX and standalone scripts.

1. Tabular Supervised Classification & Regression

ForgeCurves provides native implementations of modern statistical learning algorithms operating on column-major matrices and tabular datasets with zero cloud roundtrips:

Support Vector Machines (SVM)

Dual coordinate descent optimizer supporting linear and non-linear Radial Basis Function (RBF) kernel Gram matrices with automatic hyperparameter scaling.

Random Forests (TreeBagger)

Bootstrap aggregation of decision trees with randomized feature splits, out-of-bag error estimation, and feature importance rankings.

Regularized Linear Models

Lasso (L1), Ridge (L2), and Elastic Net regression solvers featuring full cyclical coordinate descent regularization path estimation.

Logistic GLMs

Iteratively Reweighted Least Squares (IRLS) solver for binomial and multinomial logistic classification with analytical deviance metrics.

% Train a non-linear RBF SVM classifier X = randn(1000, 10); y = 2 * (sum(X(:, 1:3), 2) > 0.5) - 1; % Binary labels (-1, +1) % Train model with RBF kernel gamma = 0.1 model = fitcsvm(X, y, "KernelFunction", "rbf", "KernelScale", 1.0, "BoxConstraint", 1.0); y_pred = predict(model, X(1:100, :)); acc = mean(y_pred == y(1:100)) * 100; printf("RBF SVM Training Accuracy: %.2f%%\n", acc);

2. Neural Network Package (nnet)

The built-in nnet subsystem allows designing, configuring, simulating, and training feedforward and recurrent neural networks directly in the browser runtime:

Topologies & Architectures

feedforwardnet, fitnet, patternnet, cascadeforwardnet, and recurrent Elman networks (newelm) with arbitrary layer dimensions.

Activation Functions

Hyperbolic tangent (tansig), Sigmoid (logsig), Linear (purelin), Softmax (softmax), and ReLU (poslin) with exact analytical derivatives.

Backpropagation Optimizers

Gradient Descent with Momentum (traingdm), Resilient Backprop (trainrp), Scaled Conjugate Gradient (trainscg), and Levenberg-Marquardt (trainlm).

Data Preprocessing

Automatic range normalization (mapminmax), standard normalization (mapstd), and one-hot index vector conversions (ind2vec / vec2ind).

% Configure and train a 2-layer MLP (10 -> 25 -> 2) net = feedforwardnet([25]); net.trainParam.epochs = 50; net.trainParam.lr = 0.05; [net, tr] = train(net, X', ind2vec(labels')'); Y_hat = sim(net, X_test');

3. Diagnostic Visualizations & Metrics

Evaluate model quality using high-performance vector diagnostics rendered dynamically via ForgeCurves' SVG plotting engine:

Confusion Matrix (plotconfusion)

Interactive multi-class confusion grid showing true positives, false alarms, and class-wise precision and recall metrics.

ROC Curves & AUC (plotroc)

Receiver Operating Characteristic curve generation with trapezoidal numerical integration of the Area Under Curve (AUC).

Training Convergence (plotperform)

Logarithmic performance decay plots tracking training, validation, and test mean squared error (MSE) over gradient epochs.

4. Empirical Benchmark Measurements

Benchmark suite results measured on ForgeCurves client-side runtime across core machine learning workloads:

Workload Description Dataset Scope Mean Time (ms) Throughput / Rate Status
Linear SVM Fit (Dual Coordinate Descent) 1,000 samples × 10 feats (50 iters) 290.92 ms 3,437 samples/s Accelerated
Non-Linear RBF Kernel Matrix 1,000 × 1,000 Gram matrix (γ=0.1) 1,213.68 ms 0.82 M-pairs/s Accelerated
Random Forest Fitting (TreeBagger) 10 decision trees, 1,000 × 10 132.40 ms 75.5 trees/s Accelerated
Lasso Path Optimization 20 λ regularization steps 1,351.13 ms 14.8 steps/s Optimal
MLP Forward Batch Inference 10,000 samples (20 → 50 → 10) 766.87 ms 13,040 samples/s WASM SIMD
Neural Network Backprop (traingdm) 1,000 × 10 samples, 50 epochs 9,274.82 ms 5.39 epochs/s Converged
Levenberg-Marquardt Step (trainlm) Hessian step (JTJ + λI) 174.35 ms 5.73 steps/s Linear Solve
ROC Curve & Trapezoidal AUC 10,000 continuous predictions 95.84 ms 104,344 preds/s Instant
Confusion Matrix Computation 10,000 predictions, 5 classes 252.64 ms 39,582 preds/s Instant

5. Model Portability, Script Synthesis & ONNX

Ensure zero vendor lock-in. Models trained inside ForgeCurves can be exported instantly to production environments without runtime dependencies:

ONNX Graph Assembly (export_onnx)

Compiles trained models into standard Open Neural Network Exchange (ONNX) binary schemas compatible with ONNX Runtime, PyTorch, and TensorRT (benchmark: 0.80 ms / 1,243 graphs/s).

Standalone .m Script Generation (export_m)

Synthesizes standalone GNU Octave / MATLAB® scripts embedding trained weight tensors directly, capable of executing independently in any headless environment (benchmark: 0.67 ms).

Interactive Model Card Inspector

Inspect layer topologies, sparsity ratios, bias distributions, and training telemetry in a graphical modal inspector.