Prof. Frenzel
11 min readOct 2, 2023
Bias-Variance Tradeoff in Predictive Modelling

Dear friends!

At its core, predictive modeling is about using historical data to make informed predictions about unknown or future events. Yet, it’s not as straightforward as feeding data into an algorithm and expecting accurate predictions. The intricacies lie in creating a model that accurately captures underlying patterns while avoiding potential pitfalls. In this article, we’ll explore the Bias-Variance Tradeoff, dissecting its role and offering guidance to balance it right in your modeling pursuits. Are you ready? Let’s go! 🚀

Why Bias and Variance Matter in Machine Learning?

Bias and variance provide insights into the prediction errors of a model. Using a target board analogy, if arrows (predictions) are clustered but away from the bull’s-eye, the model has bias. Scattered arrows indicate high variance. Ideally, arrows should be close to each other and the bull’s-eye.

Simply put, bias is the error due to overly simplistic assumptions in the learning algorithm, while variance is the error due to too much complexity in the learning algorithm. The relationship between bias and variance is not a linear one. As bias decreases, variance often increases, and vice versa — this is known as the bias-variance tradeoff. Balancing this tradeoff is fundamental for building models that perform well both on seen and unseen data. A model that fails to strike this balance may either overlook essential patterns (resulting in underfitting) or may be swayed by the noise in the data (resulting in overfitting).

Definition Model Bias

Bias refers to the error introduced by approximating real-world complexities with a too-simplistic model. Think of it as the difference between the average prediction of our model and the correct value we are trying to predict. A high bias model often results in missed opportunities, as it fails to capture the intricate patterns present in the data. Its predictions can consistently miss the mark, leading to systematic and repeated errors. For instance, in the context of sales predictions, a high bias model might constantly underestimate sales during peak seasons because it doesn’t account for seasonal patterns. Moreover, a biased model can lead to misinterpretation, as the reasons behind its predictions might not align with the true influences in the data.

Definition Model Variance

Variance represents the error introduced in the model due to its sensitivity to fluctuations or noise in the training data. A model with high variance is overly tailored to the training data, capturing not just the genuine patterns but also the random noise. Visually, if you were to fit a curve to a set of data points, high variance would lead the curve to zig-zag closely around each point, rather than providing a smooth generalized path.

Models with high variance perform exceedingly well on training data because they’ve tailored themselves closely to it. However, when exposed to new, unseen data, their performance can drop significantly. This is because the noise they’ve learned isn’t present in the new data, causing their predictions to be off-mark. In practical terms, an investment strategy based on a high variance model might do exceptionally well with historical data but fail miserably in real-time trading, as it might respond to market ‘noise’ rather than genuine opportunities.

The Bias-Variance Tradeoff

Consider the graph shown below, with the x-axis illustrating model complexity and the y-axis measuring error

The Bias-Variance Tradeoff

📌High Bias Error: At the leftmost part of the graph, with minimal model complexity, the error is high. Here, both training and testing errors are high (Underfitting Zone).

📌High Variance Error: As we move to the right, increasing model complexity, the error initially decreases, reaching an optimal point. But if we continue adding complexity, the error starts rising again. In this case, the training error is low, but the testing error is high (Overfitting Zone).

📌Optimal Point: There’s a sweet spot where the combined error (bias + variance) is the lowest, representing the optimal model complexity. This is where the bias-variance tradeoff is best balanced. This is the middle zone in the figure above.

The Irreducible Error

While bias and variance provide a comprehensive view of the model’s errors, there’s a third component — the irreducible error. This error is inherent in any prediction and is due to the unpredictability and randomness in the data itself.

Total Error = Bias² +Variance + Irreducible Error

Deep Learning and Double Descent

Deep learning models are inherently complex due to their numerous parameters. According to traditional understanding, they should be highly prone to overfitting (high variance). However, intriguingly, this isn’t always the case. The Double Descent” phenomenon has shown that after a certain point of increasing model complexity, test error can unexpectedly decrease again, defying the traditional U-shaped bias-variance tradeoff. This suggests that under certain conditions, making a model even more complex, beyond the size of the training data, can lead to better performance.

Belkin, M., et al. (2019). Reconciling modern machine learning practice and the bias-variance trade-off.

