Я пытаюсь найти лучшую оценку в SV C Модель с использованием GridSearchCV, Вот мой код и вывод
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
param_grid = {'C': [5e3,1e3, 1e4, 5e4, 1e5], 'gamma': [0.0005, 0.0001, 0.001, 0.005, 0.01, 0.1]}
clf = GridSearchCV(SVC(kernel='rbf', class_weight='balanced', probability=True), param_grid)
clf = clf.fit(emb_array, label)
print("Best estimator found by grid search:")
print(clf.best_estimator_)
Вывод
Best estimator found by grid search:
SVC(C=5000.0, cache_size=200, class_weight='balanced', coef0=0.0,
decision_function_shape='ovr', degree=3, gamma=0.0005, kernel='rbf',
max_iter=-1, probability=True, random_state=None, shrinking=True, tol=0.001,
verbose=False)
Если я изменю param_grid
на
param_grid = {'C': [1e3, 5e3, 1e4, 5e4, 1e5], 'gamma': [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.1]}
, то выдаст
Best estimator found by grid search:
SVC(C=1000.0, cache_size=200, class_weight='balanced', coef0=0.0,
decision_function_shape='ovr', degree=3, gamma=0.0001, kernel='rbf',
max_iter=-1, probability=True, random_state=None, shrinking=True, tol=0.001,
verbose=False)
Если он принимает только первые аргументы в качестве best_estimator_
лучше тогда какая польза от GridSearchCV
?