Extra Tree Classifier
Train randomized ExtraTreeClassifier models in JavaScript and TypeScript with @kanaries/ml. Includes live tree playground, sklearn comparison, and API docs.
View as MarkdownAlgorithm overview
ExtraTreeClassifier injects additional split randomness to reduce variance and improve generalization in noisy settings.
This algorithm is especially useful when:
- Standard decision trees overfit your training set.
- You need fast tree-based classification with stronger randomization.
- You plan to combine trees in ensemble-style workflows.
JavaScript implementation
@kanaries/ml exposes Extra Tree classification in JavaScript for workflows that want tree-based decisions with more randomized splitting behavior. This is useful for experimentation and for teams that want a fast tree baseline with slightly different bias-variance behavior than a standard decision tree.
Because it runs in JS, you can compare deterministic and randomized tree variants directly inside the same product or service codebase.
Interactive Extra Tree playground
Extra Trees choose randomized candidate thresholds. Keep the data and parameters fixed, then use Reroll splits to see how that randomness changes the learned regions. The model below runs with Tree.ExtraTreeClassifier directly in your browser.
Learn ExtraTreeClassifier by changing it
Reroll randomized thresholds, then compare how depth changes the decision regions. Click the plot to add your own observation and refit instantly.
Tree.ExtraTreeClassifierQuick start
ExtraTreeClassifier in Python vs JavaScript / TypeScript
If you searched for "ExtraTreeClassifier in JavaScript" or "ExtraTreeClassifier in TypeScript", this section maps the familiar scikit-learn call to the equivalent @kanaries/ml usage for browser and Node.js runtimes.
from sklearn.tree import ExtraTreeClassifier
X = [[0, 0], [1, 1], [1, 0], [0, 1]]
y = [0, 1, 1, 0]
clf = ExtraTreeClassifier(max_depth=3, criterion='gini', random_state=0)
clf.fit(X, y)
pred = clf.predict([[0.9, 0.8], [0.1, 0.2]])import { Tree } from '@kanaries/ml';
const X = [[0, 0], [1, 1], [1, 0], [0, 1]];
const y = [0, 1, 1, 0];
const clf = new Tree.ExtraTreeClassifier({ max_depth: 3, criterion: 'gini' });
clf.fit(X, y);
const pred = clf.predict([[0.9, 0.8], [0.1, 0.2]]);Quick JavaScript example
import { Tree } from '@kanaries/ml';
const X = [[0, 0], [1, 1], [1, 0], [0, 1]];
const y = [0, 1, 1, 0];
const clf = new Tree.ExtraTreeClassifier({ max_depth: 3, criterion: 'gini' });
clf.fit(X, y);
const pred = clf.predict([[0.9, 0.8], [0.1, 0.2]]);
console.log(pred);Detailed API reference
interface ExtraTreeProps {
max_depth?: number;
min_samples_split?: number;
criterion?: 'entropy' | 'gini';
max_features?: number;
}
constructor(props: ExtraTreeProps = {})Implementation workflow
- Train with randomized split behavior on cleaned tabular inputs.
- Compare validation stability against DecisionTreeClassifier.
- Tune depth and split constraints based on overfit indicators.
JavaScript deployment notes
- Use Extra Tree classification when you want a randomized tree baseline for tabular data.
- Compare it against the standard decision tree because the better choice depends on variance and data noise.
- It is especially useful in experiments that later feed into larger tree ensembles.
Decision Tree Regressor
Fit decision tree regression models in JavaScript and TypeScript with @kanaries/ml. Includes interactive playground, split criteria, and full API reference.
Extra Tree Regressor
Fit randomized ExtraTreeRegressor models in JavaScript and TypeScript with @kanaries/ml. Includes live playground, quick start code, and API reference.