Machine Learning DuckDB Extension

August 26, 2025 ยท View on GitHub

This repository contains a Rust extension for the DuckDB database, adding machine learning capabilities through custom scalar functions. The extension provides functionalities to create, list, train, and predict models using neural networks.

Networks are created using a JSON spec. Currently only supports FCN networks.

Table of Contents

FunctionInputsDescription
ml_createmodelname: VARCHAR, spec: VARCHARCreates a new machine learning model with the given name and JSON specification.
ml_listLists all registered models.
ml_trainmodelname: VARCHAR, features: LIST(FLOAT), targets: LIST(FLOAT) -> LIST(FLOAT)Trains a machine learning model using the specified features and targets for the given model name. Returns predicted outputs after training the model.
ml_predmodelname: VARCHAR, features: LIST(FLOAT) -> LIST(FLOAT)Predicts outcomes using the trained model with the specified name and input features.

Usage example