Skip to content

Machine learning in JavaScript: a learning path

A useful JavaScript ML path starts with your goal. You can train a small model, run a model someone has already trained, or build an application around a hosted model API. Each route gives you different work to learn and different results to check.

By , a group of JavaScript engineers. Updated .

Three kinds of JavaScript ML work

Learning goals and evidence for three ways to use machine learning
Your goalWork to learnA result to inspect
Train a small modelPrepare examples, compare a simple rule, train the model, and evaluate errors.A saved model with predictions on separate examples and a comparison against the rule.
Run a pretrained modelLoad a model, prepare its expected inputs, interpret outputs, and measure behavior on your task.An inference feature with recorded loading cost, errors, and model/version details.
Use a hosted model APIMake requests from the appropriate application layer, handle failures, and check returned content.A working integration with examples of acceptable and unacceptable responses, plus observed cost and latency.

Training uses data to change a model's parameters, the numbers that control its predictions. Inference uses a model to produce an output. Loading a pretrained model or calling an API can give you inference without training the underlying model yourself. You still need to evaluate whether its outputs serve your task.

TensorFlow.js supports training and model execution in JavaScript, including the browser and Node.js. Its getting-started example trains a small model and makes a prediction. The pretrained model catalog gives you existing models to try on supported tasks.

JavaScript ML tools for the task

Choose a starting tool around the model work your feature needs. A library can support several kinds of work. Follow its model format, setup and execution requirements before choosing an API.

Starting points for local models and hosted model APIs
Your taskStarting tool and sourceWork and setup to check
Build and train a small model in JavaScriptTensorFlow.jsPrepare tensors, fit model weights, inspect loss and evaluate separate examples. Browser and Node.js setups use different execution options.
Run a pretrained text, image or audio pipelineTransformers.jsLoad a compatible model and its input processing. Browser examples use WebAssembly on the CPU or supported WebGPU execution. Check model download size and memory use.
Run an exported ONNX model in a web appONNX Runtime WebMatch the model's input types, shapes and operations to a supported browser execution option. The model file and its preprocessing need to agree.
Build a recognition or creative-coding sketchml5.jsStart from a documented model example, such as image classification or pose detection. Many examples use p5.js. Match library versions and request camera access when the example needs it.
Build a feature around a remotely hosted modelA provider's model API or SDKHandle requests, errors, latency and usage costs. Keep long-lived private credentials on your server. The linked Gemini guide illustrates one provider's authentication requirements.

ONNX Runtime Web also documents a separate training demo with its own setup. Follow the linked guide when exploring that route.

Match the installed library and model versions to their documentation. Test the exact model, browser and execution option on the devices you expect people to use. Browser GPU support and model loading costs can affect that choice.

The starting skills

For this path, you should be comfortable with JavaScript functions, arrays, objects, modules, and async code. You will read numbers, compare arrays, and interpret charts. Learn the ML terms and the required math as they become useful to the task.

Tensorcraft's browser lessons need no local installation. Its independent project uses a local browser app and requires Node.js 22 or later plus an initial dependency download. A project centered on Python research code or large-scale training needs additional tools and study beyond this JavaScript course.

A sequence for learning how models work

  1. The input and its meaning. Record the feature order, units, shapes, and scaling. Keep one small example you can check by hand. The reshape and transpose guide shows why two tensors with the same shape can group readings differently.
  2. A baseline and a prediction. State the decision the application needs to make. Try an ordinary rule first. Save its predictions and errors so you can judge whether a learned model adds value.
  3. Training and evaluation. Train on chosen examples, inspect the error measure, and compare predictions on separate data. Keep final test data out of model tuning. A smaller training error alone does not establish useful predictions.
  4. Browser delivery. Save and load the model, apply the same input preparation, and inspect the runtime on the devices you care about. Record slow or failed predictions as well as successful ones.
  5. An independent explanation. Keep the data source, model artifact, evaluation method, and mistakes together. The browser ML project case shows an existing demonstration with a baseline, model, and a failure to inspect.

If your immediate goal is a pretrained feature or an API integration, you can begin with that route and learn training when your task needs it. Keep input handling and evaluation in every route. TensorFlow's JavaScript learning curriculum offers another self-directed route through the topic.

How Deep Orbit follows that path

Deep Orbit has 11 modules and 56 lessons. Its fictional sensor investigation connects data preparation, training, evaluation, and deployment. The table names outputs to inspect as you work through the course. It describes the learning tasks. A learner produces and checks their own outputs.

The first module's 5 lessons are free, with no account required. Later modules require a one-time purchase and open as you complete earlier work. Some exercises use supplied models or controlled outputs. Passing their checks establishes the exercise task and does not validate an external model or a real scientific finding.

Deep Orbit's current course sequence
Module and accessOutput to inspect
Module 1Foundations: Tensors & Data5 lessons. Free.A tensor, its axis metadata, correctly grouped readings, and a consistent scaling rule.
Module 2Neural Networks: Layers & Architecture5 lessons. Paid continuation.A network definition and forward-pass values you can inspect before training.
Module 3Training: Loss, Gradients & Optimization5 lessons. Paid continuation.Training history and predictions checked against separate readings and a baseline.
Module 4Browser ML Runtimes6 lessons. Paid continuation.A saved-model loading path and a browser loop that runs repeated predictions.
Module 5Signal Processing5 lessons. Paid continuation.Frequency views and signal features to compare with the original readings.
Module 6Recurrent Networks5 lessons. Paid continuation.Time-ordered windows and predictions checked without sharing overlapping readings across splits.
Module 7Anomaly Detection5 lessons. Paid continuation.Reconstruction-error scores and an alert threshold with inspected mistakes.
Module 8Advanced Time-Series5 lessons. Paid continuation.Forecasting and ensemble comparisons with stated assumptions and measured errors.
Module 9LLM Integration5 lessons. Paid continuation.A reporting pipeline that retrieves evidence and checks generated claims.
Module 10Optimization & Edge5 lessons. Paid continuation.Recorded tradeoffs in model size, latency, memory, and prediction changes.
Module 11Capstone: Deploy DEEP SCAN5 lessons. Paid continuation.Release checks, monitoring, documentation, and a rehearsal of the assembled system.

The Deep Orbit overview explains the story and module map. The curriculum and pricing page describes the current offer. Deep Orbit is the available world. The other four worlds remain coming soon.

The free starting lessons

These lessons teach the input preparation that comes before training. You work with the crew's fictional readings and inspect what your JavaScript produces. Completing a tensor transformation does not train a model.

  1. From JavaScript Arrays to Tensors
  2. Understanding Tensor Shapes
  3. Basic Tensor Operations
  4. Loading and Preparing Data
  5. Data Normalization

Try the lessons to judge whether the story, explanations, and exercises help you understand the task. Continue into paid material if that learning method and the remaining curriculum fit your goal. Check whether you can explain an axis, reproduce a transformation, and identify an incorrect grouping.

Sources and scope

The module order, lesson counts, and free lesson links come from Tensorcraft's current Deep Orbit curriculum. The public technical references below explain TensorFlow.js independently of this course.