In practice, deep learning models have been shown to be able to achieve low bias and low variance even with high model complexity. This is especially true when there is a large amount of training data available. There are a few possible explanations for this phenomenon:

  • Deep learning algorithms can learn more complex patterns in the data than traditional machine learning algorithms. This is because deep learning algorithms have a hierarchical structure that allows them to learn from low-level features to high-level features. Traditional machine learning algorithms, on the other hand, are typically limited to learning from low-level features.
  • Deep learning models often employ various regularizations and techniques, like dropout, which also help in preventing overfitting. Regularization techniques penalize complex models, which helps to prevent them from overfitting the training data. Dropout is a regularization technique that randomly disables neurons during training, which helps to prevent the model from becoming too reliant on any particular set of neurons.
  • However, deep learning algorithms are also more computationally expensive to train and more difficult to interpret than traditional machine learning algorithms.

Causes & Indicators of High Bias and High Variance

High Bias (underfitting)

  • 📌Model is too Simple: One of the most common reasons for a model to exhibit high bias is its simplicity. For instance, if the data exhibits a quadratic trend and we try to fit a linear model, it will invariably miss capturing the relationship entirely. Such models lack the flexibility to capture the underlying nuances and patterns of the data.
  • 📌Not Capturing Relevant Patterns from the Data: High bias can also result from the omission of influential predictors or features from the model. For example, in predicting house prices, ignoring a critical factor like location or square footage will likely lead to a model that consistently misses the mark.

Indicators of High Bias

  • ⚠️Poor performance on both the training and test datasets: This is the most obvious indicator of high bias. If a model is not able to learn the relationships in the data, it will not be able to perform well on either the training or test datasets.
  • ⚠️Consistent underwhelming performance across different datasets: This can also be a sign of high bias. If a model consistently performs poorly on different datasets, it is likely that the model is not able to capture the underlying patterns in the data.
  • ⚠️Incorrect model assumptions: If the model makes incorrect assumptions about the data, it may not be able to learn the true relationships in the data. This can also lead to high bias.

High Variance (overfitting)

  • 📌Model is too Complex: Adhering to the principle of parsimony, while complexity can help capture intricate patterns, excessive complexity can lead to overfitting. Examples include high-degree polynomial regressions or deep neural networks without adequate regularization.
  • 📌Capturing Noise along with the Underlying Pattern: When a model is too attuned to the training data, it tends to mistake random noise for genuine patterns. This is particularly problematic in datasets with many features, where discerning signal from noise becomes challenging.

Indicators of High Variance

  • ⚠️High sensitivity to changes in the training data: A model with high variance is more likely to change its predictions significantly when the training data is changed slightly.
  • ⚠️Poor performance on cross-validation: Cross-validation is a technique used to evaluate a model’s performance on data that it has not seen before. If a model performs poorly on cross-validation, it is a sign that the model is overfitting the training data.
  • ⚠️Poor performance on test data: A model with high variance is more likely to perform poorly on new, unseen data.
  • ⚠️Model has a large number of parameters: Models with a large number of parameters are more likely to overfit the training data and have high variance.

Techniques to Address Bias and Variance

High Bias (underfitting)

  • Using more Complex Models: If a model is consistently underperforming due to high bias, consider moving to a more complex model. For instance, if linear regression isn’t capturing the data’s patterns effectively, polynomial regression or a decision tree might be better alternatives.
  • Incorporating more Features: Sometimes, the existing features in the dataset aren’t sufficient to capture its nuances. Incorporating more relevant features or constructing interaction terms between existing ones can enhance the model’s predictive capability. For example, in predicting house prices, an interaction term between house size and location might offer additional insights.
  • Reducing Regularization Strength: Regularization techniques, like L1 (Lasso) and L2 (Ridge), add penalties to the model to prevent overfitting. However, an overly strong regularization can push the model into the high bias zone. If using regularization, consider reducing its strength or tuning the regularization parameter.

High Variance (overfitting)

  • Gathering more Training Data: One of the most effective ways to combat high variance is by increasing the training dataset size. With more data, the model becomes less likely to overfit to noise or random fluctuations.
  • Feature Selection or Dimensionality Reduction: An abundance of features can sometimes be counterproductive, leading to models that overfit. Techniques like backward elimination, forward selection, or dimensionality reduction methods like Principal Component Analysis (PCA) can be employed to retain only the most influential features.
  • Introducing Regularization: Regularization methods add penalties to the model coefficients, preventing them from becoming too large and causing overfitting.
  • Using Ensemble Methods: Ensemble methods combine multiple models to achieve better performance. Bagging (e.g., Random Forest) involves creating multiple versions of a model and averaging their predictions. Boosting (e.g., Gradient Boosted Trees) builds models sequentially, with each new model addressing the mistakes of its predecessor.
  • Pruning Methods in Decision Trees: For decision tree models, deep trees can capture noise and overfit. Pruning techniques can be used to trim back the tree, removing branches that offer little predictive power and thus reducing variance.

Balancing Bias and Variance

The principle of model parsimony offers a structured approach to this balancing act. This principle is grounded in Occam’s razor, which posits that when two models offer similar predictive capabilities, the simpler one should be selected. Simpler models are generally more interpretable, less prone to overfitting, and tend to generalize better to unseen data. With model parsimony serving as our guide, let’s delve into the specific strategies that can help in achieving the right balance between bias and variance:

  • No one-size-fits-all and the need for iterative modeling: It’s tempting to search for a universal formula that will always produce the best-performing model. However, the diversity and complexity of data across different domains and applications mean that there isn’t a one-size-fits-all solution. Consequently, model building is often an iterative process. Initial models serve as starting points, and subsequent iterations refine them, informed by their performance metrics and domain-specific insights.
  • Domain Knowledge and Exploratory Data Analysis: Domain knowledge can be used to guide feature selection, data transformation, and the choice of modeling techniques. Exploratory data analysis can be used to gain valuable insights into the data before modeling begins. These insights can then be used to improve the modeling process and produce more accurate models.
  • Cross-validation on Unseen Data: One of the challenges in predictive modeling is ensuring that the model will generalize well to new, unseen data. Cross-validation, particularly k-fold cross-validation, is a tool designed to address this challenge. By splitting the data into ‘k’ subsets and iteratively training the model on ‘k-1’ of those while testing on the remaining subset, it provides a more robust estimate of how the model might perform on data outside the training set.

👣Case Study: Predicting Stock Prices

Predicting stock prices is a challenging task because there are many factors that can influence them. These factors range from company financials to broader economic indicators. As a result, it is difficult to develop a model that can accurately predict future stock prices.

Simple Linear Regression: For our first model, we consider a simple linear regression where the stock price of a company is predicted based solely on its earnings per share (EPS). While EPS is undoubtedly influential, relying on it alone can introduce bias. This model’s simplicity means it might not capture the multifaceted nature of stock prices. Consequently, this approach might lead to consistent errors in prediction, indicating high bias.

High-Degree Polynomial Regression: To increase complexity, a high-degree polynomial regression can be applied to the same EPS data. While this might capture some non-linear patterns in the EPS-stock price relationship, it can overcomplicate matters. The stock price is influenced by various factors, from economic data and sentiment to trading volume. By focusing excessively on a single feature’s nuances, the model risks overfitting to the training data’s noise, leading to high variance.

Integrating Multiple Features: Considering the complexities of stock price movements, it’s evident that a multifactorial approach might be more appropriate. Features such as economic indicators (e.g., GDP growth, interest rates), company fundamentals (e.g., debt ratios, revenue growth), market sentiment, and trading volume can all play pivotal roles.

Decision Trees without Pruning: Incorporating all these features, a decision tree can be constructed. Without any pruning, this tree might grow deep and complex, catering to every intricacy of the training data. While it may offer impressive accuracy on the training set, its performance on unseen data might be subpar due to overfitting.

Decision Trees with Pruning: By introducing pruning, branches of the tree that contribute little to predictive power can be removed, leading to a more generalized model. This model strikes a balance, ensuring it’s neither too simplistic nor too entangled in the training data’s specifics.

Evaluation Metrics and Visualizations: To assess the performance of these models, metrics such as Mean Absolute Error (MAE), Mean Squared Error (MSE), and R-squared can be employed. Visualizations, such as residual plots, can provide further insights into the models’ strengths and weaknesses.

Modeling is a balancing act. Too simple a model can miss the mark, while too complex a model can be fooled by new data. This is not just an academic concern; it can have real-world implications for businesses and individuals alike. For example, a poorly calibrated model could lead to missed sales or inaccurate medical diagnoses. By carefully balancing bias and variance, we can build models that are reliable, trustworthy, and actionable.

Prof. Frenzel

Data Scientist | Engineer - Professor | Entrepreneur - Investor | Finance - World Traveler