---
title: "ExtraTreesRegressor in JavaScript with @kanaries/ml"
description: "Train extremely randomized regression trees in JavaScript or TypeScript with ExtraTreesRegressor from @kanaries/ml for browser and Node.js."
canonical_url: "https://ml.kanaries.net/docs/apis/ensemble/extraTreesRegressor"
markdown_url: "https://ml.kanaries.net/docs/apis/ensemble/extraTreesRegressor.md"
---
# ExtraTreesRegressor in JavaScript

## Algorithm overview

ExtraTreesRegressor averages many highly randomized regression trees. Random thresholds diversify members, and averaging turns their piecewise predictions into a lower-variance ensemble.

## JavaScript implementation

`Ensemble.ExtraTreesRegressor` uses the shared forest runtime in `@kanaries/ml`, works in browsers and Node.js, supports seeded training, and exposes averaged feature importances.

## Interactive Extra Trees regression playground

Adjust the number of randomized trees, reroll the sample, or add a point. The displayed prediction is fitted live with `Ensemble.ExtraTreesRegressor` in your browser.

> The HTML version includes an interactive Extra Trees Regression playground powered by @kanaries/ml. You can change the dataset, noise, and model controls; add observations; and inspect live predictions plus train and holdout metrics. The runnable guide and API reference continue below. [Open the HTML page](https://ml.kanaries.net/docs/apis/ensemble/extraTreesRegressor).

## Quick start example

```ts
import { Ensemble } from '@kanaries/ml';
const model = new Ensemble.ExtraTreesRegressor({ nEstimators: 100, max_features: 'all', randomState: 42 });
model.fit([[0], [1], [2], [3], [4]], [0, 1, 4, 9, 16]);
console.log(model.predict([[2.5]]), model.featureImportances);
```

## Detailed API reference

Options include `nEstimators?`, `bootstrap?`, `randomState?`, `max_features?`, and `ExtraTreeRegressor` depth/split options. Methods are `fit(X, y)` and `predict(X)`; `featureImportances` is available after fitting.
