## What is Automated Machine Learning?

Automated machine learning is a process of automating the time-consuming, iterative systematic tasks in the machine learning development model of real-world problems. It is also referred to as AutoML or automated ML.

Therefore Automated Machine Learning is the process of automating the whole machine learning process. It includes selecting, arranging, and tuning data models and preprocessing. The objective of automated ML is to learn it easier and quicker for the learners and to apply autoML to a more fantastic range of problems without the need for more excellent knowledge of algorithms and techniques employed.

In conventional machine learning, the learner must carefully choose the right Model, fine-tune its hyperparameters, and preprocess the data before training the model-data before training Model. The time-consuming preprocess may require a deep knowledge of the Model and an understanding of the choice of machine learning algorithms and techniques. But with autoML, most of these work is automated, and the practitioner only needs to focus on defining the problem and suitable data.

Automated Machine Learning is a very robust tool for practitioners, those who are looking for a tool to apply machine learning to real practical situations. AutoML is very much helpful where the data is very complex, the situation is very complex, and not well defined. Besides, it helps users easily evaluate the different machine-learning techniques and models.

There are various steps involved in the Automated Machine Learning Process. They are

- Hyperparameter optimization
- Natural Architecture Search and
- Data Preprocessing

**Hyperparameter optimization:**

It is the process of finding the optimal values for a machine learning model hyper-parameters. Hyperparameter optimization can be achieved using various methods such as Grid Search, Random Search, and Bayesian Optimization.

**Grid Search**

– In grid search, a set of hyperparameters are specified, and the Model is trained and evaluated using all possible combinations of the parameters specified. Though it is computationally expensive when the Model has plenty of hyperparameters, training for each combination will be time-consuming.

This grid search algorithm optimization allows you to define a grid of hyperparameters for the Model. Then, it evaluates each and every single combination of these hyperparameters to find the best combination that delivers the most excellent performance.

It is a brute-force search algorithm that tries every possible combination of hyperparameters to find the best one. Grid search optimizes the model performance by selecting the best-suited hyperparameter for a given dataset.

It is otherwise called an exhaustive search algorithm. While using grid search user needs to specify each and every hyperparameters the user wants to search over and the values need to reach.

Besides, you need to specify the scoring function to evaluate the model performance with each combination of hyperparameters. The grid search algorithm will train the Model using all the combinations of hyperparameters and evaluate the performance using the scoring function.

The best set of hyperparameters for the Model will be decided according to the scoring function of the combination of parameters that have the best score.

Though it is a simple and widely used technique for hyperparameter optimization, it is computationally expensive when the practitioner has a large grid of values to search for or many hyperparameters to evaluate.

If the grid values and hyperparameters are large, the Bayesian optimization or Random search optimization technique will be more helpful.

**Random Search:**

Random search is an algorithm optimization technique. A set of hyperparameters is specified in it, and a random combination of these hyperparameters is used to train and evaluate the models.

Even though it is faster than grid search, sometimes the practitioner cannot find the optimal combination of hyperparameters. This is because it involves selecting a random combination of hyperparameters from a pre-specified distribution for every iteration of the optimization process.

The performance of the Model is then evaluated using the scoring function, and the best-performing hyperparameters combination is selected as the best set of hyperparameters for the Model.

In Random Search, the samples hyperparameter space randomly; therefore, it is more efficient when the number of parameters or the number of values to search over is high.

When the number of hyperparameters or the number of values to search over is too small, it is not effective as a Grid search.

And it could not find the best combination of hyperparameters. So in Random Search, the user needs to input the hyperparameters they want to optimize.

The search algorithm of Random Search will generate a random combination of hyperparameters from the specified distribution, train the Model using these hyperparameters, and evaluate its performance using the scoring function.

This procedure is repeated for a specified number of iterations, and the combination of the best according to the scoring function is selected as the best set of hyperparameters for the specified Model. Though it is the widely used technique, it is inefficient when the values to search over are very small.

**Bayesian Optimization: **

Bayesian optimization is a way of optimizing an objective function that takes in a set of hyperparameters and returns a performance score. In this type of Bayesian Optimization, the objective function is termed a black box.

The optimization process involves constructing a surrogate model of the objective function based on evaluating the function at different combinations of hyperparameters. The surrogate Model is used to guide the search in selecting the best combination of hyperparameters by balancing the trade off between exploration and exploitation.

