scikit-learn
scikit-learn β datasets, metrics, transforms and a train/predict model registry
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available Β· $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/scikit-learn/index.md to help me query scikit-learn with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Train a random forest and predict from SQL
Example output Β· captured
- Connector release
- v0.4.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SET VARIABLE iris_model = (SELECT model FROM sklearn.models.fit((SELECT * FROM sklearn.datasets.iris()), estimator := 'random_forest_classifier', target := 'target'));
SELECT sample_id, prediction FROM sklearn.models.predict((SELECT * FROM sklearn.datasets.iris()), model := getvariable('iris_model'), id := 'sample_id') LIMIT 5;
| sample_id | prediction |
|---|---|
| 0 | 0 |
| 1 | 0 |
| 2 | 0 |
| 3 | 0 |
| 4 | 0 |
Quick start
Choose where to run scikit-learn, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'sklearn' AS sklearn (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-sklearn'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'sklearn' AS sklearn (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-scikit-learn:0.4.0'
);
3. Run a query
SET VARIABLE iris_model = (SELECT model FROM sklearn.models.fit((SELECT * FROM sklearn.datasets.iris()), estimator := 'random_forest_classifier', target := 'target'));
SELECT sample_id, prediction FROM sklearn.models.predict((SELECT * FROM sklearn.datasets.iris()), model := getvariable('iris_model'), id := 'sample_id') LIMIT 5;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connectorβs deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'sklearn' AS sklearn
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SET VARIABLE iris_model = (SELECT model FROM sklearn.models.fit((SELECT * FROM sklearn.datasets.iris()), estimator := 'random_forest_classifier', target := 'target'));
SELECT sample_id, prediction FROM sklearn.models.predict((SELECT * FROM sklearn.datasets.iris()), model := getvariable('iris_model'), id := 'sample_id') LIMIT 5;
Query Farm operates scikit-learn for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use sklearn as the catalog alias for the query below.
4. Run a query
SET VARIABLE iris_model = (SELECT model FROM sklearn.models.fit((SELECT * FROM sklearn.datasets.iris()), estimator := 'random_forest_classifier', target := 'target'));
SELECT sample_id, prediction FROM sklearn.models.predict((SELECT * FROM sklearn.datasets.iris()), model := getvariable('iris_model'), id := 'sample_id') LIMIT 5;
Technical details
- Verified connector release
- v0.4.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until youβre ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'sklearn' AS sklearn (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-sklearn'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'sklearn' AS sklearn (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-scikit-learn:0.4.0'
);
Overview
scikit-learn datasets, metrics, transforms, and a train/predict model registry for DuckDB/SQL
Exposes scikit-learn to DuckDB/SQL as VGI functions:
- Datasets β toy datasets and generators (
iris,make_classification, ...) - Metrics β regression/classification/clustering scores as aggregates
- Transforms β scalers, encoders, decomposition (fit-transform + stored)
- Models β
fit/predict, typedfit_<estimator>, cross-validation, grid/randomized search, pipelines, and per-group modeling
Models and transformers are stored as reusable BLOBs in a registry.
Catalog
Everything sklearn exposes once attached β read straight from the worker's
released build.
datasets 6 tables Β· 5 functions
scikit-learn toy datasets and synthetic generators as table functions.
Schema examples (1)
Load the iris dataset
SELECT * FROM sklearn.datasets.iris() LIMIT 5;
breast_cancer
569 tumour samples with 30 cell-nucleus measurements and a benign/malignant label.
Class balance
SELECT target_name, count(*)
FROM sklearn.datasets.breast_cancer
GROUP BY target_name;
SELECT target_name, avg(mean_radius) AS mean_radius
FROM sklearn.datasets.breast_cancer()
GROUP BY target_name;
california_housing
20640 census block groups with 8 features and the median house value (regression).
Average value by latitude band
SELECT round(latitude) AS lat, round(avg(target), 2)
FROM sklearn.datasets.california_housing
GROUP BY lat
ORDER BY lat;
SELECT sample_id, medinc, target
FROM sklearn.datasets.california_housing()
WHERE target >= 5;
diabetes
442 patients with 10 baseline measurements and a one-year disease-progression score.
Target range
SELECT min(target), max(target), round(avg(target), 1)
FROM sklearn.datasets.diabetes;
SELECT sample_id, bmi, target
FROM sklearn.datasets.diabetes()
WHERE target > 250;
digits
1797 handwritten digits as 64 pixel-intensity features (8x8) plus the digit label.
Images per digit
SELECT target, count(*)
FROM sklearn.datasets.digits
GROUP BY target
ORDER BY target;
SELECT target, count(*) AS n_images
FROM sklearn.datasets.digits()
GROUP BY target
ORDER BY target;
iris
150 iris flowers with four sepal/petal measurements (cm) and their species.
Row count per species
SELECT target_name, count(*)
FROM sklearn.datasets.iris
GROUP BY target_name;
SELECT sample_id, petal_length_cm, target_name
FROM sklearn.datasets.iris()
WHERE petal_length_cm > 5;
SELECT target_name, avg(petal_length_cm)
FROM sklearn.datasets.iris()
GROUP BY target_name;
wine
178 wines with 13 chemical measurements and their cultivar of origin.
Average alcohol per cultivar
SELECT target_name, round(avg(alcohol), 2)
FROM sklearn.datasets.wine
GROUP BY target_name;
SELECT target_name, avg(alcohol) AS mean_alcohol
FROM sklearn.datasets.wine()
GROUP BY target_name;
make_blobs (centers := BIGINT, cluster_std := DOUBLE, n_features := BIGINT, n_samples := BIGINT, random_state := BIGINT)
Generate Gaussian blobs for clustering
300 points in 4 clusters
SELECT cluster, avg(feature_0) AS x, avg(feature_1) AS y
FROM sklearn.datasets.make_blobs(n_samples => 300, centers => 4)
GROUP BY cluster;
make_circles (n_samples := BIGINT, noise := DOUBLE, random_state := BIGINT)
Generate two concentric circles (2 features, binary)
200 points in two concentric rings
SELECT target,
avg(sqrt(feature_0 * feature_0 + feature_1 * feature_1)) AS mean_radius
FROM sklearn.datasets.make_circles(n_samples => 200, noise => 0.05)
GROUP BY target;
make_classification (n_classes := BIGINT, n_features := BIGINT, n_informative := BIGINT, n_samples := BIGINT, random_state := BIGINT)
Generate a synthetic classification dataset
500 rows, 5 features, 3 classes
SELECT target, count(*) AS n
FROM sklearn.datasets.make_classification(n_samples => 500, n_features => 5, n_classes => 3)
GROUP BY target;
make_moons (n_samples := BIGINT, noise := DOUBLE, random_state := BIGINT)
Generate two interleaving half-moons (2 features, binary)
200 points in a two-moon shape
SELECT target, count(*) AS n
FROM sklearn.datasets.make_moons(n_samples => 200, noise => 0.1)
GROUP BY target;
make_regression (n_features := BIGINT, n_informative := BIGINT, n_samples := BIGINT, noise := DOUBLE, random_state := BIGINT)
Generate a synthetic regression dataset
500 rows, 4 features, noisy target
SELECT corr(feature_0, target) AS r
FROM sklearn.datasets.make_regression(n_samples => 500, n_features => 4, noise => 5.0);
estimators 42 functions
Typed fit_
Schema examples (1)
Fit a logistic-regression classifier on iris
SELECT n_samples, n_features
FROM sklearn.estimators.fit_logistic_regression((SELECT * FROM sklearn.datasets.iris()), target := 'target');
fit_ada_boost_classifier (data TABLE, id := VARCHAR, learning_rate := DOUBLE, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a ada_boost_classifier with typed hyperparameters; returns/stores the model
Train a ada_boost_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_ada_boost_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_estimators := 50, learning_rate := 1.0);
fit_ada_boost_regressor (data TABLE, id := VARCHAR, learning_rate := DOUBLE, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a ada_boost_regressor with typed hyperparameters; returns/stores the model
Train a ada_boost_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_ada_boost_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', n_estimators := 50, learning_rate := 1.0);
fit_bagging_classifier (data TABLE, id := VARCHAR, max_features := DOUBLE, max_samples := DOUBLE, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a bagging_classifier with typed hyperparameters; returns/stores the model
Train a bagging_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_bagging_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_estimators := 10, max_samples := 1.0);
fit_bagging_regressor (data TABLE, id := VARCHAR, max_features := DOUBLE, max_samples := DOUBLE, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a bagging_regressor with typed hyperparameters; returns/stores the model
Train a bagging_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_bagging_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', n_estimators := 10, max_samples := 1.0);
fit_bayesian_ridge (data TABLE, alpha_1 := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, lambda_1 := DOUBLE, model_name := VARCHAR, target := VARCHAR)
Fit a bayesian_ridge with typed hyperparameters; returns/stores the model
Train a bayesian_ridge with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_bayesian_ridge((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', alpha_1 := 1e-06, lambda_1 := 1e-06);
fit_bernoulli_nb (data TABLE, alpha := DOUBLE, binarize := DOUBLE, fit_prior := BOOLEAN, id := VARCHAR, model_name := VARCHAR, target := VARCHAR)
Fit a bernoulli_nb with typed hyperparameters; returns/stores the model
Train a bernoulli_nb with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_bernoulli_nb((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', alpha := 1.0, binarize := 0.0);
fit_complement_nb (data TABLE, alpha := DOUBLE, fit_prior := BOOLEAN, id := VARCHAR, model_name := VARCHAR, norm := BOOLEAN, target := VARCHAR)
Fit a complement_nb with typed hyperparameters; returns/stores the model
Train a complement_nb with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_complement_nb((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', alpha := 1.0, norm := False);
fit_decision_tree_classifier (data TABLE, criterion := VARCHAR, id := VARCHAR, max_depth := BIGINT, min_samples_split := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a decision_tree_classifier with typed hyperparameters; returns/stores the model
Train a decision_tree_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_decision_tree_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', max_depth := 0, min_samples_split := 2);
fit_decision_tree_regressor (data TABLE, criterion := VARCHAR, id := VARCHAR, max_depth := BIGINT, min_samples_split := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a decision_tree_regressor with typed hyperparameters; returns/stores the model
Train a decision_tree_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_decision_tree_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', max_depth := 0, min_samples_split := 2);
fit_elastic_net (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, l1_ratio := DOUBLE, max_iter := BIGINT, model_name := VARCHAR, target := VARCHAR)
Fit a elastic_net with typed hyperparameters; returns/stores the model
Train a elastic_net with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_elastic_net((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', alpha := 1.0, l1_ratio := 0.5);
fit_extra_trees_classifier (data TABLE, id := VARCHAR, max_depth := BIGINT, max_features := VARCHAR, min_samples_split := BIGINT, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a extra_trees_classifier with typed hyperparameters; returns/stores the model
Train a extra_trees_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_extra_trees_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_estimators := 100, max_depth := 0);
fit_extra_trees_regressor (data TABLE, id := VARCHAR, max_depth := BIGINT, max_features := VARCHAR, min_samples_split := BIGINT, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a extra_trees_regressor with typed hyperparameters; returns/stores the model
Train a extra_trees_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_extra_trees_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', n_estimators := 100, max_depth := 0);
fit_gamma_regressor (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, target := VARCHAR)
Fit a gamma_regressor with typed hyperparameters; returns/stores the model
Train a gamma_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_gamma_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', alpha := 1.0, max_iter := 100);
fit_gaussian_nb (data TABLE, id := VARCHAR, model_name := VARCHAR, target := VARCHAR, var_smoothing := DOUBLE)
Fit a gaussian_nb with typed hyperparameters; returns/stores the model
Train a gaussian_nb with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_gaussian_nb((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', var_smoothing := 1e-09);
fit_gradient_boosting_classifier (data TABLE, id := VARCHAR, learning_rate := DOUBLE, max_depth := BIGINT, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, subsample := DOUBLE, target := VARCHAR)
Fit a gradient_boosting_classifier with typed hyperparameters; returns/stores the model
Train a gradient_boosting_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_gradient_boosting_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_estimators := 100, learning_rate := 0.1);
fit_gradient_boosting_regressor (data TABLE, id := VARCHAR, learning_rate := DOUBLE, max_depth := BIGINT, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, subsample := DOUBLE, target := VARCHAR)
Fit a gradient_boosting_regressor with typed hyperparameters; returns/stores the model
Train a gradient_boosting_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_gradient_boosting_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', n_estimators := 100, learning_rate := 0.1);
fit_hist_gradient_boosting_classifier (data TABLE, id := VARCHAR, l2_regularization := DOUBLE, learning_rate := DOUBLE, max_depth := BIGINT, max_iter := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a hist_gradient_boosting_classifier with typed hyperparameters; returns/stores the model
Train a hist_gradient_boosting_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_hist_gradient_boosting_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', max_iter := 100, learning_rate := 0.1);
fit_hist_gradient_boosting_regressor (data TABLE, id := VARCHAR, l2_regularization := DOUBLE, learning_rate := DOUBLE, max_depth := BIGINT, max_iter := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a hist_gradient_boosting_regressor with typed hyperparameters; returns/stores the model
Train a hist_gradient_boosting_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_hist_gradient_boosting_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', max_iter := 100, learning_rate := 0.1);
fit_huber_regressor (data TABLE, alpha := DOUBLE, epsilon := DOUBLE, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, target := VARCHAR)
Fit a huber_regressor with typed hyperparameters; returns/stores the model
Train a huber_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_huber_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', epsilon := 1.35, alpha := 0.0001);
fit_knn_classifier (data TABLE, id := VARCHAR, model_name := VARCHAR, n_neighbors := BIGINT, p := BIGINT, target := VARCHAR, weights := VARCHAR)
Fit a knn_classifier with typed hyperparameters; returns/stores the model
Train a knn_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_knn_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_neighbors := 5, weights := 'uniform');
fit_knn_regressor (data TABLE, id := VARCHAR, model_name := VARCHAR, n_neighbors := BIGINT, p := BIGINT, target := VARCHAR, weights := VARCHAR)
Fit a knn_regressor with typed hyperparameters; returns/stores the model
Train a knn_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_knn_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', n_neighbors := 5, weights := 'uniform');
fit_lasso (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, target := VARCHAR)
Fit a lasso with typed hyperparameters; returns/stores the model
Train a lasso with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_lasso((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', alpha := 1.0, max_iter := 1000);
fit_lda (data TABLE, id := VARCHAR, model_name := VARCHAR, solver := VARCHAR, target := VARCHAR, tol := DOUBLE)
Fit a lda with typed hyperparameters; returns/stores the model
Train a lda with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_lda((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', solver := 'svd', tol := 0.0001);
fit_linear_regression (data TABLE, fit_intercept := BOOLEAN, id := VARCHAR, model_name := VARCHAR, target := VARCHAR)
Fit a linear_regression with typed hyperparameters; returns/stores the model
Train a linear_regression with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_linear_regression((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', fit_intercept := True);
fit_linear_svc (data TABLE, C := DOUBLE, id := VARCHAR, loss := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a linear_svc with typed hyperparameters; returns/stores the model
Train a linear_svc with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_linear_svc((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', C := 1.0, loss := 'squared_hinge');
fit_linear_svr (data TABLE, C := DOUBLE, epsilon := DOUBLE, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a linear_svr with typed hyperparameters; returns/stores the model
Train a linear_svr with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_linear_svr((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', C := 1.0, epsilon := 0.0);
fit_logistic_regression (data TABLE, C := DOUBLE, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, penalty := VARCHAR, solver := VARCHAR, target := VARCHAR)
Fit a logistic_regression with typed hyperparameters; returns/stores the model
Train a logistic_regression with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_logistic_regression((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', C := 1.0, max_iter := 1000);
fit_mlp_classifier (data TABLE, alpha := DOUBLE, hidden_units := BIGINT, id := VARCHAR, learning_rate_init := DOUBLE, max_iter := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a mlp_classifier with typed hyperparameters; returns/stores the model
Train a mlp_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_mlp_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', hidden_units := 100, alpha := 0.0001);
fit_mlp_regressor (data TABLE, alpha := DOUBLE, hidden_units := BIGINT, id := VARCHAR, learning_rate_init := DOUBLE, max_iter := BIGINT, model_name := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a mlp_regressor with typed hyperparameters; returns/stores the model
Train a mlp_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_mlp_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', hidden_units := 100, alpha := 0.0001);
fit_multinomial_nb (data TABLE, alpha := DOUBLE, fit_prior := BOOLEAN, id := VARCHAR, model_name := VARCHAR, target := VARCHAR)
Fit a multinomial_nb with typed hyperparameters; returns/stores the model
Train a multinomial_nb with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_multinomial_nb((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', alpha := 1.0, fit_prior := True);
fit_poisson_regressor (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, target := VARCHAR)
Fit a poisson_regressor with typed hyperparameters; returns/stores the model
Train a poisson_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_poisson_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', alpha := 1.0, max_iter := 100);
fit_qda (data TABLE, id := VARCHAR, model_name := VARCHAR, reg_param := DOUBLE, target := VARCHAR, tol := DOUBLE)
Fit a qda with typed hyperparameters; returns/stores the model
Train a qda with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_qda((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', reg_param := 0.0, tol := 0.0001);
fit_quantile_regressor (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, model_name := VARCHAR, quantile := DOUBLE, target := VARCHAR)
Fit a quantile_regressor with typed hyperparameters; returns/stores the model
Train a quantile_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_quantile_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', quantile := 0.5, alpha := 1.0);
fit_random_forest_classifier (data TABLE, id := VARCHAR, max_depth := BIGINT, max_features := VARCHAR, min_samples_split := BIGINT, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a random_forest_classifier with typed hyperparameters; returns/stores the model
Train a random_forest_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_random_forest_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_estimators := 100, max_depth := 0);
fit_random_forest_regressor (data TABLE, id := VARCHAR, max_depth := BIGINT, max_features := VARCHAR, min_samples_split := BIGINT, model_name := VARCHAR, n_estimators := BIGINT, random_state := BIGINT, target := VARCHAR)
Fit a random_forest_regressor with typed hyperparameters; returns/stores the model
Train a random_forest_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_random_forest_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', n_estimators := 100, max_depth := 0);
fit_ridge (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, model_name := VARCHAR, solver := VARCHAR, target := VARCHAR)
Fit a ridge with typed hyperparameters; returns/stores the model
Train a ridge with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_ridge((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', alpha := 1.0, fit_intercept := True);
fit_ridge_classifier (data TABLE, alpha := DOUBLE, fit_intercept := BOOLEAN, id := VARCHAR, model_name := VARCHAR, solver := VARCHAR, target := VARCHAR)
Fit a ridge_classifier with typed hyperparameters; returns/stores the model
Train a ridge_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_ridge_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', alpha := 1.0, fit_intercept := True);
fit_sgd_classifier (data TABLE, alpha := DOUBLE, id := VARCHAR, loss := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, penalty := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a sgd_classifier with typed hyperparameters; returns/stores the model
Train a sgd_classifier with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_sgd_classifier((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', loss := 'hinge', alpha := 0.0001);
fit_sgd_regressor (data TABLE, alpha := DOUBLE, id := VARCHAR, loss := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, penalty := VARCHAR, random_state := BIGINT, target := VARCHAR)
Fit a sgd_regressor with typed hyperparameters; returns/stores the model
Train a sgd_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_sgd_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', loss := 'squared_error', alpha := 0.0001);
fit_svc (data TABLE, C := DOUBLE, degree := BIGINT, gamma := VARCHAR, id := VARCHAR, kernel := VARCHAR, model_name := VARCHAR, target := VARCHAR)
Fit a svc with typed hyperparameters; returns/stores the model
Train a svc with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_svc((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', C := 1.0, kernel := 'rbf');
fit_svr (data TABLE, C := DOUBLE, epsilon := DOUBLE, gamma := VARCHAR, id := VARCHAR, kernel := VARCHAR, model_name := VARCHAR, target := VARCHAR)
Fit a svr with typed hyperparameters; returns/stores the model
Train a svr with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_svr((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', C := 1.0, kernel := 'rbf');
fit_tweedie_regressor (data TABLE, alpha := DOUBLE, id := VARCHAR, max_iter := BIGINT, model_name := VARCHAR, power := DOUBLE, target := VARCHAR)
Fit a tweedie_regressor with typed hyperparameters; returns/stores the model
Train a tweedie_regressor with named hyperparameters
SELECT estimator, task, n_samples, n_features, train_score
FROM sklearn.estimators.fit_tweedie_regressor((SELECT * FROM sklearn.datasets.diabetes()), target := 'target', id := 'sample_id', power := 0.0, alpha := 1.0);
metrics 36 functions
Regression, classification, and clustering metrics as SQL aggregates.
Schema examples (3)
R^2 over inline (actual, predicted) pairs
SELECT sklearn.metrics.r2_score(actual, predicted)
FROM (VALUES (3.0, 2.5), (5.0, 5.1)) AS t(actual, predicted);
Confusion matrix of 5-fold out-of-fold logistic-regression predictions on iris: each prediction joined back to its true species, one row per (actual, predicted) species code with its count
SELECT actual, predicted, count
FROM sklearn.metrics.confusion_matrix((SELECT i.target AS species, p.prediction AS predicted_species FROM sklearn.models.cross_val_predict((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', id := 'sample_id') AS p JOIN sklearn.datasets.iris AS i USING (sample_id)), actual := 'species', predicted := 'predicted_species')
ORDER BY actual, predicted;
Silhouette score of a 3-cluster k-means on the iris measurements: the cluster labels joined back to the feature columns they were computed from (one row)
SELECT round(silhouette_score, 3) AS silhouette
FROM sklearn.metrics.silhouette_score((SELECT f.*, k.cluster FROM sklearn.preprocessing.kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id', n_clusters := 3) AS k JOIN (SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()) AS f USING (sample_id)), label := 'cluster', id := 'sample_id');
accuracy_score (y_true DOUBLE, y_pred DOUBLE)
Classification accuracy
accuracy_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.accuracy_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
adjusted_mutual_info_score (y_true DOUBLE, y_pred DOUBLE)
Adjusted mutual information between two clusterings
adjusted_mutual_info_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.adjusted_mutual_info_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
adjusted_rand_score (y_true DOUBLE, y_pred DOUBLE)
Adjusted Rand index between two clusterings
adjusted_rand_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.adjusted_rand_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
average_precision_score (y_true DOUBLE, y_pred DOUBLE)
Average precision (y_pred = score/probability)
average_precision_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.average_precision_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
balanced_accuracy_score (y_true DOUBLE, y_pred DOUBLE)
Balanced accuracy
balanced_accuracy_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.balanced_accuracy_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
brier_score_loss (y_true DOUBLE, y_pred DOUBLE)
Brier score loss (calibration of binary probabilities; y_pred = P(class 1))
brier_score_loss over inline (actual, predicted) pairs
SELECT sklearn.metrics.brier_score_loss(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
cohen_kappa_score (y_true DOUBLE, y_pred DOUBLE)
Cohen's kappa (inter-rater agreement)
cohen_kappa_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.cohen_kappa_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
completeness_score (y_true DOUBLE, y_pred DOUBLE)
Completeness of a clustering vs. ground truth
completeness_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.completeness_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
explained_variance_score (y_true DOUBLE, y_pred DOUBLE)
Explained variance regression score
explained_variance_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.explained_variance_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
f1_score (y_true DOUBLE, y_pred DOUBLE)
F1 score (macro-averaged for multiclass)
f1_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.f1_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
fowlkes_mallows_score (y_true DOUBLE, y_pred DOUBLE)
Fowlkes-Mallows index between two clusterings
fowlkes_mallows_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.fowlkes_mallows_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
hamming_loss (y_true DOUBLE, y_pred DOUBLE)
Hamming loss (fraction of labels predicted incorrectly)
hamming_loss over inline (actual, predicted) pairs
SELECT sklearn.metrics.hamming_loss(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
homogeneity_score (y_true DOUBLE, y_pred DOUBLE)
Homogeneity of a clustering vs. ground truth
homogeneity_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.homogeneity_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
jaccard_score (y_true DOUBLE, y_pred DOUBLE)
Jaccard similarity coefficient (macro-averaged for multiclass)
jaccard_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.jaccard_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
log_loss (y_true DOUBLE, y_pred DOUBLE)
Logistic / cross-entropy loss (y_pred = P(class 1))
log_loss over inline (actual, predicted) pairs
SELECT sklearn.metrics.log_loss(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
matthews_corrcoef (y_true DOUBLE, y_pred DOUBLE)
Matthews correlation coefficient
matthews_corrcoef over inline (actual, predicted) pairs
SELECT sklearn.metrics.matthews_corrcoef(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
max_error (y_true DOUBLE, y_pred DOUBLE)
Maximum residual error (regression)
max_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.max_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
mean_absolute_error (y_true DOUBLE, y_pred DOUBLE)
Mean absolute error (regression)
mean_absolute_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.mean_absolute_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
mean_absolute_percentage_error (y_true DOUBLE, y_pred DOUBLE)
Mean absolute percentage error (regression)
mean_absolute_percentage_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.mean_absolute_percentage_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
mean_pinball_loss (y_true DOUBLE, y_pred DOUBLE)
Mean pinball loss for the median quantile (regression)
mean_pinball_loss over inline (actual, predicted) pairs
SELECT sklearn.metrics.mean_pinball_loss(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
mean_squared_error (y_true DOUBLE, y_pred DOUBLE)
Mean squared error (regression)
mean_squared_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.mean_squared_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
mean_squared_log_error (y_true DOUBLE, y_pred DOUBLE)
Mean squared logarithmic error (regression; non-negative values)
mean_squared_log_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.mean_squared_log_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
median_absolute_error (y_true DOUBLE, y_pred DOUBLE)
Median absolute error (regression)
median_absolute_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.median_absolute_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
normalized_mutual_info_score (y_true DOUBLE, y_pred DOUBLE)
Normalized mutual information between two clusterings
normalized_mutual_info_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.normalized_mutual_info_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
precision_score (y_true DOUBLE, y_pred DOUBLE)
Precision (macro-averaged for multiclass)
precision_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.precision_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
r2_score (y_true DOUBLE, y_pred DOUBLE)
Coefficient of determination R^2 (regression)
r2_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.r2_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
recall_score (y_true DOUBLE, y_pred DOUBLE)
Recall (macro-averaged for multiclass)
recall_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.recall_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
roc_auc_score (y_true DOUBLE, y_pred DOUBLE)
Area under the ROC curve (y_pred = score/probability)
roc_auc_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.roc_auc_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
root_mean_squared_error (y_true DOUBLE, y_pred DOUBLE)
Root mean squared error (regression)
root_mean_squared_error over inline (actual, predicted) pairs
SELECT sklearn.metrics.root_mean_squared_error(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
v_measure_score (y_true DOUBLE, y_pred DOUBLE)
V-measure (harmonic mean of homogeneity and completeness)
v_measure_score over inline (actual, predicted) pairs
SELECT sklearn.metrics.v_measure_score(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
zero_one_loss (y_true DOUBLE, y_pred DOUBLE)
Zero-one classification loss (fraction of misclassifications)
zero_one_loss over inline (actual, predicted) pairs
SELECT sklearn.metrics.zero_one_loss(actual, predicted)
FROM (VALUES (1.0, 0.9), (0.0, 0.2), (1.0, 0.8), (0.0, 0.1)) AS t(actual, predicted);
calibration_curve (data TABLE, n_bins := BIGINT, y_score := VARCHAR, y_true := VARCHAR)
Reliability (calibration) curve: predicted vs. observed probability per bin
Calibration curve points
SELECT prob_pred, prob_true
FROM sklearn.metrics.calibration_curve((SELECT * FROM (VALUES (0, 0.1), (1, 0.9), (0, 0.2), (1, 0.8)) AS preds(y, p)), y_true := 'y', y_score := 'p', n_bins := 10)
ORDER BY prob_pred;
confusion_matrix (data TABLE, actual := VARCHAR, predicted := VARCHAR)
Confusion matrix in long format: (actual, predicted, count)
Long-format confusion matrix
SELECT actual, predicted, count
FROM sklearn.metrics.confusion_matrix((SELECT * FROM (VALUES (0, 0), (1, 1), (0, 1), (1, 0)) AS preds(y, yhat)), actual := 'y', predicted := 'yhat');
Confusion matrix of 5-fold out-of-fold logistic-regression predictions on iris: each prediction joined back to its true species, one row per (actual, predicted) species code with its count
SELECT actual, predicted, count
FROM sklearn.metrics.confusion_matrix((SELECT i.target AS species, p.prediction AS predicted_species FROM sklearn.models.cross_val_predict((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', id := 'sample_id') AS p JOIN sklearn.datasets.iris AS i USING (sample_id)), actual := 'species', predicted := 'predicted_species')
ORDER BY actual, predicted;
precision_recall_curve (data TABLE, y_score := VARCHAR, y_true := VARCHAR)
Precision-recall curve points (threshold, precision, recall) for a binary classifier
Precision-recall curve points
SELECT recall, precision
FROM sklearn.metrics.precision_recall_curve((SELECT * FROM (VALUES (0, 0.1), (1, 0.9), (0, 0.2), (1, 0.8)) AS preds(y, p)), y_true := 'y', y_score := 'p')
ORDER BY recall;
roc_curve (data TABLE, y_score := VARCHAR, y_true := VARCHAR)
ROC curve points (threshold, fpr, tpr) for a binary classifier
ROC curve points
SELECT fpr, tpr, threshold
FROM sklearn.metrics.roc_curve((SELECT * FROM (VALUES (0, 0.1), (1, 0.9), (0, 0.2), (1, 0.8)) AS preds(y, p)), y_true := 'y', y_score := 'p')
ORDER BY fpr;
silhouette_score (data TABLE, id := VARCHAR, label := VARCHAR)
Mean silhouette coefficient of a clustering (features + label column)
Silhouette score of a clustering
SELECT silhouette_score
FROM sklearn.metrics.silhouette_score((SELECT * FROM (VALUES (1, 0.1::DOUBLE, 0.2::DOUBLE, 0), (2, 0.2, 0.1, 0), (3, 5.0, 5.1, 1), (4, 5.1, 5.0, 1)) AS clustered(id, x1, x2, cluster)), label => 'cluster', id => 'id');
Silhouette score of a 3-cluster k-means on the iris measurements: the cluster labels joined back to the feature columns they were computed from (one row)
SELECT round(silhouette_score, 3) AS silhouette
FROM sklearn.metrics.silhouette_score((SELECT f.*, k.cluster FROM sklearn.preprocessing.kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id', n_clusters := 3) AS k JOIN (SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()) AS f USING (sample_id)), label := 'cluster', id := 'sample_id');
models 1 table Β· 19 functions
Train/predict model registry, cross-validation, inspection, and search.
Schema examples (2)
3-fold cross-validated accuracy on iris
SELECT fold, score
FROM sklearn.models.cross_val_score((SELECT * FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', cv := 3);
Confusion matrix of 5-fold out-of-fold logistic-regression predictions on iris: each prediction joined back to its true species, one row per (actual, predicted) species code with its count
SELECT actual, predicted, count
FROM sklearn.metrics.confusion_matrix((SELECT i.target AS species, p.prediction AS predicted_species FROM sklearn.models.cross_val_predict((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', id := 'sample_id') AS p JOIN sklearn.datasets.iris AS i USING (sample_id)), actual := 'species', predicted := 'predicted_species')
ORDER BY actual, predicted;
list_models
One row per model persisted in the registry, with its estimator, task, shape, and score.
How many models are saved
SELECT count(*) AS model_count FROM sklearn.models.list_models;
SELECT model_name, estimator, train_score
FROM sklearn.models.list_models()
ORDER BY created_at DESC;
predict_class_one (model BLOB, features ANY)
Score a row through a classifier BLOB; returns the class label as text
Predict each customer's class label with their group's classifier
SELECT sklearn.models.predict_class_one(m.m.model, {'tenure': c.tenure, 'spend': c.spend})
FROM customers c
JOIN models m USING (region);
predict_one (model BLOB, features ANY)
Score a row through a model BLOB; returns a numeric prediction
Score each customer with their group's regression model
SELECT sklearn.models.predict_one(m.m.model, {'tenure': c.tenure, 'spend': c.spend})
FROM customers c
JOIN models m USING (region);
predict_proba_one (model BLOB, features ANY)
Class probabilities for a row through a classifier BLOB (DOUBLE[])
Per-class probabilities from each customer's group classifier
SELECT sklearn.models.predict_proba_one(m.m.model, {'tenure': c.tenure, 'spend': c.spend})
FROM customers c
JOIN models m USING (region);
drop_model (model_name VARCHAR)
Delete a model from the registry
Delete a stored model
SELECT dropped FROM sklearn.models.drop_model('iris_rf');
model_info (model_name VARCHAR)
Describe a single stored model (one row, empty if absent)
Show one model's metadata
SELECT estimator, task, n_features, train_score
FROM sklearn.models.model_info('iris_rf');
fit_model (features ANY, target ANY, estimator VARCHAR, hyperparams VARCHAR)
Fit one model per group (aggregate); returns the model BLOB + diagnostics
-
modelBLOB
-
estimatorVARCHAR
-
taskVARCHAR
-
n_samplesBIGINT
-
n_featuresBIGINT
-
n_classesBIGINT
-
train_scoreDOUBLE
One churn model per region
SELECT region,
sklearn.models.fit_model({'tenure': tenure, 'spend': spend}, churned, 'gradient_boosting_classifier', '{}') AS m
FROM (VALUES ('east', 12, 30.0, 0), ('east', 3, 80.0, 1), ('west', 24, 20.0, 0), ('west', 1, 90.0, 1)) AS customers(region, tenure, spend, churned)
GROUP BY region;
cross_val_predict (data TABLE, cv := BIGINT, estimator := VARCHAR, id := VARCHAR, params := VARCHAR, target := VARCHAR)
Out-of-fold cross-validated predictions (no model is stored)
5-fold out-of-fold predictions on iris
SELECT sample_id, prediction
FROM sklearn.models.cross_val_predict((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator => 'logistic_regression', target => 'target', id => 'sample_id');
Confusion matrix of 5-fold out-of-fold logistic-regression predictions on iris: each prediction joined back to its true species, one row per (actual, predicted) species code with its count
SELECT actual, predicted, count
FROM sklearn.metrics.confusion_matrix((SELECT i.target AS species, p.prediction AS predicted_species FROM sklearn.models.cross_val_predict((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', id := 'sample_id') AS p JOIN sklearn.datasets.iris AS i USING (sample_id)), actual := 'species', predicted := 'predicted_species')
ORDER BY actual, predicted;
cross_val_score (data TABLE, cv := BIGINT, estimator := VARCHAR, id := VARCHAR, params := VARCHAR, scoring := VARCHAR, target := VARCHAR)
Cross-validated held-out scores, one row per fold (no model is stored)
5-fold accuracy of a logistic regression on iris
SELECT fold, score
FROM sklearn.models.cross_val_score((SELECT sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator => 'logistic_regression', target => 'target');
fit (data TABLE, estimator := VARCHAR, id := VARCHAR, model_name := VARCHAR, params := VARCHAR, target := VARCHAR)
Fit a supervised estimator and store it in the model registry
Train a random forest on iris and store it as 'iris_rf'
SELECT model_name, estimator, n_samples, train_score
FROM sklearn.models.fit((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), model_name => 'iris_rf', estimator => 'random_forest_classifier', target => 'target', id => 'sample_id');
fit_pipeline (data TABLE, estimator := VARCHAR, id := VARCHAR, model_name := VARCHAR, params := VARCHAR, steps := VARCHAR, target := VARCHAR)
Fit preprocessing steps + an estimator as one model; predict with the usual 'predict'
Scale -> PCA -> logistic regression, stored as one model
SELECT model_name, estimator, n_features
FROM sklearn.models.fit_pipeline((SELECT * FROM sklearn.datasets.iris()), steps := '[{"kind": "standard_scaler"}, {"kind": "pca", "params": {"n_components": 3}}]', estimator := 'logistic_regression', target := 'target', id := 'sample_id', model_name := 'iris_pipe');
grid_search (data TABLE, cv := BIGINT, estimator := UNION of 42 branches, id := VARCHAR, model_name := VARCHAR, scoring := VARCHAR, target := VARCHAR)
Cross-validated grid search over an estimator's hyperparameters
union_value(<branch> := β¦)
-
logistic_regression C Β· max_iter Β· penalty Β· solver STRUCT
-
random_forest_classifier n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
random_forest_regressor n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
gradient_boosting_classifier n_estimators Β· learning_rate Β· max_depth Β· subsample Β· random_state STRUCT
-
gradient_boosting_regressor n_estimators Β· learning_rate Β· max_depth Β· subsample Β· random_state STRUCT
-
hist_gradient_boosting_classifier max_iter Β· learning_rate Β· max_depth Β· l2_regularization Β· random_state STRUCT
-
hist_gradient_boosting_regressor max_iter Β· learning_rate Β· max_depth Β· l2_regularization Β· random_state STRUCT
-
linear_regression fit_intercept STRUCT
-
ridge alpha Β· fit_intercept Β· solver STRUCT
-
lasso alpha Β· max_iter Β· fit_intercept STRUCT
-
svc C Β· kernel Β· gamma Β· degree STRUCT
-
svr C Β· kernel Β· gamma Β· epsilon STRUCT
-
knn_classifier n_neighbors Β· weights Β· p STRUCT
-
knn_regressor n_neighbors Β· weights Β· p STRUCT
-
decision_tree_classifier max_depth Β· min_samples_split Β· criterion Β· random_state STRUCT
-
decision_tree_regressor max_depth Β· min_samples_split Β· criterion Β· random_state STRUCT
-
mlp_classifier hidden_units Β· alpha Β· max_iter Β· learning_rate_init Β· random_state STRUCT
-
mlp_regressor hidden_units Β· alpha Β· max_iter Β· learning_rate_init Β· random_state STRUCT
-
gaussian_nb var_smoothing STRUCT
-
sgd_classifier loss Β· alpha Β· penalty Β· max_iter Β· random_state STRUCT
-
ridge_classifier alpha Β· fit_intercept Β· solver STRUCT
-
extra_trees_classifier n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
extra_trees_regressor n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
ada_boost_classifier n_estimators Β· learning_rate Β· random_state STRUCT
-
ada_boost_regressor n_estimators Β· learning_rate Β· random_state STRUCT
-
bagging_classifier n_estimators Β· max_samples Β· max_features Β· random_state STRUCT
-
bagging_regressor n_estimators Β· max_samples Β· max_features Β· random_state STRUCT
-
linear_svc C Β· loss Β· max_iter Β· random_state STRUCT
-
multinomial_nb alpha Β· fit_prior STRUCT
-
bernoulli_nb alpha Β· binarize Β· fit_prior STRUCT
-
complement_nb alpha Β· norm Β· fit_prior STRUCT
-
lda solver Β· tol STRUCT
-
qda reg_param Β· tol STRUCT
-
elastic_net alpha Β· l1_ratio Β· max_iter Β· fit_intercept STRUCT
-
sgd_regressor loss Β· alpha Β· penalty Β· max_iter Β· random_state STRUCT
-
linear_svr C Β· epsilon Β· max_iter Β· random_state STRUCT
-
poisson_regressor alpha Β· max_iter Β· fit_intercept STRUCT
-
gamma_regressor alpha Β· max_iter Β· fit_intercept STRUCT
-
tweedie_regressor power Β· alpha Β· max_iter STRUCT
-
bayesian_ridge alpha_1 Β· lambda_1 Β· fit_intercept STRUCT
-
huber_regressor epsilon Β· alpha Β· max_iter STRUCT
-
quantile_regressor quantile Β· alpha Β· fit_intercept STRUCT
Grid-search a random forest on iris
SELECT params, mean_test_score, rank
FROM sklearn.models.grid_search((SELECT * FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', estimator := union_value(random_forest_classifier := {'n_estimators': [100, 300], 'max_depth': [3, 5]}))
ORDER BY rank;
group_kfold (data TABLE, group_col := VARCHAR, id := VARCHAR, n_splits := BIGINT)
K-fold that keeps all rows of a group in the same fold (id, fold)
Group-aware 3-fold (no group spans folds)
SELECT sample_id, fold
FROM sklearn.models.group_kfold((SELECT sample_id, target AS grp FROM sklearn.datasets.iris()), id := 'sample_id', group_col := 'grp', n_splits := 3);
kfold (data TABLE, id := VARCHAR, n_splits := BIGINT, random_state := BIGINT, shuffle := BOOLEAN)
Assign each row a K-fold test fold (id, fold)
Rows per fold in a 5-fold split of iris
SELECT fold, count(*) AS n_rows
FROM sklearn.models.kfold((SELECT sample_id FROM sklearn.datasets.iris()), id := 'sample_id', n_splits := 5)
GROUP BY fold;
partial_dependence (data TABLE, feature := VARCHAR, grid_resolution := BIGINT, model := BLOB, model_name := VARCHAR)
How a stored model's average prediction changes as one feature varies over a grid
Partial dependence of 'iris_rf' on petal length
SELECT feature_value, class, partial_dependence
FROM sklearn.models.partial_dependence((SELECT * FROM sklearn.datasets.iris()), model_name := 'iris_rf', feature := 'petal_length_cm')
ORDER BY feature_value;
permutation_importance (data TABLE, model := BLOB, model_name := VARCHAR, n_repeats := BIGINT, random_state := BIGINT, scoring := VARCHAR, target := VARCHAR)
Model-agnostic feature importance: the drop in score when each feature is shuffled
Rank iris features by permutation importance for the stored 'iris_rf' model
SELECT feature, importance_mean
FROM sklearn.models.permutation_importance((SELECT * FROM sklearn.datasets.iris()), model_name := 'iris_rf', target := 'target')
ORDER BY importance_mean DESC;
predict (data TABLE, id := VARCHAR, model := BLOB, model_name := VARCHAR, with_proba := BOOLEAN)
Score a table through a stored model, emitting predictions
Predict with the stored 'iris_rf' model
SELECT sample_id, prediction
FROM sklearn.models.predict((SELECT * FROM sklearn.datasets.iris()), model_name := 'iris_rf', id := 'sample_id');
randomized_search (data TABLE, cv := BIGINT, estimator := UNION of 42 branches, id := VARCHAR, model_name := VARCHAR, n_iter := BIGINT, random_state := BIGINT, scoring := VARCHAR, target := VARCHAR)
Cross-validated randomized search: sample n_iter hyperparameter combinations
union_value(<branch> := β¦)
-
logistic_regression C Β· max_iter Β· penalty Β· solver STRUCT
-
random_forest_classifier n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
random_forest_regressor n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
gradient_boosting_classifier n_estimators Β· learning_rate Β· max_depth Β· subsample Β· random_state STRUCT
-
gradient_boosting_regressor n_estimators Β· learning_rate Β· max_depth Β· subsample Β· random_state STRUCT
-
hist_gradient_boosting_classifier max_iter Β· learning_rate Β· max_depth Β· l2_regularization Β· random_state STRUCT
-
hist_gradient_boosting_regressor max_iter Β· learning_rate Β· max_depth Β· l2_regularization Β· random_state STRUCT
-
linear_regression fit_intercept STRUCT
-
ridge alpha Β· fit_intercept Β· solver STRUCT
-
lasso alpha Β· max_iter Β· fit_intercept STRUCT
-
svc C Β· kernel Β· gamma Β· degree STRUCT
-
svr C Β· kernel Β· gamma Β· epsilon STRUCT
-
knn_classifier n_neighbors Β· weights Β· p STRUCT
-
knn_regressor n_neighbors Β· weights Β· p STRUCT
-
decision_tree_classifier max_depth Β· min_samples_split Β· criterion Β· random_state STRUCT
-
decision_tree_regressor max_depth Β· min_samples_split Β· criterion Β· random_state STRUCT
-
mlp_classifier hidden_units Β· alpha Β· max_iter Β· learning_rate_init Β· random_state STRUCT
-
mlp_regressor hidden_units Β· alpha Β· max_iter Β· learning_rate_init Β· random_state STRUCT
-
gaussian_nb var_smoothing STRUCT
-
sgd_classifier loss Β· alpha Β· penalty Β· max_iter Β· random_state STRUCT
-
ridge_classifier alpha Β· fit_intercept Β· solver STRUCT
-
extra_trees_classifier n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
extra_trees_regressor n_estimators Β· max_depth Β· min_samples_split Β· max_features Β· random_state STRUCT
-
ada_boost_classifier n_estimators Β· learning_rate Β· random_state STRUCT
-
ada_boost_regressor n_estimators Β· learning_rate Β· random_state STRUCT
-
bagging_classifier n_estimators Β· max_samples Β· max_features Β· random_state STRUCT
-
bagging_regressor n_estimators Β· max_samples Β· max_features Β· random_state STRUCT
-
linear_svc C Β· loss Β· max_iter Β· random_state STRUCT
-
multinomial_nb alpha Β· fit_prior STRUCT
-
bernoulli_nb alpha Β· binarize Β· fit_prior STRUCT
-
complement_nb alpha Β· norm Β· fit_prior STRUCT
-
lda solver Β· tol STRUCT
-
qda reg_param Β· tol STRUCT
-
elastic_net alpha Β· l1_ratio Β· max_iter Β· fit_intercept STRUCT
-
sgd_regressor loss Β· alpha Β· penalty Β· max_iter Β· random_state STRUCT
-
linear_svr C Β· epsilon Β· max_iter Β· random_state STRUCT
-
poisson_regressor alpha Β· max_iter Β· fit_intercept STRUCT
-
gamma_regressor alpha Β· max_iter Β· fit_intercept STRUCT
-
tweedie_regressor power Β· alpha Β· max_iter STRUCT
-
bayesian_ridge alpha_1 Β· lambda_1 Β· fit_intercept STRUCT
-
huber_regressor epsilon Β· alpha Β· max_iter STRUCT
-
quantile_regressor quantile Β· alpha Β· fit_intercept STRUCT
Randomized-search a random forest on iris
SELECT params, mean_test_score, rank
FROM sklearn.models.randomized_search((SELECT * FROM sklearn.datasets.iris()), target := 'target', id := 'sample_id', n_iter := 4, estimator := union_value(random_forest_classifier := {'n_estimators': [100, 200, 300], 'max_depth': [3, 5, 8]}))
ORDER BY rank;
stratified_kfold (data TABLE, id := VARCHAR, label := VARCHAR, n_splits := BIGINT, random_state := BIGINT, shuffle := BOOLEAN)
K-fold that preserves each class's proportion per fold (id, fold)
Class-balanced 5-fold for iris
SELECT sample_id, fold
FROM sklearn.models.stratified_kfold((SELECT sample_id, target FROM sklearn.datasets.iris()), id := 'sample_id', label := 'target', n_splits := 5);
timeseries_split (data TABLE, id := VARCHAR, n_splits := BIGINT)
Expanding-window splits for ordered data: (split, id, role) in {train, test}
Forward-chaining train/test splits over ordered rows
SELECT split, role, count(*) AS n_rows
FROM sklearn.models.timeseries_split((SELECT sample_id FROM sklearn.datasets.iris() ORDER BY sample_id), id := 'sample_id', n_splits := 5)
GROUP BY split, role
ORDER BY split, role;
preprocessing 1 table Β· 40 functions
Transforms, encoders, decomposition, clustering, and stored transformers.
Schema examples (3)
Standard-scale the iris features
SELECT *
FROM sklearn.preprocessing.standard_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id')
LIMIT 5;
Standardize the iris measurements, project them onto 2 principal components, and average each component per species (the first component separates the species)
SELECT i.target_name, round(avg(p.component_1), 2) AS mean_pc1,
round(avg(p.component_2), 2) AS mean_pc2
FROM sklearn.preprocessing.pca((SELECT * FROM sklearn.preprocessing.standard_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id')), id := 'sample_id', n_components := 2) AS p
JOIN sklearn.datasets.iris AS i USING (sample_id)
GROUP BY i.target_name
ORDER BY mean_pc1;
Score 3-cluster k-means on the iris measurements against the true species: adjusted Rand index, homogeneity, and completeness of the clusters (one row)
SELECT round(sklearn.metrics.adjusted_rand_score(i.target, k.cluster), 3) AS adjusted_rand,
round(sklearn.metrics.homogeneity_score(i.target, k.cluster), 3) AS homogeneity,
round(sklearn.metrics.completeness_score(i.target, k.cluster), 3) AS completeness
FROM sklearn.preprocessing.kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id', n_clusters := 3) AS k
JOIN sklearn.datasets.iris AS i USING (sample_id);
list_transformers
One row per fitted transformer persisted in the registry, with its kind and shape.
How many transformers are saved
SELECT count(*) AS transformer_count
FROM sklearn.preprocessing.list_transformers;
SELECT transformer_name, kind, n_output
FROM sklearn.preprocessing.list_transformers();
drop_transformer (transformer_name VARCHAR)
Delete a transformer from the registry
Delete a stored transformer
SELECT dropped FROM sklearn.preprocessing.drop_transformer('sc');
agglomerative_clustering (data TABLE, id := VARCHAR, linkage := VARCHAR, n_clusters := BIGINT)
Hierarchical (agglomerative) clustering; emits a cluster label per row
Apply agglomerative_clustering to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.agglomerative_clustering((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_clusters => 3)
GROUP BY cluster
ORDER BY cluster;
apply_transform (data TABLE, id := VARCHAR, transformer := BLOB, transformer_name := VARCHAR)
Stream a table through a stored, already-fitted transformer
Apply the stored 'sc' transformer to new data
SELECT sample_id, sepal_length_cm, sepal_width_cm
FROM sklearn.preprocessing.apply_transform((SELECT * FROM sklearn.datasets.iris()), transformer_name := 'sc', id := 'sample_id');
binarizer (data TABLE, id := VARCHAR, threshold := DOUBLE)
Threshold features to 0/1
Apply binarizer to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.binarizer((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', threshold => 0.0);
birch (data TABLE, id := VARCHAR, n_clusters := BIGINT, threshold := DOUBLE)
BIRCH clustering (memory-efficient for large datasets)
Apply birch to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.birch((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_clusters => 3)
GROUP BY cluster
ORDER BY cluster;
count_vectorizer (data TABLE, id := VARCHAR, lowercase := BOOLEAN, max_df := DOUBLE, max_features := BIGINT, min_df := BIGINT, ngram_max := BIGINT, stop_words := VARCHAR, text := VARCHAR)
Tokenize a text column into a document-term count matrix (long format)
Corpus-wide term counts
SELECT term, sum(value) AS n
FROM sklearn.preprocessing.count_vectorizer((SELECT * FROM (VALUES (1, 'the cat sat on the mat'), (2, 'a quick brown dog')) AS docs(id, body)), id := 'id', text := 'body')
GROUP BY term
ORDER BY n DESC, term;
dbscan (data TABLE, eps := DOUBLE, id := VARCHAR, min_samples := BIGINT)
DBSCAN density clustering; emits a cluster label per row (-1 = noise)
Apply dbscan to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.dbscan((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', eps => 0.5)
GROUP BY cluster
ORDER BY cluster;
elliptic_envelope (data TABLE, contamination := DOUBLE, id := VARCHAR, random_state := BIGINT)
Elliptic Envelope (Gaussian) outlier detection; emits an anomaly score and flag per row
Apply elliptic_envelope to the iris features
SELECT sample_id, anomaly_score
FROM sklearn.preprocessing.elliptic_envelope((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', contamination => 0.1)
WHERE is_outlier = 1
ORDER BY anomaly_score DESC;
fit_transformer (data TABLE, id := VARCHAR, kind := VARCHAR, params := VARCHAR, transformer_name := VARCHAR)
Fit a transformer (scaler/PCA/imputer/...) and return it as a BLOB; persist if named
Fit a StandardScaler and store it as 'sc'
SELECT transformer_name, kind, n_output
FROM sklearn.preprocessing.fit_transformer((SELECT sepal_length_cm, sepal_width_cm FROM sklearn.datasets.iris()), transformer_name := 'sc', kind := 'standard_scaler');
gaussian_mixture (data TABLE, covariance_type := VARCHAR, id := VARCHAR, n_components := BIGINT, random_state := BIGINT)
Gaussian mixture model clustering; emits the most likely component per row
Apply gaussian_mixture to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.gaussian_mixture((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 3)
GROUP BY cluster
ORDER BY cluster;
isolation_forest (data TABLE, contamination := DOUBLE, id := VARCHAR, random_state := BIGINT)
Isolation Forest outlier detection; emits an anomaly score and flag per row
Apply isolation_forest to the iris features
SELECT sample_id, anomaly_score
FROM sklearn.preprocessing.isolation_forest((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', contamination => 0.1)
WHERE is_outlier = 1
ORDER BY anomaly_score DESC;
isomap (data TABLE, id := VARCHAR, n_components := BIGINT, n_neighbors := BIGINT)
Isomap non-linear embedding (geodesic distance preservation)
Apply isomap to the iris features
SELECT sample_id, component_1, component_2
FROM sklearn.preprocessing.isomap((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 2);
kbins_discretizer (data TABLE, id := VARCHAR, n_bins := BIGINT, strategy := VARCHAR)
Discretize continuous features into integer bins (one bin index column per feature)
Apply kbins_discretizer to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.kbins_discretizer((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_bins => 5);
kmeans (data TABLE, id := VARCHAR, n_clusters := BIGINT, random_state := BIGINT)
K-Means clustering; emits a cluster label per row
Apply kmeans to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_clusters => 3)
GROUP BY cluster
ORDER BY cluster;
Score 3-cluster k-means on the iris measurements against the true species: adjusted Rand index, homogeneity, and completeness of the clusters (one row)
SELECT round(sklearn.metrics.adjusted_rand_score(i.target, k.cluster), 3) AS adjusted_rand,
round(sklearn.metrics.homogeneity_score(i.target, k.cluster), 3) AS homogeneity,
round(sklearn.metrics.completeness_score(i.target, k.cluster), 3) AS completeness
FROM sklearn.preprocessing.kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id', n_clusters := 3) AS k
JOIN sklearn.datasets.iris AS i USING (sample_id);
local_outlier_factor (data TABLE, contamination := DOUBLE, id := VARCHAR, n_neighbors := BIGINT)
Local Outlier Factor; emits an anomaly score and flag per row
Apply local_outlier_factor to the iris features
SELECT sample_id, anomaly_score
FROM sklearn.preprocessing.local_outlier_factor((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_neighbors => 20)
WHERE is_outlier = 1
ORDER BY anomaly_score DESC;
maxabs_scaler (data TABLE, id := VARCHAR)
Scale each feature by its maximum absolute value (to [-1, 1])
Apply maxabs_scaler to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.maxabs_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id');
mds (data TABLE, id := VARCHAR, n_components := BIGINT, random_state := BIGINT)
Multidimensional scaling embedding (distance preservation)
Apply mds to the iris features
SELECT sample_id, component_1, component_2
FROM sklearn.preprocessing.mds((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 2);
mean_shift (data TABLE, bandwidth := DOUBLE, id := VARCHAR)
Mean-shift clustering (auto-discovers the number of clusters)
Apply mean_shift to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.mean_shift((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id')
GROUP BY cluster
ORDER BY cluster;
minibatch_kmeans (data TABLE, id := VARCHAR, n_clusters := BIGINT, random_state := BIGINT)
Mini-batch K-Means clustering (faster on large datasets)
Apply minibatch_kmeans to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.minibatch_kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_clusters => 3)
GROUP BY cluster
ORDER BY cluster;
minmax_scaler (data TABLE, id := VARCHAR)
Scale features to the [0, 1] range
Apply minmax_scaler to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.minmax_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id');
normalizer (data TABLE, id := VARCHAR, norm := VARCHAR)
Scale each sample (row) to unit norm
Apply normalizer to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.normalizer((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', norm => 'l2');
one_class_svm (data TABLE, gamma := VARCHAR, id := VARCHAR, kernel := VARCHAR, nu := DOUBLE)
One-Class SVM novelty/outlier detection; emits an anomaly score and flag per row
Apply one_class_svm to the iris features
SELECT sample_id, anomaly_score
FROM sklearn.preprocessing.one_class_svm((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', nu => 0.1)
WHERE is_outlier = 1
ORDER BY anomaly_score DESC;
one_hot_encoder (data TABLE, id := VARCHAR)
One-hot encode categorical (string) columns in long format (id, feature, category, value)
One-hot encode the iris species name (one row per active category)
SELECT category, count(*) AS n
FROM sklearn.preprocessing.one_hot_encoder((SELECT sample_id, target_name FROM sklearn.datasets.iris()), id => 'sample_id')
GROUP BY category;
optics (data TABLE, id := VARCHAR, min_samples := BIGINT)
OPTICS density clustering; emits a cluster label per row (-1 = noise)
Apply optics to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.optics((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', min_samples => 5)
GROUP BY cluster
ORDER BY cluster;
ordinal_encoder (data TABLE, id := VARCHAR)
Encode each categorical (string) column as integer codes (one column per feature)
Encode the iris species name as an integer code
SELECT sample_id, target_name AS species_code
FROM sklearn.preprocessing.ordinal_encoder((SELECT sample_id, target_name FROM sklearn.datasets.iris()), id => 'sample_id');
pca (data TABLE, id := VARCHAR, n_components := BIGINT)
Principal component analysis (linear dimensionality reduction)
Apply pca to the iris features
SELECT sample_id, component_1, component_2
FROM sklearn.preprocessing.pca((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 2);
Standardize the iris measurements, project them onto 2 principal components, and average each component per species (the first component separates the species)
SELECT i.target_name, round(avg(p.component_1), 2) AS mean_pc1,
round(avg(p.component_2), 2) AS mean_pc2
FROM sklearn.preprocessing.pca((SELECT * FROM sklearn.preprocessing.standard_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id')), id := 'sample_id', n_components := 2) AS p
JOIN sklearn.datasets.iris AS i USING (sample_id)
GROUP BY i.target_name
ORDER BY mean_pc1;
polynomial_features (data TABLE, degree := BIGINT, id := VARCHAR, include_bias := BOOLEAN, interaction_only := BOOLEAN)
Expand features into polynomial and interaction terms (e.g. a, b -> a, b, a^2, a*b, b^2)
Apply polynomial_features to the iris features
SELECT sample_id, sepal_length_cm_pow2, sepal_length_cm_x_sepal_width_cm
FROM sklearn.preprocessing.polynomial_features((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', degree => 2);
power_transformer (data TABLE, id := VARCHAR, method := VARCHAR)
Make features more Gaussian via a power transform (Yeo-Johnson / Box-Cox)
Apply power_transformer to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.power_transformer((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', method => 'yeo-johnson');
quantile_transformer (data TABLE, id := VARCHAR, n_quantiles := BIGINT, output_distribution := VARCHAR)
Map features to a uniform or normal distribution via quantiles (robust to outliers)
Apply quantile_transformer to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.quantile_transformer((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', output_distribution => 'normal');
robust_scaler (data TABLE, id := VARCHAR)
Scale features using statistics robust to outliers (median/IQR)
Apply robust_scaler to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.robust_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id');
select_k_best (data TABLE, id := VARCHAR, k := BIGINT, score_func := VARCHAR, target := VARCHAR)
Univariate feature scores vs. the target, flagging the top k
Rank iris features by ANOVA F against the species label
SELECT feature, score, selected
FROM sklearn.preprocessing.select_k_best((SELECT sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), target := 'target', k := 2)
ORDER BY score DESC;
simple_imputer (data TABLE, id := VARCHAR, strategy := VARCHAR)
Fill missing (NULL/NaN) feature values using a column statistic
Apply simple_imputer to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.simple_imputer((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', strategy => 'median');
spectral_clustering (data TABLE, id := VARCHAR, n_clusters := BIGINT, random_state := BIGINT)
Spectral clustering on the affinity graph; emits a cluster label per row
Apply spectral_clustering to the iris features
SELECT cluster, count(*) AS n_samples
FROM sklearn.preprocessing.spectral_clustering((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_clusters => 3)
GROUP BY cluster
ORDER BY cluster;
spectral_embedding (data TABLE, id := VARCHAR, n_components := BIGINT, random_state := BIGINT)
Spectral (Laplacian eigenmaps) non-linear embedding
Apply spectral_embedding to the iris features
SELECT sample_id, component_1, component_2
FROM sklearn.preprocessing.spectral_embedding((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 2);
standard_scaler (data TABLE, id := VARCHAR)
Standardize features to zero mean and unit variance
Apply standard_scaler to the iris features
SELECT sample_id, sepal_length_cm, petal_length_cm
FROM sklearn.preprocessing.standard_scaler((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id');
target_encoder (data TABLE, id := VARCHAR, target := VARCHAR)
Encode each categorical column by its (cross-fitted) mean target value
Encode the species name by its rate of a binary is-setosa target
SELECT sample_id, target_name AS setosa_rate
FROM sklearn.preprocessing.target_encoder((SELECT sample_id, target_name, (target = 0)::INTEGER AS is_setosa FROM sklearn.datasets.iris()), id := 'sample_id', target := 'is_setosa');
tfidf_vectorizer (data TABLE, id := VARCHAR, lowercase := BOOLEAN, max_df := DOUBLE, max_features := BIGINT, min_df := BIGINT, ngram_max := BIGINT, stop_words := VARCHAR, text := VARCHAR)
Tokenize a text column into a TF-IDF document-term matrix (long format)
Heavily weighted TF-IDF terms per document
SELECT id, term, value
FROM sklearn.preprocessing.tfidf_vectorizer((SELECT * FROM (VALUES (1, 'the cat sat on the mat'), (2, 'a quick brown dog')) AS docs(id, body)), id := 'id', text := 'body')
WHERE value > 0.3;
truncated_svd (data TABLE, id := VARCHAR, n_components := BIGINT)
Truncated SVD (LSA) dimensionality reduction
Apply truncated_svd to the iris features
SELECT sample_id, component_1, component_2
FROM sklearn.preprocessing.truncated_svd((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 2);
tsne (data TABLE, id := VARCHAR, n_components := BIGINT, perplexity := DOUBLE, random_state := BIGINT)
t-SNE non-linear embedding (great for 2-D visualization)
Apply tsne to the iris features
SELECT sample_id, component_1, component_2
FROM sklearn.preprocessing.tsne((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id => 'sample_id', n_components => 2);
variance_threshold (data TABLE, id := VARCHAR, threshold := DOUBLE)
Per-feature variance, flagging features above a threshold (unsupervised filter)
Flag iris features whose variance exceeds 0.5
SELECT feature, variance, selected
FROM sklearn.preprocessing.variance_threshold((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id', threshold := 0.5)
ORDER BY variance DESC;
Try these queries
Load the built-in iris dataset.
SELECT * FROM sklearn.datasets.iris() LIMIT 5;
Coefficient of determination over inline (actual, predicted) pairs.
SELECT sklearn.metrics.r2_score(actual, predicted)
FROM (VALUES (3.0, 2.5), (5.0, 5.1), (7.0, 6.8)) AS t(actual, predicted);
Uses r2_score
Reduce iris to two principal components (fit-transform).
SELECT *
FROM sklearn.preprocessing.pca((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), n_components := 2, id := 'sample_id')
LIMIT 5;
Uses pca
Three-fold cross-validated accuracy of a logistic-regression classifier on iris.
SELECT fold, score
FROM sklearn.models.cross_val_score((SELECT * FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', cv := 3);
Uses cross_val_score
Confusion matrix of 5-fold out-of-fold logistic-regression predictions on iris: each prediction joined back to its true species, one row per (actual, predicted) species code with its count
SELECT actual, predicted, count
FROM sklearn.metrics.confusion_matrix((SELECT i.target AS species, p.prediction AS predicted_species FROM sklearn.models.cross_val_predict((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm, target FROM sklearn.datasets.iris()), estimator := 'logistic_regression', target := 'target', id := 'sample_id') AS p JOIN sklearn.datasets.iris AS i USING (sample_id)), actual := 'species', predicted := 'predicted_species')
ORDER BY actual, predicted;
Score 3-cluster k-means on the iris measurements against the true species: adjusted Rand index, homogeneity, and completeness of the clusters (one row)
SELECT round(sklearn.metrics.adjusted_rand_score(i.target, k.cluster), 3) AS adjusted_rand,
round(sklearn.metrics.homogeneity_score(i.target, k.cluster), 3) AS homogeneity,
round(sklearn.metrics.completeness_score(i.target, k.cluster), 3) AS completeness
FROM sklearn.preprocessing.kmeans((SELECT sample_id, sepal_length_cm, sepal_width_cm, petal_length_cm, petal_width_cm FROM sklearn.datasets.iris()), id := 'sample_id', n_clusters := 3) AS k
JOIN sklearn.datasets.iris AS i USING (sample_id);
Uses adjusted_rand_scorehomogeneity_scorecompleteness_scorekmeansiris
164 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Using the scikit-learn worker's built-in iris dataset, how many flowers of each species are there? Return one row per species name with its count.
- Cluster the iris flowers into 3 groups with k-means using only the four flower measurements. Return the size of each cluster, largest first.
scikit-learn is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
LightGBM
Statistics & ML
Train, tune, evaluate, and explain gradient-boosted classifiers and regressors, with a saved-model registry
XGBoost
Statistics & ML
Train, tune, score and explain gradient-boosted tree models on your tables with plain SQL
Explain
Statistics & ML
Explain scikit-learn and XGBoost model predictions with per-row SHAP values and global feature importance