ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

Module: tfdf.keras

Decision Forest in a Keras Model.

Usage example:

import tensorflow_decision_forests as tfdf
import pandas as pd

# Load the dataset in a Pandas dataframe.
train_df = pd.read_csv("project/train.csv")
test_df = pd.read_csv("project/test.csv")

# Convert the dataset into a TensorFlow dataset.
train_ds = tfdf.keras.pd_dataframe_to_tf_dataset(train_df, label="my_label")
test_ds = tfdf.keras.pd_dataframe_to_tf_dataset(test_df, label="my_label")

# Train the model.
model = tfdf.keras.RandomForestModel()

# Evaluate the model on another dataset.

# Show information about the model

# Export the model with the TF.SavedModel format."/path/to/my/model")


core module: Core wrapper.

wrappers module: Wrapper around each learning algorithm.


class AdvancedArguments: Advanced control of the model that most users won't need to use.

class CartModel: Cart learning algorithm.

class CoreModel: Keras Model V2 wrapper around an Yggdrasil Learner and Model.

class FeatureSemantic: Semantic (e.g.

class FeatureUsage: Semantic and hyper-parameters for a single feature.

class GradientBoostedTreesModel: Gradient Boosted Trees learning algorithm.

class RandomForestModel: Random Forest learning algorithm.


get_all_models(...): Gets the lists of all the available models.

pd_dataframe_to_tf_dataset(...): Converts a Panda Dataframe into a TF Dataset.

Task Instance of google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper