Skip to main content

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 description

Port of Yggdrasil / TensorFlow Decision Forests for Python

The Python port of Yggdrasil Decision is a light-weight wrapper around Yggdrasil Decision Forests. It allows direct, fast access to YDF's methods and it also offers advanced import / export, evaluation and inspection methods. While the package is called YDF, the wrapping code is sometimes lovingly called PYDF.

It is not a replacement for its sister project Tensorflow Decision Forests (TF-DF). Instead, it complements TF-DF for use cases that cannot be solved through the Keras API.

Installation

To install YDF, in Python, simply grab the package from pip:

pip install ydf

For build instructions, see INSTALLATION.md.

Usage Example

import ydf
import pandas as pd

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")

model = ydf.GradientBoostedTreesLearner(label="income").train(train_ds)

print(model.evaluate(test_ds))

model.save("my_model")

loaded_model = ydf.load_model("my_model")

Frequently Asked Questions

  • Is it PYDF or YDF? The name of the library is simply ydf, and so is the name of the corresponding Pip package. Internally, the team sometimes uses the name PYDF because it fits so well.
  • What is the status of PYDF? PYDF is currently in Alpha development. Most parts already work well (training, evaluation, predicting, export), some new features are yet to come. The API surface is mostly stable but may still change without notice.
  • Where is the documentation for PYDF? The documentation is available on https://ydf.readthedocs.org.
  • How should I pronounce PYDF? The preferred pronunciation is "Py-dee-eff" / ˈpaɪˈdiˈɛf (IPA)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

ydf-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ydf-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

ydf-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

ydf-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page