+ 3
Machine learning
When we want to score a model, we use '.score(x, y) But for others like recall, precision, we use ('actual y', 'predicted y') Why's it like that? Edit... The actual question should have been when trying to get the accuracy... We use LogisticRegression.score(x,y), but for others like recall, precision, it's (y_test, y_pred). Why's the accuracy (x, y) and every other(y, y)
7 Respostas
+ 2
Ridwan Tiamiyu see.. while using logistic regression and after trying to calculate . lg.score(x_train, y_train) it's actually calculating the training accuracy and when we try to calculate the accuracy by passing x_test, y_test then it gives testing accuracy..
and the main thing is.. logistic regression's score method internally calls accuracy_score() or implements the same code itself so... if you will call
lg.score(xtest, y_test)
or
accuracy_score(ytest, lg.predict(xtest)) both will give same results...
I hope it's clear now...
+ 2
part 2
and incase of a spam filtration... one don't want to miss the important emails even if extra spam comes.. no problem so our aim is to decrease the false positive values which and fp is in dinominator of precision so precision is used.... and if you want to check for both qualities... f1 score is used....
coming back to your question of score(x, y)... i am not pretty sure about exact function you are asking.. but yes.. in most of models I saw... we really need predicted and actual values... to evaluate a model... you will need to know the actual y values and the predicted y values to check if our brain trained is rightly trained and not learning nonsense stuffs... and x is supplied as the input on which model performs calculations to predict y values... in some styles.. test set is supplied during training itself (happens for large data) but here also.. test set is needed separately... as our main aim is to see how our brain works for unseen data.. hope it was somewhat useful (^ _ ^)
+ 2
Thank you very much bhomic kaushik, I understand those... The actual question should have been when trying to get the accuracy... We use LogisticRegression.score(x,y), but for others like recall, precision, it's (y_test, y_pred).
+ 2
It is now, many thanks!!!
+ 1
part 1
Ridwan Tiamiyu
from a little I know.... recall and precision are used because of the different situations in which you might want to focus on different aspects of evaluating a model... for example... when your class distribution in training data is uniform that is... you have 50 from one class and 50 from other class then you can rely just on accuracy.. and when it's not the case then you will think of recall or precision or the other ones...
for example in cases where you have life and death situation and a model predicts that whether a person is having cancer or not.. so a wrong prediction of no cancer can cause a person to die... in this case it's better to predict an extra of yes of cancer so that person will go to doctor and will get extra checkup.. no harm here... means focus is on decreasing the fale negative values... so recall must be used..
+ 1
no issues at all... love to help 🍨🍧🍧🍩🍨🎂🍨🍩
0
Machine Learning is one of the most wanted courses today
Along with Salesforce CRM together can do wonders
We can get effective and efficient services from both of these 2 courses
ML discuss how to attain user interest and kill other competitors
Salesforce discuss B2B and B2C