YDF (short for Yggdrasil Decision Forests) is a library for training, serving, evaluating and analyzing decision forest models such as Random Forest and Gradient Boosted Trees.
Project Links
Meta
Author: Mathieu Guillame-Bert, Richard Stotz, Jan Pfeifer
Requires Python: >=3.9
Classifiers
Intended Audience
- Developers
- Education
- Science/Research
License
- OSI Approved :: Apache Software License
Programming Language
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3 :: Only
Topic
- Scientific/Engineering
- Scientific/Engineering :: Mathematics
- Scientific/Engineering :: Artificial Intelligence
- Software Development
- Software Development :: Libraries
- Software Development :: Libraries :: Python Modules
YDF - Yggdrasil Decision Forests for Python
YDF is a library for training, serving, and interpreting decision forest models. It acts as a lightweight, efficient wrapper around the C++ Yggdrasil Decision Forests library.
It provides fast access to core methods along with advanced features for model import/export, evaluation, and inspection.
YDF is the official successor to TensorFlow Decision Forests (TF-DF) and is recommended for new projects due to its superior performance and features.
Installation
Install YDF from PyPI:
pip install ydf
For detailed build instructions, see INSTALLATION.md.
Usage Example
import ydf
import pandas as pd
# Load dataset
ds_path = "https://raw.githubusercontent.com/google/yggdrasil-decision-forests/main/yggdrasil_decision_forests/test_data/dataset"
train_ds = pd.read_csv(f"{ds_path}/adult_train.csv")
test_ds = pd.read_csv(f"{ds_path}/adult_test.csv")
# Train a Gradient Boosted Trees model
model = ydf.GradientBoostedTreesLearner(label="income").train(train_ds)
# Evaluate the model
print(model.evaluate(test_ds))
# Save the model
model.save("my_model")
# Load the model
loaded_model = ydf.load_model("my_model")
Documentation
For more information, visit the YDF Documentation.
Frequently asked questions are available in the FAQ.
0.16.1
Mar 26, 2026
0.16.0
Mar 17, 2026
0.15.0
Feb 04, 2026
0.14.0
Jan 09, 2026
0.13.0
Jul 15, 2025
0.12.0
May 20, 2025
0.11.0
Mar 12, 2025
0.10.0
Feb 11, 2025
0.9.0
Dec 02, 2024
0.8.0
Sep 23, 2024
0.7.0
Aug 21, 2024
0.6.0
Jul 07, 2024
0.5.0
Jun 18, 2024
0.4.3
May 08, 2024
0.4.2
Apr 22, 2024
0.4.1
Apr 19, 2024
0.4.0
Apr 12, 2024
0.3.0
Mar 15, 2024
0.2.0
Feb 22, 2024
0.1.0
Jan 26, 2024
0.0.8
Dec 19, 2023
0.0.7
Dec 11, 2023
0.0.6
Nov 28, 2023
0.0.5
Nov 12, 2023
0.0.4
Nov 02, 2023
0.0.3
Oct 20, 2023
0.0.2
Oct 05, 2023
0.0.1
Oct 04, 2023
0.0.0
Aug 11, 2023
Wheel compatibility matrix
| Platform | CPython 3.9 | CPython 3.10 | CPython 3.11 | CPython 3.12 | CPython 3.13 |
|---|---|---|---|---|---|
| macosx_12_0_arm64 | |||||
| manylinux_2_27_x86_64 | |||||
| manylinux_2_28_x86_64 |
Files in release
ydf-0.16.1-cp310-cp310-macosx_12_0_arm64.whl (7.8MiB)
ydf-0.16.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8MiB)
ydf-0.16.1-cp311-cp311-macosx_12_0_arm64.whl (7.8MiB)
ydf-0.16.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8MiB)
ydf-0.16.1-cp312-cp312-macosx_12_0_arm64.whl (7.8MiB)
ydf-0.16.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8MiB)
ydf-0.16.1-cp313-cp313-macosx_12_0_arm64.whl (7.8MiB)
ydf-0.16.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8MiB)
ydf-0.16.1-cp39-cp39-macosx_12_0_arm64.whl (7.8MiB)
ydf-0.16.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8MiB)