Machine Learning Utilities
Explore machine learning workflow utilities in JavaScript and TypeScript with @kanaries/ml, including preprocessing, sampling, model selection, statistics, and async execution helpers.
Module overview
The Utils module contains workflow helpers that make machine learning code easier to integrate into real JavaScript applications. These utilities are useful when the challenge is preparing data, validating models, or making model execution behave well inside browser or Node.js environments.
This module is a strong fit when:
- you need preprocessing, sampling, model selection, or simple statistics
- you need non-blocking execution around training or inference
- application responsiveness matters as much as model quality
- you want ML helpers that work naturally with the rest of a JS stack
JavaScript implementation
@kanaries/ml provides utility helpers in JavaScript and TypeScript so teams can shape data preparation, validation, execution behavior, integration patterns, and developer ergonomics without leaving the main application runtime. These helpers are especially useful in UI-heavy products and services where ML work should not block interaction or event-loop responsiveness.
If someone searches for "machine learning utilities in JavaScript", "preprocessing in TypeScript", or "async ML execution in TypeScript", this module is the right entry point.
Quick navigation
- Preprocessing: scale, normalize, encode, impute, and select features
- Sampling: sample arrays and create train/test splits
- ModelSelection: run K-fold splits, cross-validation, grid search, and randomized search
- Stat: compute lightweight statistics used in ML workflows
- asyncMode: run synchronous functions in a worker-like async execution path
Detailed module guide
How to use this module
- Start with Preprocessing and Sampling to make training data model-ready.
- Use ModelSelection to compare estimators and tune parameters.
- Use asyncMode when training or inference should not block the main browser thread or Node.js event loop.
- Pair utilities with model modules so application behavior stays predictable under load.
JavaScript deployment notes
- Utilities matter most when ML code runs inside interactive or latency-sensitive product surfaces.
- Use them to keep heavy work off the main thread when responsiveness is part of the user experience.
- Combine them with the rest of the API catalog to build production-friendly JS ML workflows.
Metrics
Evaluate classification, regression, clustering, ranking curves, and distance calculations with the @kanaries/ml Metrics JavaScript implementation for browser and Node.js workflows.
Preprocessing Utilities
Prepare numeric and categorical features with the @kanaries/ml Preprocessing JavaScript and TypeScript utilities for browser and Node.js machine learning pipelines.