Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
model_object = SVC()

hyperparameters = {
"C":[1,10,20],
"kernel":["rbf","linear"]
}

grid = GridSearchCV(model_object,hyperparameters,cv=5,return_train_score=False)
grid.fit(x,y)

gridSearch_result = grid.cv_results_


Above I am trying to tune some hyperparameters using sklearn GridSearchCV() , and among's other parameter I am not getting what is the purpose of the parameter "cv".

I looked online and also in the documentation and it says "number of cross validations to perform" , but what does that mean ? I know K-Fold and other cross validation methods. Does cv means the value of K ?


What I have tried:

I tried looking online into other resources
Posted
Updated 15-May-22 2:02am

The documentation is the place to find the details: sklearn.model_selection.GridSearchCV — scikit-learn 0.24.1 documentation[^]
 
Share this answer
 
cross-validation: the score of each combination of parameters on the grid is computed by using an internal cross-validation procedure
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900