NameError Traceback (most recent call last) C:\Users\VAISHN~1\AppData\Local\Temp/ipykernel_6520/2922578464.py in 3 'kernel': ['rbf']} 4 ----> 5 optimal_params=GridSearchCV( 6 SVC(), 7 param_grid,
NameError: name 'GridSearchCV' is not defined
Here is my code:
param_grid={'C': [0.5,1,10,100],
'gamma': ['scale',1,0.1,0.001,0.0001],
'kernel': ['rbf']}
optimal_params=GridSearchCV(
SVC(),
param_grid,
cv=5,
scoring='accuracy',
verbose=0
)
optimal_params.fit(X_train_scaled,y_train)
print(optimal_params.best_params_)
There could be 3 reasons on why this is happening:
python -m pip install --upgrade pip
pip install -U scikit-learn
from sklearn.model_selection import GridSearchCV
UPDATE
pip install --upgrade scikit-learn