Main Content

predictObjectiveEvaluationTime

Predict objective function run times at a set of points

Description

example

time= predictObjectiveEvaluationTime(results,XTable)returns estimated objective evaluation times at the points inXTable.

Examples

collapse all

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, seeOptimize Cross-Validated Classifier Using bayesopt.

rngdefaultgrnpop = mvnrnd([1,0],eye(2),10); redpop = mvnrnd([0,1],eye(2),10); redpts = zeros(100,2); grnpts = redpts;fori = 1:100 grnpts(i,:) = mvnrnd(grnpop(randi(10),:),eye(2)*0.02); redpts(i,:) = mvnrnd(redpop(randi(10),:),eye(2)*0.02);endcdata = [grnpts;redpts]; grp = ones(200,1); grp(101:200) = -1; c = cvpartition(200,'KFold',10); sigma = optimizableVariable('sigma',[1e-5,1e5],'Transform','log');盒=optimizableVariable('box',[1e-5,1e5],'Transform','log');minfn = @ (z) kfoldLoss (fitcsvm (grp cdata,'CVPartition',c,...'KernelFunction','rbf','BoxConstraint',z.box,...'KernelScale',z.sigma)); results = bayesopt(minfn,[sigma,box],'IsObjectiveDeterministic',true,...'AcquisitionFunctionName',“expected-improvement-plus','Verbose',0);

Figure contains an axes object. The axes object with title Objective function model contains 5 objects of type line, surface, contour. These objects represent Observed points, Model mean, Next point, Model minimum feasible.

Figure contains an axes object. The axes object with title Min objective vs. Number of function evaluations contains 2 objects of type line. These objects represent Min observed objective, Estimated min objective.

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 tablesigma box time ______ _____ _______ 1e-05 1e+05 0.31605 0.0001 1e+05 0.26247 0.001 1e+05 0.29164 0.01 1e+05 0.31832 0.1 1e+05 0.3538 1 1e+05 0.35841 10 1e+05 1.0122 100 1e+05 0.55504 1000 1e+05 0.29488 10000 1e+05 0.32342 1e+05 1e+05 0.26287

Input Arguments

collapse all

Bayesian optimization results, specified as aBayesianOptimizationobject.

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

collapse all

Estimated objective evaluation times, returned as anN-by-1vector, whereNis the number of rows ofXTable. 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