In Bayesian optimization, the user needs to specify the hyperparameters that he wants to optimize and prior distribution over the hyperparameters and scoring function to evaluate the model’s performance with each combination of hyperparameters.

The Bayesian algorithm iteratively selects the combination of hyperparameters to evaluate based on the proxy model of the objective functions and the trade-off between exploration and exploitation.

The process of the experiment is repeated until a stopping criterion is met. And the combination of hyperparameters that performs the best according to the scoring function is selected as the best set of hyperparameters for the Model.

Bayesian optimization is a perfect and powerful technique for hyperparameters optimization when the objective function is more significant to evaluate, or many parameters need to be optimized.

The only disadvantage is it requires the specification of a prior distribution over the hyperparameters, which is hard to specify in all cases. Further, it is susceptible to the choice of a proxy model.

**Natural Architecture Search:**

NAS automates the process of selecting and designing the architecture of a neural network for a given machine-learning assignment. It uses the search algorithm to explore all possible neural network architectures and find out the best-performing one.

Reinforcement learning or evolutionary algorithms and Gradient-based methods are employed to achieve the desired results.

The evolutionary algorithm employs principles from natural evolution, such as selection and reproduction, to search for the best possible architectures.

And the Reinforcement Learning Approach employs Markov Decision Process in the search process and uses reinforcement learning algorithms to find the best fit of optimal architecture.

In Gradient Based approach, gradient descent is used to search the architecture space. It is faster than the evolutionary algorithm or reinforcement learning process. But, unfortunately, it is less efficient in finding the optimal architecture.

Using Natural Architecture Search significantly reduces the human effort in designing neural network architectures and improves the performance of machine learning models. But they are computationally expensive and require large amounts of data to work effectively.

**Evolutionary Algorithms**

The Evolutionary Algorithms are a particular class of optimization algorithms inspired by the principle of Natural Evolution. They are often used to search for an optimal solution in Computer Science and Engineering.

It works by iteratively improving the solution using the genetics of natural selection. This is because there are so many different types of evolutionary algorithms, including genetic algorithms, genetic programming, evolutionary programming, and more.

Evolutionary Algorithms can be applied to many problems, such as function optimization, pattern recognition, and machine learning. In addition, they are well suited for complex problems that can be solved using traditional optimization techniques.

**Reinforcement Learning Algorithm:**

It is a special type of machine learning algorithm training an agent to make a sequence of decisions in a computational environment, with the goal of maximizing the reward signal.

The agent receives positive or negative rewards for its action and uses this feedback to study which actions can fetch more positive outcomes. It has four main components, namely, An agent, An environment, a set of actions, and a reward signal.

The agent needs to interact with the environment by taking action, and the environment responds by providing the agent with a reward signal and a new state.

The agent’s objective is to learn a policy that maximizes the expected reward over time. Reinforcement Learning Algorithms can be employed for a wide range of problems in Robotics, Control Systems, Games, and more. They are used to achieve the best results in complex environments. (Examples: Beating a human champion in board games such as Chess)

**The Gradient-Based Methods Algorithms**

It is an optimization algorithm that uses the gradient of a loss function to improve the performance of a machine-learning model iteratively.

The vector gradient that points in the direction of the greatest increase of the loss function can be used to update the Model’s parameters to reduce the loss. There are multiple gradient-based optimization algorithms employed in the Model.

They are such as stochastic gradient descent, mini-batch gradient descent, and batch gradient descent. However, these algorithms differ in terms of how they compute the gradients and update the model parameters.

The gradient-based method algorithms are efficient and easy to implement; therefore, they are widely used in machine learning. Furthermore, they can be applied to resolve a wide range of problems, such as supervised learning, unsupervised learning, and reinforcement learning.

**Data Preprocessing**

Data Preprocessing is an automated process of cleaning, reshaping, and preparing the data for machine learning. It includes the task of missing value imputation, feature selection, and feature engineering.

Further, it is the critical step in data science workflow. It is performed before building a machine learning model.

**Why is Data Preprocessing important?**

Generally, raw data is inconsistent, incomplete, and noisy. Therefore it is difficult to analyze or use to train a machine-learning model. The data Preprocessing helps to eliminate these issues.

