. It’s a library that allows you to train tree-based models (like random forests and gradient-boosted trees) in TensorFlow. Why should you be interested in decision forests? There are roughly two types of Kaggle competitions - and the winning solution (neural networks or decision forests) depends on the kind of data you’re working with.
If you’re working with a tabular data problem (these involve training a model to classify data in a spreadsheet which is an extremely common scenario) - the winning solution is often a decision forest. However, if you’re working with a perception problem that involves teaching a computer to see or hear (for example, image classification), the winning model is usually a neural network.
Here’s where the good news starts. You can implement a decision forest in TensorFlow with just a few lines of code. This relatively simple model often outperforms a neural network on many Kaggle problems.
We will explore the decision forests library with a simple dataset from Kaggle, and we will build our model with . The . On the home page, select the “Code” option on the left menu and select “New Notebook,” which will open a new Kaggle Kernel.
Now we are ready to start writing code. Install the TensorFlow Decision Forests library and the necessary imports, as shown below. The code in this blog post has been obtained from the Build, train and evaluate models with the TensorFlow Decision Forests as random forests are configurable.
Once you have trained the model, you can see how it will perform on the test data.
model.compile(metrics=["accuracy"])
print(model.evaluate(test_ds))
In just a few lines of code, you reached an accuracy of >95% on this small dataset! This is a simple dataset, and one might argue that neural networks could also yield impressive results. And they absolutely can (and do), especially when you have very large datasets (think: hundreds of thousands of examples, or more). However, neural networks require more code and are resource intensive as they require significantly more compute power.
Easy preprocessing
Decision forests have another important advantage: there are fewer steps to preprocess the data. Notice in the code above that you were able to pass a dataset with both categorical and numeric values directly to the decision forests. You did not have to do any preprocessing like normalizing numeric values, converting strings to integers, and one-hot encoding them. This has major benefits. It makes decision forests simpler to work with (so you can train a model quickly), and there is less code that can go wrong.
Below, you will see some important differences between the two techniques.
Easy to interpret
A significant advantage of decision forests is that they are easy to interpret. While the pipeline for decision trees differs significantly from that of training neural networks, there are major advantages for selecting these models for a given task. This is because feature importance is particularly straightforward to determine with decision forests (ensemble of decision trees). Notably, the TensorFlow Decision Forests library makes it possible to visualize feature importance with its model plotter function. Let’s see below how this works!
tfdf.model_plotter.plot_model_in_colab(model, tree_idx=0)
Community-Analysen & Experten-Meinungen 0
Verwandte Story-Cluster & Quellen (Vektor-KI)
Ähnliche Beiträge
Auch interessante Nachrichten Training tree-based models with TensorFlow in just a few lines of code
Thematisch verwandte Begriffe: Training, treebased, models, with · 6 Treffer
Using LLMs and ESRE to find similar user sessions
Getting the Most Out of Transformers in Elastic
How to Build AI Systems That Know When They Don't Know: A Practical Guide
7 Async Patterns for Running Agents Concurrently in Python
Learn Vectorized Thinking in Python Through Examples
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
SOCIAL SHARE CARD GENERATOR