K-fold cross_val_Score

not able to get the ‘scoring’ parameter.
plz give me a detailed explaination

K-Fold CV is where a given data set is split into a K number of sections/folds where each fold is used as a testing set at some point. Lets take the scenario of 5-Fold cross validation(K=5). Here, the data set is split into 5 folds. In the first iteration, the first fold is used to test the model and the rest are used to train the model. In the second iteration, 2nd fold is used as the testing set while the rest serve as the training set. This process is repeated until each fold of the 5 folds have been used as the testing set.

Now, as we need to find the score which our model gives on a particular testing fold, we find this using the ‘score’ function. To obtain an estimation of how our model performs overall, we might take the mean of all such scores on the k different testing sets.

I hope this resolves your query.

cross_val_score(estimator, X, y=None,scoring=None)

actually my doubt was the ‘scoring’ parameter of this fn.
plz explain me this,for what it is used?

thanks!

The scoring parameter changes according to the kind of model we are training, for example if we are training a regression model we use R2 scoring to estimate our score while in case of classification we use ‘Accuracy’ metric. In the scoring parameter here you can pass a function which specifies the scoring criterion.

If None, the estimator’s score method is used which works well.

Side note, I hope you remember the formula of R2 score:
main-qimg-3db62a3bd0567bec0c4e4bcb8fb103ec

1 Like

I hope I was able to resolve your query here?

1 Like

Yes i got it
thank you

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like