MATLAB Answers

Why 'OptimizeH​yperparame​ters' in fitcknn doesn't provide the 3D plot as it says in the documentation?

12 ビュー (過去 30 日間)
marta prati
marta prati 2019 年 1 月 25 日
コメント済み: marta prati 2019 年 1 月 25 日
Dear all,
do you know how can I get the plot of the objective function model when I run a hyperparameters optimization with two hyperparameters (bayesian as default)?
It seems, from the documentation, that this plot should be generated automatically and indeed this happens if I use the data in the documentation example, but it doesn't with mine.
Thank you in advance,
Marta

  2 件のコメント

Alan Weiss
Alan Weiss 2019 年 1 月 25 日
We don't know what you did. Please show us your function call and option settings, and then maye we will be able to advise you.
Alan Weiss
MATLAB mathematical toolbox documentation
marta prati
marta prati 2019 年 1 月 25 日
Ok, sorry.
This is the code:
classificationKNN = fitcknn(predictors,response,'OptimizeHyperparameters','all',...
'HyperparameterOptimizationOptions',struct('Kfold',10,'AcquisitionFunctionName',...
'expected-improvement-per-second-plus','MaxObjectiveEvaluations',25));
The only plot I get is this: Capture2.PNG
While, I should get also this type of plot (from documentation):
Capture3.PNG
Thank you very much!
Marta

サインイン to comment.

回答 (1 件)

Alan Weiss
Alan Weiss 2019 年 1 月 25 日
Thanks for the information. As stated in the HyperparameterOptimizationOptions reference section, ".... If [you set the option to show plots to] true, this field plots the best objective function value against the iteration number. If there are one or two optimization parameters, and if Optimizer is 'bayesopt', then ShowPlots also plots a model of the objective function against the parameters."
In other words, since you are choosing to optimize all hyperparameters, and there are five hyperparameters, then there is no way to give the plot you want. You get that plot when you optimize just one or two hyperparameters.
Alan Weiss
MATLAB mathematical toolbox documentation

  1 件のコメント

marta prati
marta prati 2019 年 1 月 25 日
Thank you Alan,
I used also only two parameters,but I didn't realized the plot works only for bayesian optimizers.
Now I got it! Thank you again for your help!
Cheers,
Marta

サインイン to comment.

サインイン してこの質問に回答します。

製品


リリース

R2018b

Translated by