Lightweight, columnar-native ML for DuckDB — train + inference, 34 algorithms, zero Python deps
Maintainer(s):
alitrack
Installing and Loading
INSTALL ml FROM community;
LOAD ml;
Example
-- Train linear regression
SELECT * FROM ml_train('my_model', 'linear_regression',
'[[1.0],[2.0],[3.0]]', '[[10.0],[20.0],[30.0]]', '{}');
-- Predict
SELECT ml_predict('my_model', 2.5);
About ml
ML — Machine Learning for DuckDB
Pure Rust ML extension. 34 algorithms, zero Python dependencies.
Algorithms (34):
- Regression: linear_regression, ridge_regression, lasso_regression, elastic_net, robust (Huber), polynomial_regression
- Generalized Linear: logistic_regression, multilogistic, ordinal
- Survival: cox, kaplan_meier
- Trees: decision_tree, random_forest, rf_classifier, adaboost
- Gradient Boosting: xgboost_regression, xgboost_binary (multi-class softmax), xgboost_regressor, xgboost_classifier
- Neural: mlp_regressor
- Distance: knn_regressor, knn_classifier
- Bayesian: naive_bayes
- Kernel: svm, svr
- Clustering: kmeans, fuzzy_cmeans, dbscan, agglomerative
- Dim Reduction: pca, lda, tsne
- External: onnx, arima
Install: INSTALL ml FROM community;
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| ml_assoc_rules | scalar | NULL | NULL | |
| ml_compare | table | NULL | NULL | |
| ml_cox_train | scalar | NULL | NULL | |
| ml_cross_validate | scalar | NULL | NULL | |
| ml_deploy | table | NULL | NULL | |
| ml_km_train | scalar | NULL | NULL | |
| ml_list_models | table | NULL | NULL | |
| ml_list_snapshots | table | NULL | NULL | |
| ml_load_xgboost | table | NULL | NULL | |
| ml_metrics | scalar | NULL | NULL | |
| ml_ols | scalar | NULL | NULL | |
| ml_predict | table | NULL | NULL | |
| ml_predict_batch | table | NULL | NULL | |
| ml_predict_batch_value | scalar | NULL | NULL | |
| ml_similarity_value | scalar | NULL | NULL | |
| ml_smote | scalar | NULL | NULL | |
| ml_snapshot | table | NULL | NULL | |
| ml_train | table | NULL | NULL | |
| ml_train_model | scalar | NULL | NULL | |
| ml_voting | scalar | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.