In the previous session, we learned about machine learning concepts.
We also saw the different types of machine learning, classification and regression.
In this session, we will see how to measure the accuracy of a classification algorithm and regression
algorithm.
OK, what is accuracy?
I am predicting someone will get a disease.
Whether that person actually gets a disease or not is a measure of accuracy.
Right.
So I compare what I predicted and what happened in actual right.
That tells me about the level of accuracy.
We are going to measure that as we are developing the model itself.
So we get an idea of what is the kind of accuracy we can expect in our machine learning model based
on historical data.
OK, so how will you measure accuracy in a regression problem?
We use what is called R-squared.
OK, our squire is a condition of determination.
The it is actually a ratio, we're going to see that very shortly.
We also use one more metric.
It is known as mean absolute terror.
While our square is the ratio of the difference between actual versus predictable, mean absolute terror
tells the quantum of difference between actual versus.
So we will use both the coefficient and the absolute terror to assess how good the model is.
How would the fitment is OK, that is in a regression problem.
In a classification problem, we look at accuracy from the perspective of proof positive and negative.
And we compare that with all the possibilities that can happen that is too positive to negative, false
positive and false negative.
Right.
And other metrics that we use in a classification problem is what is known as a U.S. area under the
code.
This provides a range of values between zero and one, OK?
It also uses all the four possibilities and provides a value between zero and one.
If you see is closer to one, it means it is having a higher accuracy.
If it is closer to zero means the accuracy is low.
Right.
So now let's see.
This are square and you see a bit more in detail.
OK, R-squared, as I mentioned, is a ratio, OK.
It measures the residual sum of squares and the total sum of squares.
So why after that, you see here is actually the predicted one.
OK, a residual sum of squares actually is the difference between actual versus predictable.
Explain some of squares is predicted versus the average.
OK, so both I consider in the ratio using this formula.
OK, I will have what is known as R-squared.
If our squire is closer to one hundred percent on one, that means, you know, it's a great fitment.
If it is 80 percent, the fitment is good, 40 percent.
OK, I will say it is just below.
And for the zero means there is no correlation, OK.
Please note that R-squared can be negative also.
That means.
It is having a negative relationship instead of a positive relationship, you have a negative relationship
of R-squared negative that is very much possible, like somebody studies for more number of us.
Unfortunately, that student scores less number of marks.
That is the more number of other student studies, the less number of marks the student gets.
That is a case of negative correlation, right?
We don't want that, but we do have such scenarios in real life.
OK.
Now, let's see this U.S. OK area under the code, we use what is known as confusion matics, this is
nothing but the matrix of predicted versus actual, that is tabulation of positive to negative, false
positive and false negative.
OK, we've already seen the seen the explanation of false positive and false negative in the hypothesis
session.
OK, so the confusion matrix is used to construct the area under the code.
OK, as I mentioned earlier and you see closer to ones means high accuracy rate.
And the graph that you see here graphically shows how the area under the curve corresponds to a comparison
between true positive and true negative light.
As you can see here, the red is too negative.
Green is still positive.
If the area under the commerce clause that the one the overlap between two positive and negative is
loyal.
OK, as the area and the code comes down, the overlap increases, which means the accuracy also comes
down.
Right.
So are you are you understanding it if you have a regression problem, you will use?
Square, if it is a classification problem, you will use area under the right.
And you will use these values, right?
Is it closer to one or closer to zero?
And you think that you will determine how good the faith is, how good the accuracy's.