# 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 ) è una libreria per l'addestramento, l'esecuzione e l'interpretazione di modelli di foresta decisionale (ad es. Random Forests, Gradient Boosted Trees) in TensorFlow. TF-DF supporta la classificazione, la regressione, la classificazione e l'elevazione. È disponibile su Linux e Mac. Gli utenti Windows possono usare WSL+Linux.
TF-DF è alimentato da Yggdrasil Decision Forest ( YDF ), una libreria per il training e l'utilizzo di foreste decisionali in c++, JavaScript, CLI e Go. I modelli TF-DF sono compatibili con i modelli YDF e viceversa.
Parole chiave: Decision Forests, TensorFlow, Random Forest, Gradient Boosted Trees, CART, interpretazione del modello.
Documentazione e risorse
Sono disponibili le seguenti risorse:
- Guide e tutorial
- Riferimento API
- Documentazione YDF (applicabile anche a TF-DF)
- Lezione di Google Developers sulle foreste decisionali
- Utilizza Simple ML per Fogli per addestrare i modelli nei tuoi Fogli Google
Comunità
Contribuire
I contributi a TensorFlow Decision Forests e Yggdrasil Decision Forests sono i benvenuti. Se vuoi contribuire, assicurati di consultare il manuale per sviluppatori .