+ YDF is Google's new library to train Decision Forests.
+
+
+ YDF extends the power of TF-DF, offering new features, a simplified API, faster training times, updated documentation, and enhanced compatibility with popular ML libraries.
TensorFlow Decision Forests (TF-DF) is a library to train, run and
interpret decision forest
models (e.g., Random Forests, Gradient Boosted Trees) in TensorFlow.
TF-DF supports classification, regression, ranking and uplifting.
- It is available on Linux and Mac. Window users can use WSL+Linux.
-
-
- TF-DF is powered by Yggdrasil Decision Forest (YDF), a
- library to train and use decision forests in c++, JavaScript, CLI, and Go. TF-DF models are compatible with YDF models, and vice versa.
-
Keywords: Decision Forests, TensorFlow, Random Forest, Gradient Boosted Trees, CART, model interpretation.
- Contributions to TensorFlow Decision Forests and Yggdrasil Decision Forests are welcome.
- If you want to contribute, make sure to review the developer
- manual.
-
code_block: |
+
+
+
+
+
+
+
+
# Install TF-DF
!pip install tensorflow tensorflow_decision_forests
@@ -90,37 +143,59 @@ landing_page:
# Summary of the model structure.
model.summary()
- # Evaluate the model.
- model.evaluate(test_ds)
+ # Compute model accuracy.
+ model.compile(metrics=["accuracy"])
+ model.evaluate(test_ds, return_dict=True)
# Export the model to a SavedModel.
model.save("project/model")
+
+
- - classname: devsite-landing-row-cards
- items:
- # - heading: "Introducing TensorFlow Decision Forests"
- # image_path: /resources/images/tf-logo-card-16x9.png
- # path: https://blog.tensorflow.org
- # buttons:
- # - label: "Read on TensorFlow blog"
- # path: https://blog.tensorflow.org
- # - heading: "TensorFlow Decision Forests video"
- # youtube_id: 3d34Hkf7KXA
- # buttons:
- # - label: Watch the video
- # path: https://www.youtube.com/watch?v=3d34Hkf7KXA
- - heading: "TensorFlow Decision Forests on GitHub"
- # # Add the image back when more cards are added.
- # image_path: /resources/images/github-card-16x9.png
- path: https://github.com/tensorflow/decision-forests
- buttons:
- - label: "View on GitHub"
- path: https://github.com/tensorflow/decision-forests
- - heading: "Yggdrasil Decision Forests on GitHub"
- # # Add the image back when more cards are added.
- # image_path: /resources/images/github-card-16x9.png
- path: https://github.com/google/yggdrasil-decision-forests
- buttons:
- - label: "View on GitHub"
- path: https://github.com/google/yggdrasil-decision-forests
+
+
+
+
+
+
+
+ # Install YDF
+ !pip install ydf -U
+
+ import ydf
+ import pandas as pd
+
+ # Load a dataset with Pandas
+ ds_path = "https://raw.githubusercontent.com/google/yggdrasil-decision-forests/main/yggdrasil_decision_forests/test_data/dataset/"
+ train_ds = pd.read_csv(ds_path + "adult_train.csv")
+ test_ds = pd.read_csv(ds_path + "adult_test.csv")
+
+ # Train a Gradient Boosted Trees model
+ model = ydf.GradientBoostedTreesLearner(label="income").train(train_ds)
+
+ # Look at a model (input features, training logs, structure, etc.)
+ model.describe()
+
+ # Evaluate a model (e.g. roc, accuracy, confusion matrix, confidence intervals)
+ model.evaluate(test_ds)
+
+ # Generate predictions
+ model.predict(test_ds)
+
+ # Analyse a model (e.g. partial dependence plot, variable importance)
+ model.analyze(test_ds)
+
+ # Benchmark the inference speed of a model
+ model.benchmark(test_ds)
+
+ # Save the model
+ model.save("/tmp/my_model")
+
+ # Export the model as a TensorFlow Saved Model
+ model.to_tensorflow_saved_model("/tmp/my_saved_model")
+
+
+
+
+
diff --git a/documentation/image/ydf_logo.png b/documentation/image/ydf_logo.png
new file mode 100644
index 00000000..19616a34
Binary files /dev/null and b/documentation/image/ydf_logo.png differ