# Install TF-DF
!pip install tensorflow tensorflow_decision_forests

# Load TF-DF
import tensorflow_decision_forests as tfdf
import pandas as pd

# Load a 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 a Random Forest model.
model = tfdf.keras.RandomForestModel()
model.fit(train_ds)

# Summary of the model structure.
model.summary()

# Evaluate the model.
model.evaluate(test_ds)

# Export the model to a SavedModel.
model.save("project/model")

TensorFlow Decision Forests ( TF-DF ) là một thư viện để huấn luyện, chạy và diễn giải các mô hình rừng quyết định (ví dụ: Random Forests, Gradient Boosted Trees) trong TensorFlow. TF-DF hỗ trợ phân loại, hồi quy, xếp hạng và nâng cấp. Nó có sẵn trên Linux và Mac. Người dùng cửa sổ có thể sử dụng WSL+Linux.

TF-DF được cung cấp bởi Yggdrasil Decision Forest ( YDF ), một thư viện để đào tạo và sử dụng các nhóm quyết định trong c ++, JavaScript, CLI và Go. Các mẫu TF-DF tương thích với các mẫu YDF và ngược lại.

Từ khóa: Rừng quyết định, TensorFlow, Rừng ngẫu nhiên, Cây tăng cường độ dốc, GIỎ HÀNG, diễn giải mô hình.

Tài liệu & Tài nguyên

Các tài nguyên sau đây có sẵn:

Cộng đồng

  • Diễn đàn TensorFlow
  • Rừng quyết định TensorFlow trên Github
  • Rừng quyết định Yggdrasil trên Github
  • Đóng góp

    Đóng góp cho Rừng quyết định TensorFlow và Rừng quyết định Yggdrasil đều được hoan nghênh. Nếu bạn muốn đóng góp, hãy nhớ xem lại hướng dẫn dành cho nhà phát triển .