# Definition of Bias and Variance in classification problems

I was looking into a StatQuest video and he gave the meaning of bias and variance in regression problems Correct me if I’m wrong

1. Bias is the sum of squares error between the predicted and actual values In a data set, A low bias means the error is low, and it is accurately able to find the relationship between our x and y values ,
A high bias means our error is high, and it is unable to accurately find the relationship between our x and y values, this is known as under fitting, it goes very badly on training data and test Data

2.Variance is the sensitivity of our model to different data sets

A low variance model, our line of fits wouldn’t be affected much by change in data sets, meaning the difference in y values for the different data sets wouldn’t be much , he used the case of having similar sums of square errors, meaning accuracy is similar and consistent

A high variance model, our lines of fits change a lot, across data sets, meaning the y values are far apart for different data sets, he used the case of having vastly different sum of square errors, meaning accuracy across different data sets was inconsistent, this is known as over fitting, it goes well on training sets but very badly on data sets

My issue comes with classification problems, how can I be able to use this StatQuest definition to explain bias and variance in KNN and Decision trees

I appreciate all answers, and would like an easy one as I relatively new to this field

When you look at a learning problem (classification being an particular example), you search for a function $$\widehat f$$ such that $$\widehat{f}(X)=Y$$ where $$X$$ is the features variable and $$Y$$ is the answer (label) variable (the class in classification). Using $$\widehat f$$, you try to approximate some $$f^*$$ which is most of the time the minimize of some loss function, for example in classification this is $$f^* = \arg\min_f \mathbb{P}(f(X)\neq Y).$$ So in fact, you use $$\widehat f$$ as an estimator of $$f^*$$. As such, the bias is a notion of distance between $$\widehat f$$ and $$f^*$$. This could be the squared distance or something but in fact given the problem, the bias will be better understood as $$Bias = \mathbb{P}(\widehat f(X)\neq Y)-\mathbb{P}(f^*(X)\neq Y)$$. This is a sort of approximation error. Here you have to understand that the larger the set $$\mathcal{F}$$ of function from which you choose $$\widehat f$$, the smaller it is. For example, in decision trees, if your tree is very deep then it is easier to approximate $$f^*$$.

Now, for the variance this is a bit more complex because in classification, the variance as you call it must also take into account the complexity of the set $$\mathcal{F}$$, for example you could define it with $$\sup_{f\in \mathcal{F}}Var(f(X))$$ but in fact there are better way to do this (see Rademacher complexity or VC dimension, but this is complex and outside the scope of this post). To give the idea, just think that the variance term will get larger and larger the more complex $$\mathcal{F}$$ is, it is linked to the fact that it is difficult to find a function in $$\mathcal{F}$$ if $$\mathcal{F}$$ is huge.

This is the reason why choosing for example the depth of a decision tree, or the number of nearest neighbors in KNN, is a bias/variance tradeoff.

• You really complicated this answer tbh 😂, I said I was new to the field, and your notations are confusing, thank you though , I’ll wait for an easier answer Sep 3, 2020 at 16:02
• The only notations I used are probability, variance and supremum. If you really don't know what this is, I think you can search wikipedia to have your answer.
– TMat
Sep 3, 2020 at 16:07
• For example the argmin formula seems wrong to me, isn’t it argmin (f(x) -y) not equals to, that is the Function approximation that gives the lowest loss Sep 3, 2020 at 16:08
• no the argmin is good, you want to search for a function that minimize the probability of making a mistake. In classification, f and y have value either 0 or 1. You use f(x)-y in regression.
– TMat
Sep 3, 2020 at 16:10
• Can you refer me to the reference for the bias and variance in classification? Sep 3, 2020 at 16:11