How to use Grid search to find the optimal hyperparameters ?
73 ビュー (過去 30 日間)
古いコメントを表示
% Train the classifier
knn = ClassificationKNN.fit(Xtrain,Ytrain,'Distance','seuclidean');
0 件のコメント
回答 (1 件)
Mohith Kulkarni
2020 年 12 月 9 日
編集済み: Mohith Kulkarni
2020 年 12 月 11 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!