---
title: "Gaussian Processes in JavaScript and TypeScript"
description: "Use Gaussian process regression for predictions with uncertainty and Gaussian process classification for class probabilities in the browser or Node.js with @kanaries/ml."
canonical_url: "https://ml.kanaries.net/docs/apis/gaussian_process"
markdown_url: "https://ml.kanaries.net/docs/apis/gaussian_process/index.html.md"
---
# Gaussian processes in JavaScript

Suppose you have a few sensor readings taken at unevenly spaced positions. A Gaussian process can use the distance between measurements to estimate the reading at a new position and how uncertain that estimate is. For labeled observations, the same idea can estimate the probability of each operating state.

The `GaussianProcess` module in `@kanaries/ml` runs in the browser and Node.js. Both estimators use a radial basis function (RBF) kernel. Its length scale controls the distance over which observations influence each other. Start with features in comparable units, or choose a separate length scale for each feature.

| If you need                                                                                                          | Use                                                                          |
| -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| A continuous estimate with a standard deviation for each prediction, or a covariance matrix for a set of predictions | [Gaussian process regression](/docs/apis/gaussian_process/regressor.md)      |
| Class labels and per-class probabilities                                                                             | [Gaussian process classification](/docs/apis/gaussian_process/classifier.md) |

Both estimators factor dense matrices with one row per training observation. Training memory grows quadratically with sample count, so these estimators are best suited to small datasets.
