SQL-native histogram GBDT in DuckDB with vendor dump import and plain-SQL export
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL duckboost FROM community;
LOAD duckboost;
Example
LOAD duckboost;
CREATE TABLE penguins AS
SELECT
body_mass_g::DOUBLE AS body_mass_g,
[bill_length_mm, bill_depth_mm, flipper_length_mm, (sex = 'male')::DOUBLE] AS features
FROM read_csv(
'https://raw.githubusercontent.com/allisonhorst/palmerpenguins/master/inst/extdata/penguins.csv',
nullstr = 'NA'
)
WHERE body_mass_g IS NOT NULL
AND bill_length_mm IS NOT NULL
AND sex IS NOT NULL;
CREATE TABLE models AS
SELECT duckboost_train(
body_mass_g, features,
MAP {
'backend': 'native',
'n_estimators': '40',
'max_depth': '3',
'learning_rate': '0.15',
'feature_names': 'bill_length_mm,bill_depth_mm,flipper_length_mm,male'
}
) AS model
FROM penguins;
SELECT
round(body_mass_g, 0) AS body_mass_g,
round(duckboost_predict(model, features), 0) AS pred_g
FROM models, penguins
ORDER BY body_mass_g
LIMIT 5;
About duckboost
duckboost trains a dependency-free histogram GBDT inside DuckDB
(backend = 'native', alias 'reference'), evaluates and inspects models in SQL,
imports XGBoost / LightGBM / CatBoost dumps, and exports orbital-style SQL
(duckboost_to_sql) for inference without the extension.
The Getting Started page walks through the same Palmer penguins first model using the package CSV over HTTPS.
Default community binaries ship the native trainer plus dump import.
Optional in-process XGBoost / LightGBM training requires rebuilding with
DUCKBOOST_WITH_XGBOOST / DUCKBOOST_WITH_LIGHTGBM. CatBoost is import-only.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| duckboost_backends | table | NULL | NULL | |
| duckboost_build_info | table | NULL | NULL | |
| duckboost_dummy | macro | NULL | NULL | |
| duckboost_dummy_names | macro | NULL | NULL | |
| duckboost_evaluate | scalar | NULL | NULL | |
| duckboost_evaluate_agg | aggregate | NULL | NULL | |
| duckboost_fit | table_macro | NULL | NULL | |
| duckboost_import | scalar | NULL | NULL | |
| duckboost_importance | table | NULL | NULL | |
| duckboost_initial_split | table_macro | NULL | NULL | |
| duckboost_initial_validation_split | table_macro | NULL | NULL | |
| duckboost_integer | macro | NULL | NULL | |
| duckboost_levels | macro | NULL | NULL | |
| duckboost_other | macro | NULL | NULL | |
| duckboost_predict | scalar | NULL | NULL | |
| duckboost_predict_proba | scalar | NULL | NULL | |
| duckboost_score | table_macro | NULL | NULL | |
| duckboost_to_sql | scalar | NULL | NULL | |
| duckboost_train | aggregate | NULL | NULL | |
| duckboost_vfold | table_macro | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |