Skip to main content

Variance and Bias!

Ever wondered what bias and variance are and how they affect our Machine Learning models? I was on the lookout for the basic definition of Bias and Variance in the ML language. I stumbled upon a site that had a beautiful explanation, and this is what I learned about it.

Bias: Bias is the error that occurs when the model fails to meet the expectations. Say, I have trained a model, and while testing it, I need to measure the accuracy. While doing so, the prediction and testing data are used. When it predicts with an accuracy of 96%, the remaining 4% would be the bias error, error of bias, or simply bias. In order to decrease this error, we should probably introduce variance.

Variance: Variance is the spread of data around the mean point. We can see how it acts when the Machine Learning model changes or becomes sensitive to different datasets apart from the trained values or data.

Now, we need to remember that low bias and high variance can result in overfitting of the model, while the reverse could cause underfitting of the model.

In order to get the right form of the model, we need to use low bias and low variance. There is a method in ML to make this happen. It is called the bias-variance tradeoff. To use this method, we need a technique called Bias Variance Decomposition. Now, this can be used for both Regression as well as Classification models.


As an example taken from geeksforgeeks(.)org



Comments

Popular posts from this blog

How to Open Jupyter Lab in your favourite browser other than system default browser in Mac OS: A Step-by-Step Guide

Are you tired of Jupyter Lab opening in your default browser? Would you prefer to use Google Chrome or another browser of your choice? This guide will walk you through the process of configuring Jupyter Lab to open in your preferred browser, with a focus on using Google Chrome. The Challenge   Many tutorials suggest using the command prompt to modify Jupyter's configuration. However, this method often results in zsh errors and permission issues, even when the necessary permissions seem to be in place. This guide offers a more reliable solution that has proven successful for many users.   Step-by-Step Solution   1. Locate the Configuration File - Open Finder and navigate to your user folder (typically named after your username). - Use the keyboard shortcut Command + Shift + . (full stop) to reveal hidden folders. - Look for a hidden folder named .jupyter . - Within this folder, you'll find the jupyter_notebook_config.py file.   2. Edit the Configuration File - Open ...

Astype vs pd.to_datetime

Astype and pandas date time Ever wondered that we could be using date time conversion in python could lead us to two different methods that perform same job but little do we know that their real working principle. As we can see below that astype and pd.to_datetime are used for converting a column of dtype say from string or object to Datetime format. By doing so we can separate them for days, week, no of days or day of week by using .dt.dayofweek as an example.  astype Purpose:  General type conversion. Usage:  Converts a pandas object (like a DataFrame column) to a specified dtype. Example:  If you have a column of strings representing dates and you want to convert them to datetime objects, you can use  astype . df[ 'date_column' ] = df[ 'date_column' ].astype( 'datetime64[ns]' ) pd.to_datetime Purpose:  Specialized function for parsing date and time strings to datetime objects. Usage:  Converts argument to datetime, optionally with more control over ...

Understanding Large Language Models (LLMs): An Intermediate Guide – Part – 2

Intermediate Guide for LLMs At an intermediate level, we will go deeper into the inner workings of Large Language Models (LLMs), their structure, key components involved, how they are trained, and how they can be fine-tuned for specific tasks. Additionally, we will provide more hands-on examples with code, using advanced techniques like transfer learning and transformers. LLMs include GPT-3, BERT, T5, and GPT-2. These all fall within the broader category of the Transformer architecture. This architecture has revolutionized the area of natural language processing, or NLP. These models can deal with large quantities of text data, be context-sensitive, generate coherent responses, and even learn new languages and tasks without much extra training. Core Structure of LLMs: The Transformer Architecture The heart of modern LLMs is the Transformer architecture, introduced by Vaswani et al. in the paper "Attention is All You Need" in 2017. The Transformer model revolutionized ...