Besides, some machine learning algorithms prefer data in a specific format or range. Data Preprocessing can help to transform the data into a suitable format and specified scale.

It reduces the complexity of the model data and improves the performance of the machine learning model.

The Data Preprocessing employs various techniques of preprocessing such as:

- Handling Missing Values
- Data Cleaning
- Data Transformation
- Data Aggregation

**Data Transformation:**

It is a process of converting data from one format to other. Typically its purpose is data integration, data cleansing, or data migration. It involves extracting data from the source, manipulating it, and applying a series of rules or transformations to it.

Then the transformed data is loaded into a database or into the target system. When the data is of large volume or coming from multiple sources with different formats and structures, then Data transformation will be a complex process.

The purpose of data transformation is to make the data more consistent, usable, and accurate. It can be integrated with other data sources or systems. It often utilizes the ETL rule (Extract, Transform and Load).

**Data Aggregation:**

Data Aggregation Refers to the process of collecting, combining, and organizing data from various sources in such a way it is more usable and easy to analyze.

It is one of the routine tasks in data management and can be accomplished using various techniques such as SQL Query, Data Warehousing, and Extract, Transform and Load procedures.

The objective of Data Aggregation is to provide a more comprehensive view of data, identify patterns and trends, and help the user in decision-making.

**Data Cleaning:**

Data Cleaning is the process of identifying and removing or correcting invalid records from the dataset. It ensures that the data is consistent and in a usable format. It is an important step in the data preparation process.

The data cleaning ensures that the data is reliable and accurate. Data cleaning imputing missing values using multiple techniques. It identifies and handles the outliers. It removes are replace the outliers with the reasonable value.

- Data Cleaning involves the following steps:
- Identifying and correcting the errors
- Handling the missing values
- Handling outliers
- Standardizing the Data Formats
- Removing Duplicates

On the whole, data cleaning is a crucial step in preparing the data for analysis or modeling for accuracy and reliability.

**Handling Missing Values**

The following strategies are used to handle the missing values in the data set.

Ignoring the rows or columns with missing values approach; It is best suited if the missing values are very small.

Removing the columns or rows with missing values approach is suitable if the missing values are concentrated in a few rows or columns.

In Imputing the missing values approach, replacing the missing values with estimates based on available data. The imputing missing value approach uses mean imputation, median imputation, and multiple imputations.

Using a machine learning model to predict the missing values based on the features in the dataset.

Using the data imputation library, the missing values can be imputed.

**How Does AutoML Work?**

Automated Machine Learning refers to the use of machine learning algorithms and techniques to automate the process of building, fine-tuning, and deploying machine learning models. AutoML is applied to a wide range of machine learning tasks, including image classification, natural language processing, and time series forecasting.

##### The AutoML process involves the following steps:

- Data preparation
- Model Selection
- Hyperparameter Tuning
- Model Training and Evaluation
- Model Deployment

The first process of machine learning is to prepare the data. Next, the data may need to be cleaned and preprocessed as well as split into training and testing sets.

With the prepared data, the next step is to select the Model are the machine learning algorithm to use. Again, a data scientist can do it manually or automatically using the AutoML system.

Once the Model has been selected, it is important to fine-tune the hyperparameters of the Model to get the best output. Though it is a time-consuming process, the AutoML systems can automate the process of parameter tuning by trying the different combinations of parameters to select the best-performing combination.

With the selected Model and the hyperparameters, the Model can be trained on the training data. The best-performing Model can then be evaluated on the testing data.

And the Data Scientist can check and generalize the Model with unseen data. If the Model performs well on the testing data, then it will be deployed to production; further, it can be used to make fresh predictions on the new data.

The ultimate goal of AutoML is to make the job of data scientists and practitioners job much easier by building machine learning models without the need for deep knowledge of machine learning algorithms and techniques.

## When to Use Automated Machine Learning?

The AutoML is particularly useful in the following situations:

When the user is inexperienced in automated machine learning, it is helpful. The autoML helps the non-experts to get started with and build models without the need for deep knowledge in machine learning algorithms and techniques.

When the practitioner has a large amount of data and wishes to build a model quickly, the autoML can help him to build a desired model easily by automating the steps such as hyperparameter tuning, etc. The AutoML helps the practitioner to build a model for a new task or data set. Further, it can provide a baseline model which can be fine-tuned to improve efficiency. Since it is an automated one, if you don’t have time and resources, the autoML itself can build a model from scratch.

