ydf 0.16.1


pip install ydf

  Latest version

Released: Mar 26, 2026


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.

Extras:
Dependencies:
numpy
absl_py
protobuf (<8.0.0,>=6.31.1)