# 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*.
YDF is the successor of
[Tensorflow Decision Forests](https://github.com/tensorflow/decision-forests)
(TF-DF). TF-DF is still maintained, but new projects should choose YDF for
improved performance, better model quality and more features.
## Installation
To install YDF, in Python, simply grab the package from pip:
```
pip install ydf
```
For build instructions, see INSTALLATION.md.
## Usage Example
```python
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
See the [FAQ](https://ydf.readthedocs.io/en/latest/faq/) in the documentation.
Raw data
{
"_id": null,
"home_page": "https://github.com/google/yggdrasil-decision-forests",
"name": "ydf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "machine learning decision forests random forest gradient boosted decision trees CART isolation forests classification regression ranking uplift",
"author": "Mathieu Guillame-Bert, Richard Stotz, Jan Pfeifer",
"author_email": "decision-forests-contact@google.com",
"download_url": null,
"platform": null,
"description": "# Port of Yggdrasil / TensorFlow Decision Forests for Python\n\nThe Python port of Yggdrasil Decision is a light-weight wrapper around Yggdrasil\nDecision Forests. It allows direct, fast access to YDF's methods and it also\noffers advanced import / export, evaluation and inspection methods. While the\npackage is called YDF, the wrapping code is sometimes lovingly called *PYDF*.\n\nYDF is the successor of\n[Tensorflow Decision Forests](https://github.com/tensorflow/decision-forests) \n(TF-DF). TF-DF is still maintained, but new projects should choose YDF for\nimproved performance, better model quality and more features.\n\n## Installation\n\nTo install YDF, in Python, simply grab the package from pip:\n\n```\npip install ydf\n```\n\nFor build instructions, see INSTALLATION.md.\n\n## Usage Example\n\n```python\nimport ydf\nimport pandas as pd\n\nds_path = \"https://raw.githubusercontent.com/google/yggdrasil-decision-forests/main/yggdrasil_decision_forests/test_data/dataset\"\ntrain_ds = pd.read_csv(f\"{ds_path}/adult_train.csv\")\ntest_ds = pd.read_csv(f\"{ds_path}/adult_test.csv\")\n\nmodel = ydf.GradientBoostedTreesLearner(label=\"income\").train(train_ds)\n\nprint(model.evaluate(test_ds))\n\nmodel.save(\"my_model\")\n\nloaded_model = ydf.load_model(\"my_model\")\n```\n\n## Frequently Asked Questions\n\nSee the [FAQ](https://ydf.readthedocs.io/en/latest/faq/) in the documentation.\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "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.",
"version": "0.13.0",
"project_urls": {
"Documentation": "https://ydf.readthedocs.io/",
"Homepage": "https://github.com/google/yggdrasil-decision-forests",
"Source": "https://github.com/google/yggdrasil-decision-forests.git",
"Tracker": "https://github.com/google/yggdrasil-decision-forests/issues"
},
"split_keywords": [
"machine",
"learning",
"decision",
"forests",
"random",
"forest",
"gradient",
"boosted",
"decision",
"trees",
"cart",
"isolation",
"forests",
"classification",
"regression",
"",
"ranking",
"uplift"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8279f4837b08291b17c673a77c9390880cccc985ea1851ce12fba8035d03bafe",
"md5": "85c4913855aced713bf347f54b16129e",
"sha256": "fdea7854d9c5d81267a42732d11efa242938fbc8a3c0795a876c184e4c242bca"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp310-cp310-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "85c4913855aced713bf347f54b16129e",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 9027959,
"upload_time": "2025-07-15T15:52:53",
"upload_time_iso_8601": "2025-07-15T15:52:53.031213Z",
"url": "https://files.pythonhosted.org/packages/82/79/f4837b08291b17c673a77c9390880cccc985ea1851ce12fba8035d03bafe/ydf-0.13.0-cp310-cp310-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "13695d2d5ba31b9c113cc1410cd18f66a39b96a4e07d80a840d09a7738984514",
"md5": "68b068d637464c55776da7da645b938c",
"sha256": "84d96ffa416176aa0b09c063adae753c5879f20e546fc284e1b0f1bfd6bdeda4"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "68b068d637464c55776da7da645b938c",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 12138088,
"upload_time": "2025-07-15T15:52:58",
"upload_time_iso_8601": "2025-07-15T15:52:58.219085Z",
"url": "https://files.pythonhosted.org/packages/13/69/5d2d5ba31b9c113cc1410cd18f66a39b96a4e07d80a840d09a7738984514/ydf-0.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dbae51474d7145d3150b551c3f87f4e43a22873b18159b291c39457c19459bc0",
"md5": "e54e1d4da1fc514ecc839b04c440854a",
"sha256": "a920f331e16f3f6d1da64a27c6bf3655483c7e3bd1ce4bf4f3d52422ebcdcc93"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp311-cp311-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "e54e1d4da1fc514ecc839b04c440854a",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 9029694,
"upload_time": "2025-07-15T15:53:00",
"upload_time_iso_8601": "2025-07-15T15:53:00.422058Z",
"url": "https://files.pythonhosted.org/packages/db/ae/51474d7145d3150b551c3f87f4e43a22873b18159b291c39457c19459bc0/ydf-0.13.0-cp311-cp311-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "51a01dcb8e9a820aedb557101388bd4fccf50684b2adc418eefa0e159a3a1f9d",
"md5": "11ba484f0a00437ee70b77efc0880b9e",
"sha256": "fca5167e2da14bbd4a1120ead71843769d046e2840f2fbcba8b9aaa3d581dd09"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "11ba484f0a00437ee70b77efc0880b9e",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 12138351,
"upload_time": "2025-07-15T15:53:03",
"upload_time_iso_8601": "2025-07-15T15:53:03.153878Z",
"url": "https://files.pythonhosted.org/packages/51/a0/1dcb8e9a820aedb557101388bd4fccf50684b2adc418eefa0e159a3a1f9d/ydf-0.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e16b77a7850c22fe56c1294a043534712d0c7338f67a9828408ae6d630c66daa",
"md5": "fc01cca1c29d016f131f10e82c7a36db",
"sha256": "20108f07edac014cbf6bd38c14fdb93e547a91ebf71ed36246df4d5c85943960"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp312-cp312-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "fc01cca1c29d016f131f10e82c7a36db",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 9035280,
"upload_time": "2025-07-15T15:53:05",
"upload_time_iso_8601": "2025-07-15T15:53:05.353868Z",
"url": "https://files.pythonhosted.org/packages/e1/6b/77a7850c22fe56c1294a043534712d0c7338f67a9828408ae6d630c66daa/ydf-0.13.0-cp312-cp312-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "173852ebb2383e035c3fc213a57af026d9c8a68238e06ec265a2b451cb23e4c7",
"md5": "cb078f6722366ab3e906721d2a14681f",
"sha256": "b9efc1d0483657daaeff294a826490ffbd0e32bd2df552978bd84596eb54f0a6"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "cb078f6722366ab3e906721d2a14681f",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 12138772,
"upload_time": "2025-07-15T15:53:07",
"upload_time_iso_8601": "2025-07-15T15:53:07.437167Z",
"url": "https://files.pythonhosted.org/packages/17/38/52ebb2383e035c3fc213a57af026d9c8a68238e06ec265a2b451cb23e4c7/ydf-0.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4c96375c190ca01792ed3fe69e0630259bdc24967418dc0690c6c736d20b67de",
"md5": "40b2e2bb90c4268a83c46f7b7e05c716",
"sha256": "771bc68c3f001b935a43dca99d8abebfce6cb47adfe4265d393acd74b520c619"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp313-cp313-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "40b2e2bb90c4268a83c46f7b7e05c716",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.8",
"size": 9035242,
"upload_time": "2025-07-15T15:53:10",
"upload_time_iso_8601": "2025-07-15T15:53:10.371853Z",
"url": "https://files.pythonhosted.org/packages/4c/96/375c190ca01792ed3fe69e0630259bdc24967418dc0690c6c736d20b67de/ydf-0.13.0-cp313-cp313-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e84e9d5e7b6dd27a66f0ebc59e6169ea71aa2d5cde6c4f0c8ab29cf1daf7c6aa",
"md5": "5e33c79f03d46e7bbaddd0d548734cf5",
"sha256": "4bf147d1e068cbe10d453ba4ccc3f143b592b38ef87e319edd7d133e358f0338"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "5e33c79f03d46e7bbaddd0d548734cf5",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.8",
"size": 12138814,
"upload_time": "2025-07-15T15:53:13",
"upload_time_iso_8601": "2025-07-15T15:53:13.327305Z",
"url": "https://files.pythonhosted.org/packages/e8/4e/9d5e7b6dd27a66f0ebc59e6169ea71aa2d5cde6c4f0c8ab29cf1daf7c6aa/ydf-0.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4ae6766297bf69383b684648d594eab767e644c5ea7e7c48a79c6f44c27f203b",
"md5": "94ff47988e13680ae6549818d6220a8c",
"sha256": "d3cdb40d4d06f063caba01ceab066dfcbe82102946c0b4491e3ac2c64197a587"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp38-cp38-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "94ff47988e13680ae6549818d6220a8c",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 9027651,
"upload_time": "2025-07-15T15:53:15",
"upload_time_iso_8601": "2025-07-15T15:53:15.513793Z",
"url": "https://files.pythonhosted.org/packages/4a/e6/766297bf69383b684648d594eab767e644c5ea7e7c48a79c6f44c27f203b/ydf-0.13.0-cp38-cp38-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5cd7b5632b1e52337fc342d31dfc36007328b50becb8c5e8fe17864284a28f45",
"md5": "a364d553011b18ccd1f20b9370c7ce9e",
"sha256": "c260b1fd34c9390409660bf8986cebbf91b1b2f3d41792ccd3dcb7195eef47f8"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "a364d553011b18ccd1f20b9370c7ce9e",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 12136533,
"upload_time": "2025-07-15T15:53:17",
"upload_time_iso_8601": "2025-07-15T15:53:17.692201Z",
"url": "https://files.pythonhosted.org/packages/5c/d7/b5632b1e52337fc342d31dfc36007328b50becb8c5e8fe17864284a28f45/ydf-0.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "db5db5c3255c71afc2737bcb8939d736aa651b2cfe4643d96f7a45ed085e779f",
"md5": "6ac38c19a593cc51051d9a67316e4ab6",
"sha256": "8d1d7ce20ad80e7f990af2dafc4367e4e1c80bc22c39b324dac8fe0d27161eeb"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp39-cp39-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "6ac38c19a593cc51051d9a67316e4ab6",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 9027869,
"upload_time": "2025-07-15T15:53:19",
"upload_time_iso_8601": "2025-07-15T15:53:19.943024Z",
"url": "https://files.pythonhosted.org/packages/db/5d/b5c3255c71afc2737bcb8939d736aa651b2cfe4643d96f7a45ed085e779f/ydf-0.13.0-cp39-cp39-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a922264c4c14bebe2030746e0ccc0690c757f83d2994ad394a57b8b73e9a0b2b",
"md5": "d4f21f4968ad43d1c47e6192ac53f771",
"sha256": "4d278493cde628ad1b6dff61e9b9c610c42f5a0ff8dfcef58a7a9c1f4a2aeac9"
},
"downloads": -1,
"filename": "ydf-0.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "d4f21f4968ad43d1c47e6192ac53f771",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 12138563,
"upload_time": "2025-07-15T15:53:22",
"upload_time_iso_8601": "2025-07-15T15:53:22.432207Z",
"url": "https://files.pythonhosted.org/packages/a9/22/264c4c14bebe2030746e0ccc0690c757f83d2994ad394a57b8b73e9a0b2b/ydf-0.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-15 15:52:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "google",
"github_project": "yggdrasil-decision-forests",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ydf"
}