The essential parameters to modify while training a model are variance and bias in the machine learning environment.

When we talk about prediction models, we can break down prediction mistakes into two categories: error due to bias and error due to variance.

**The tension between the error introduced by bias and the error created by variation is known as the****bias-variance trade-off**

It’s critical to comprehend prediction errors whenever we talk about model prediction (bias and variance). The capacity of a model to minimize bias and variance is a tradeoff. Gaining a thorough grasp of these flaws will aid us in not only building correct models but also avoiding overfitting and underfitting errors.

## Bias

The difference between a model’s predictions and the true values is known as a bias error. In this form of error, the model ignores the training data, oversimplifies the model, and fails to recognize patterns. Because it does not take into consideration all of the features, the model learns the incorrect relationships.

**The gap between our model’s average prediction and the correct value we’re aiming to forecast is known as bias**

The model with a large bias pays little attention to the training data and oversimplifies it. It always results in a high level of inaccuracy on both training and test data.

## The Variance

Model prediction variability for a given data point or value that indicates the spread of our data. In this form of error, the model focuses so much on the training data that it memorizes it rather than learning from it. A model with a high error of variance is unable to generalize to data it has never seen before.

**The variability of model prediction for a specific data point or value, which tells us about the dispersion of our data, is known as the varianceÂ**

A high variance model pays close attention to training data and does not generalize to data it hasn’t seen before. As a result, while such models perform well on training data, they have high error rates on testing data.

## Bias-variance Tradeoff

Given the input data, the goal of the supervised ML algorithm is to optimally predict the f function (mapping) for the Y variable (output) with the X dataÂ (input). Because it is the function that a given supervised machine learning algorithm seeks to mimic, the mapping function is also known as the target function.

Underfitting occurs in supervised learning when a model is unable to grasp the underlying pattern of the data. These models are characterized by a low variance and large bias. It occurs when there is insufficient data to develop an appropriate model or while attempting to develop a linear model with nonlinear data.

In addition, certain types of models, such as linear and logistic regression, are particularly straightforward to use in capturing complicated patterns in data.

Overfitting occurs in supervised learning when our model catches both the noise and the underlying pattern in data. When we train our model across a large number of noisy datasets, something happens. These models have a large variance and a low bias. These models are extremely complicated and prone to overfitting.

**Bias vs Variance****â†’ Underfitting model vs Overfitting model**

Our model may have low variance and on other hand high bias if it is too simplistic and contains only a few parameters. If our model contains a large number of parameters, however, it will have high variance and low bias. So, without overfitting or underfitting the data, we must find the right/good balance.

It’s impossible for an algorithm to be both more complex and less complex at the same time.

**To construct a good model, we must strike a balanced****tradeoff between bias and variance****that minimizes overall error**

The model would never underfit or overfit if the variance and bias were perfectly balanced.

As a result, grasping the concept of bias and variance tradeoff is essential for comprehending prediction model behavior.

## Summary

The model’s simplifying assumptions simplify the target function, making it easier to estimate.

Variance refers to how much the target function’s estimate will fluctuate as a result of varied training data.

The tension between the bias-induced error and the variance is known as a trade-off.