Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
What is AutoML?
2.
AutoML Libraries
2.1.
Auto-sklearn
2.2.
AutoKeras
2.3.
TPOT
3.
Google Cloud AutoML
3.1.
What is the score threshold in VertexAI?
4.
Frequently Asked Questions
5.
Key Takeaways
Last Updated: Mar 27, 2024

Applications of AutoML

What is AutoML?

The full-form of AutoML is Automated Machine Learning. With AutoML, we can automate the machine learning tasks and reduce human intervention, to lessen human efforts.

 

Source: www.wired.com

 

A Machine Learning pipeline consists of several steps, from Data Acquisition to Making Predictions on a new dataset.

 

Figure: ML Pipeline

 

From this complete pipeline, we can automate the two steps Model Training / Model Selection and Hyper-parameter optimization by using AutoML.

Also, see -  Locally Weighted Regression.

AutoML Libraries

Today, many libraries are available to implement Automated Machine Learning. According to the use-case, the user can choose the library that best suits their needs.

Let’s see some of the widely used AutoML libraries.

Auto-sklearn

Auto-sklearn is designed specifically for Machine Learning models. Auto-sklearn works smoothly with all the sklearn libraries. It automatically selects the best performing algorithm for a dataset and even changes the hyperparameters to give the best results.

Auto-sklearn library is easy to install with just one statement.

pip install auto-sklearn
You can also try this code with Online Python Compiler
Run Code

The two primary classes in the Auto-sklearn module are AutoSklearnClassifier and AutoSklearnRegressor; we use one for the Classification based Machine Learning tasks while the other for generating numerical predictions.

The official documentation of Auto-Sklearn can be found here.

AutoKeras

The motive behind the development of AutoKeras was to make computer vision tasks simpler such that it is accessible to everyone. We use AutoKeras for Deep-Learning based tasks. Neural Networks and computer vision tasks are more complex, so we use AuoKeras to make it easier to implement.

AutoKeras can generate the best neural network architectures based on the task. In Neural Networks, selecting the number of neurons, the number of hidden layers, or setting the parameters is tedious and takes up huge amounts of human effort. Fortunately, AutoKeras considers all the possibilities and outputs the best model for the dataset.

We can easily install the AutoKeras library in our python environment.

pip install autokeras
You can also try this code with Online Python Compiler
Run Code

 

Here is a small demonstration of importing AutoKeras in the python script and using it for Image Classification.

import autokeras as autok

classifier = autok.ImageClassifier()
classifier.fit(train_data, train_labels)
result = classifier.predict(test_data)
You can also try this code with Online Python Compiler
Run Code

 

To read the official documentation of AutoKeras, visit here.

 

TPOT

We use TPOT for Automating certain stages in the Machine Learning pipeline. If data preparation is the most critical objective in our task, we can use TPOT as the data preparation, and modeling algorithms stages are emphasized more with this library.

The stages that are automated with TPOT are:

  • Feature Selection,
  • Feature Processing,
  • Feature Construction,
  • Model Selection, and
  • Parameter Optimization

 

Like most AutoML libraries, TPOT can take hours to days to produce good quality results.

 

We can install TPOT using the pip command.

pip install tpot
You can also try this code with Online Python Compiler
Run Code

 

Figure: TPOT Pipeline

 

Source: http://epistasislab.github.io/tpot/

 

Here is a simple illustration to use TPOT to classify digits in the sklearn digits dataset.

from tpot import TPOTClassifier
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split

digits = load_digits()
train_data, test_data, train_labels, test_labels = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25)

classifier = TPOTClassifier(generations=5, population_size=50, verbosity=2, n_jobs=-1)
classifier.fit(train_data, train_labels)

classifier.score(test_data, test_labels)
You can also try this code with Online Python Compiler
Run Code

Google Cloud AutoML

Google Cloud offers its own paid AutoML solution. VertexAI in the Google Cloud platform combines AI platform and AutoML. In GCloud, we use the AI Platform to run jupyter notebooks and train custom models (after all the preprocessing is done). 

Combining the AI Platform with AutoML does wonders because now we can use AutoML to select the best model & hyperparameters, and we can make some tweaks to the model using the AI Platform according to our needs.

VertexAI has pre-trained APIs for computer vision, natural language processing, translation, and speech recognition applications. So, even a beginner who doesn’t have much knowledge of Deep Learning can develop good models. Labeling the dataset is another problem in Deep Learning which requires a lot of time and human effort; we can even use VertexAI to label the unlabelled dataset.

What is the score threshold in VertexAI?

Suppose we have some multi-class classification-based tasks. To train the model more effectively, the VertexAI will select some random image and pass it through the model; the model will output the probabilities of that image belonging to the respective classes. For instance, if the probability is highest for class A, the image belongs to class A.

The score threshold is the class’s probability of getting classified. For example, suppose our model has classified an 0.85 probability that an image belongs to class A. If the score-threshold is <0.85, we’ll classify it as class A whereas if the score-threshold is >0.85; we’ll not classify the image as class A.

Check this out, Agents in Artificial Intelligence

Frequently Asked Questions

Q1. What are the disadvantages of using AutoML?
Ans. One of the most significant disadvantages of AutoML is that it takes a lot of time to train the models; high computational resources and power is required to train a model on large datasets. Apart from that, the AutoML is still in the development stage, so there is a high-risk factor with it while using AutoML in production applications.

Q2. How does VertexAI evaluate the performance of a model?
Ans. While evaluating the model, the VertexAI takes many parameters into consideration, such as:

  1. Model’s Output
  2. Classification Report (True Positives, True Negatives, False Positives & False Negatives)
  3. Precision and Recall of the Model
  4. The score threshold
  5. Precision and Recall Curves
     

Q3. What are libraries that we can use to implement AutoML in projects?
Ans. Nowadays, there are many AutoML solutions available online. We can choose any framework based on the scale of the project and use case. Some of the widely used AutoML frameworks are:

  1. auto-sklearn
  2. AutoKeras
  3. TPOT
  4. VertexAI

Key Takeaways

In today’s scenario, more & more industries are adapting to AutoML applications in their products; with this rise, it has become clear that AutoML can be the next boon in the technology.

You can also consider our Machine Learning Course to give your career an edge over others.

Live masterclass