predictObjectiveEvaluationTime
Predict objective function run times at a set of points
Description
Examples
This example shows how to estimate the objective function evaluation time in an optimized Bayesian model of SVM classification.
Create an optimized SVM model. For details of this model, see Optimize Cross-Validated Classifier Using bayesopt.
rng default grnpop = mvnrnd([1,0],eye(2),10); redpop = mvnrnd([0,1],eye(2),10); redpts = zeros(100,2); grnpts = redpts; for i = 1:100 grnpts(i,:) = mvnrnd(grnpop(randi(10),:),eye(2)*0.02); redpts(i,:) = mvnrnd(redpop(randi(10),:),eye(2)*0.02); end cdata = [grnpts;redpts]; grp = ones(200,1); grp(101:200) = -1; c = cvpartition(200,'KFold',10); sigma = optimizableVariable('sigma',[1e-5,1e5],'Transform','log'); box = optimizableVariable('box',[1e-5,1e5],'Transform','log'); minfn = @(z)kfoldLoss(fitcsvm(cdata,grp,'CVPartition',c,... 'KernelFunction','rbf','BoxConstraint',z.box,... 'KernelScale',z.sigma)); results = bayesopt(minfn,[sigma,box],'IsObjectiveDeterministic',true,... 'AcquisitionFunctionName','expected-improvement-plus','Verbose',0);
Predict the evaluation time for various points.
sigma = logspace(-5,5,11)'; box = 1e5*ones(size(sigma)); XTable = table(sigma,box); time = predictObjectiveEvaluationTime(results,XTable); [XTable,table(time)]
ans=11×3 table
sigma box time
______ _____ ________
1e-05 1e+05 0.12518
0.0001 1e+05 0.12326
0.001 1e+05 0.13033
0.01 1e+05 0.14974
0.1 1e+05 0.17054
1 1e+05 0.151
10 1e+05 0.70934
100 1e+05 0.37326
1000 1e+05 0.10351
10000 1e+05 0.085904
1e+05 1e+05 0.084705
Input Arguments
Bayesian optimization results, specified as a BayesianOptimization
object.
Prediction points, specified as a table with D columns, where D is the number of variables in the problem. The function performs its predictions on these points.
Data Types: table
Output Arguments
Estimated objective evaluation times, returned as an
N
-by-1
vector, where
N
is the number of rows of
XTable
. The estimated values are the means of the
posterior distribution of the Gaussian process model of the evaluation times
of the objective function.
Version History
Introduced in R2016b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)