Effacer les filtres
Effacer les filtres

How to use Grid search to find the optimal hyperparameters ?

38 vues (au cours des 30 derniers jours)
Yooya yooya
Yooya yooya le 6 Déc 2020
% Train the classifier
knn = ClassificationKNN.fit(Xtrain,Ytrain,'Distance','seuclidean');

Réponses (1)

Mohith Kulkarni
Mohith Kulkarni le 9 Déc 2020
Modifié(e) : Mohith Kulkarni le 11 Déc 2020
Use the 'OptimizeHyperparameters' Name-Value pair argument to specify the Parameters to optimize when creating the 'ClassificationKNN' model using 'fitcknn'. Use the 'HyperparameterOptimizationOptions' to specify the Optimizer for the model. Refer the code below.
Mdl = fitcknn(X,Y,'OptimizeHyperparameters','auto',...
'HyperparameterOptimizationOptions',...
struct('Optimizer','gridsearch'))
You can use this model for fitting the data with the specified optimization options.
Refer the documention of fitcknn and ClassificationKNN for more information on the Name-Value pair arguments.

Catégories

En savoir plus sur Problem-Based Optimization Setup dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by