How to use Grid search to find the optimal hyperparameters ?
조회 수: 47 (최근 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!