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 ...

Understanding Large Language Models (LLMs): A Simple Guide – Part – 1

What is a Large Language Model (LLM)? Imagine you have a robot friend who knows a lot about everything—like books, stories, facts, and even jokes. You can ask this robot questions or give it commands, and it will answer you in a way that sounds like a real person talking! This robot is powered by something called a Large Language Model (LLM). Large Language Models (LLMs) are a type of artificial intelligence (AI) that can understand, generate, and respond to human language. They are powered by deep learning, which is a branch of machine learning that mimics how the human brain works. Essentially, LLMs "learn" from large datasets, like books, articles, and websites, to generate text that makes sense. LLMs are super-smart computers that learn from tons of books, websites, and information to understand language (like Kannada, English, Hindi, and more) and help people with tasks. They can write essays, answer questions, translate languages, or even have fun conversations! Y...

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 ...