Libraries for browser-based mathematics, e.g. for browser-based machine learning.

I am not longer active in this area, and my information is definitely somewhat stale. You might want to check google for the latest. In particular I suspect that hardcore use cases for math in the browser now use webassembly or other fast(er) technologies, rather than attempting to use this horrible language to do numerics as many of the below options do.

## Simple statistics

## ml-matrix

ml-matrix (source) is used in some recent things. The API looks clean and sufficient for many classic ML tasks

## math.js

math.js has some matrix operation support and seems popular.

## math.gl

Welcome to math.gl! math.gl is JavaScript math library focused on geospatial and 3D use cases, designed as a composable, modular toolbox. math.gl provides a core module with classic vector and matrix classes, and a suite of optional modules implementing various aspects of geospatial and 3D math.

While the math.gl is highly optimized for use with the WebGL and WebGPU APIs, math.gl itself has no WebGL dependencies.

Backed by Uber, this may survive longer than some other options.

## ML.js

The LORIA ML.js tools lalolib/ mlweb (source).

MLweb is an open-source project that aims at bringing machine learning capabilities to web pages and web applications. See the official website for more information.

MLweb includes the following three components:

ML.js: a javascript library for machine learningLALOLib: a javascript library for scientific computing (linear algebra, statistics, optimization)LALOLab: an online Matlab-like development environment (try it at http://mlweb.loria.fr/lalolab/)

They implement impressive functionality and even includes native support for worker threads and concurrency. However… it is lacking modern web wrappings such as npm packaging etc, so is not convenient to use from e.g. webpack. The source code repository is not anywhere obvious so I’m not sure how current the code is.

## jStat

jStat is a statistical library written in JavaScript that allows you to perform advanced statistical operations without the need of a dedicated statistical language (e.g. MATLAB or R). Includes a tidy linear algebra library, but could be better optimised.

## lmfit

lmfit is a javaScript (emscripten) port of lmfit, a “self-contained C library for Levenberg-Marquardt least-squares minimization and curve fitting”

Currently only linear curve fitting is implemented.

## linalg

~~linalg uses native arrays because of their speed.~~

I needed a performance focused linear algebra module for visualizing data in 10+ dimensions, and implementing machine learning algorithms. I quickly learned that naive solutions to linear algebra operations can produce numerical errors so significant they are utterly useless for anything other than casual playtime. After that, I prioritized correctness over performance.

Untouched since released and small community, which is sad because the code looks solid.

## Incoming

~~numeric looks polished but has been untouched for 2 years~~~~jmat a complex and quaternion matrix library.~~~~random variables can be simulated easily using the probability distributions library~~- nerdamer is a symbolic math library for javascript (!)
~~weblas does GPU-accelerated mathematics and is used in hip projects such as keras-js.~~~~ndarray also used in keras-js.~~~~linear-algebra (blog post)~~~~sylvester the original, but predates much modern optimisation such as native arrays and WebAssembly~~

## No comments yet. Why not leave one?