Light AutoML Plot: Visualize and Optimize Machine Learning Models

Author

Reads 360

An artist’s illustration of artificial intelligence (AI). This image represents how machine learning is inspired by neuroscience and the human brain. It was created by Novoto Studio as par...
Credit: pexels.com, An artist’s illustration of artificial intelligence (AI). This image represents how machine learning is inspired by neuroscience and the human brain. It was created by Novoto Studio as par...

Light AutoML Plot is a powerful tool that helps you visualize and optimize machine learning models. It simplifies the process of hyperparameter tuning, allowing you to quickly identify the best parameters for your model.

With Light AutoML Plot, you can easily visualize the performance of your models across different hyperparameters, making it easier to find the optimal combination. This saves you time and effort that would be spent manually testing different parameters.

Light AutoML Plot also provides a range of visualization options, including scatter plots, bar charts, and more, to help you understand how different hyperparameters affect your model's performance.

Additional reading: Plotly Confusion Matrix

Creating an AutoML Model

To develop an AutoML model, you'll first need to create a preset, which in this case is the TabularAutoML preset. This preset uses a list of base algorithms, including linear models, LightGBM models, and CatBoost models.

The TabularAutoML preset uses a specific notation to create ML pipelines with multiple levels of algorithms. For example, [['linear_l2', 'lgb', 'cb'], ['lgb_tuned', 'cb']] represents a pipeline with 3 algorithms on the first level and 2 on the second.

To fit the model on the train part of the dataset, you'll use the fit_predict function. This will result in Out-of-Fold (OOF) predictions, which can be used to calculate the model's performance metrics on the train data.

Code

Credit: youtube.com, Building and training ML models with Vertex AI

To write code for an AutoML model, you can use random tabular data from a source like Kaggle.

LightAutoML can run on your local machine, but it's recommended to use Google Colab or Kaggle Notebooks for the GPU.

If you're interested in this domain, you can also check out other autoML libraries like TPOT and auto-sklearn.

Inference

Inference is the final step in the AutoML process, where you use the trained model to make predictions on new data. You can use the get_feature_scores method to get an array of feature scores, which can be plotted for better explainability.

The get_feature_scores method returns an array of feature scores, which can be used to understand the importance of each feature in the model. This can be a useful tool for understanding how the model is making its predictions.

To make predictions, you can use the predict method, which returns a 2-d array containing the probabilities of an instance being a specific class. You can then apply the argmax function to get the class to which the instance belongs.

The predict method returns a 2-d array, where each row corresponds to an instance and each column corresponds to a target class. This allows you to see the probabilities of each instance belonging to each class.

Create AutoML Model

Credit: youtube.com, Vertex AI Model Builder SDK Training and Making Predictions on an AutoML Model

To create an AutoML model, you'll need to choose a preset. In this case, we're using the TabularAutoML preset, which is a good starting point for tabular data. This preset comes with a list of base algorithms that can be used to build the model.

The base algorithms available for the TabularAutoML preset include linear models, LightGBM models with expert and tuned parameters, and CatBoost models with expert and tuned parameters. These algorithms are listed in a nested list, allowing you to create complex ML pipelines with multiple levels of algorithms.

For example, you can use the following code to create a pipeline with three algorithms on the first level and two on the second: [['linear_l2', 'lgb', 'cb'], ['lgb_tuned', 'cb']].

To fit the model to the training data, you'll need to use the fit_predict function. This function will produce Out-of-Fold (OOF) predictions, which can be used to calculate the model's performance metrics on the training data.

Visualizing Results

Credit: youtube.com, Weekly #105: AutoViz and AutoViML: Automated Visualization and Machine Learning

To visualize your LightGBM results, you can use the matplotlib package to create a graphical representation of the tree.

The plot_tree() method communicates with matplotlib to create nodes, branches, and labels in the tree.

You can choose which tree to visualize by setting the tree_index parameter, such as tree_index=0 to view the first tree.

By specifying show_info=[], you can decide which labels to use in the plot.

Landon Fanetti

Writer

Landon Fanetti is a prolific author with many years of experience writing blog posts. He has a keen interest in technology, finance, and politics, which are reflected in his writings. Landon's unique perspective on current events and his ability to communicate complex ideas in a simple manner make him a favorite among readers.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.