Therefore, in various situations, automated machine learning is a helpful tool. But it is not a substitute for a deep understanding of machine learning algorithms and techniques. Sometimes, building a model from scratch using traditional machine learning methods is more effective than AutoML.

**Objectives or Targets of AutoML:**

The AutoML has different targets to optimize the Model. The targets of automated machine learning are the following:

- Model Accuracy
- Model Complexity
- Training Time for the Model
- Model Deployment Time
- Model performance on Particular subsets

Model accuracy is one of the common targets in the machine learning model. It needs to provide the highest possible accuracy on a particular task, such as natural language processing or image classification.

In some applications, the model complexity is desirable in building a model. That Model should be simple and easy to understand rather than highly accurate but complex. The autoML aim to optimize the model complexity; by building models that are easy to understand and interpret.

For some applications, model training time is more crucial. Therefore it is very much important to build a model as quickly as possible. Automated machine learning can optimize training time by building models that can be trained professionally or using the transfer of simple, small, and efficient techniques that can be deployed quickly.

In some applications, it is crucial to building a model that performs well on specific subsets of the data. The AutoML can optimize performance on specific subsets of the data by building models that are tailored to subsets.

### Automated Machine Learning involves the following:

- Data Cleaning
- Feature Selection
- Model Selection
- Parameter Selection

**Data Cleaning:**

Data Cleaning is a process of identifying and correcting or removing data inconsistencies. It is an essential step of the data preprocessing phase of autoML. The objective of data cleaning is to improve data quality for accurate analysis.

The Data cleaning process can remove the following errors and inconsistencies from the data:

- Missing Values
- Duplicate Records
- Formatting inconsistencies
- Outliers

The above said errors can be identified and addressed during the data cleaning process before the data is put for data analysis. Data cleaning combines manual and automatic techniques employed to find and fill in the missing values and correct other data errors.

**Feature Selection:**

It is a process of selecting a subset of the most relevant and useful features from a more extensive set of features when training a machine learning model. It is a crucial step in the model-building process. In addition, the feature selection can improve the model’s performance and reduce overfitting. Finally, feature selection makes the Model easier to interpret.

The following approaches are employed in Feature Selection.

- Filter Methods
- Wrapper Methods
- Embedded methods

The filter method uses statistical measures to evaluate the relevance of each feature and select the most relevant one. The wrapper method uses a search algorithm to select the subset of features that perform well on a selected model. Finally, the Embedded method performs feature selection as part of the model training process by learning its most essential features. It is a crucial step in the data preprocessing phase of any machine learning project.

Feature selection reduces the complexity of the Model and makes it easier to interpret and explain. It improves the generalization ability of the Model. Besides, it can reduce overfitting by eliminating noisy or irrelevant data. Further, it can speed up the training and prediction process.

**Model Selection:**

It is a process of selecting a more appropriate machine learning model for a particular task. Selection is based on the data’s characteristics and the application’s requirements. Therefore, it is a crucial step in the model-building process.

Many factors influence the selection of the right Model. They are:

- Task Nature
- Data Complexity and Size
- Available Resources
- Desired level of Interpretability

Different types of tasks need different types of models. For example, regression tasks need linear models and tree-based models best suited for classification tasks. The selection of the Model always depends on available computational resources.

The Model selection process involves evaluating the available models on a particular task and selecting the best-performing Model. Therefore model selection is a process in which the practitioner chooses the best machine learning model.

Selecting the right machine learning model on the following factors:

- The type of problem to be solved
- Type of the Complexity and Size of the data
- Available Resources

There are various Machine learning models available, and the practitioner needs to choose the right one.

They are:

- Linear Model
- Tree based Model
- Neural Model
- Support Vector Machines
- Ensemble Model

The right Model can be selected using a cross-validation technique.

**Parameter Selection:**

Parameter selection is also known as hyperparameter tuning. In this process, the practitioner selects the optimal values for his machine-learning model’s parameters. Parameters are nothing but the settings that control the model output. Therefore, they can significantly impact the overall performance of the Model.

There are several approaches to parameter selection. They are

- Manual Tuning
- Grid Search
- Random Search
- Bayesian Optimization

Let us further discuss in the second part of the post.