Main Content

predictObjectiveEvaluationTime

一連の点における目的関数の実行回数の予測

説明

time = predictObjectiveEvaluationTime(results,XTable) は、XTable 内の点における目的関数の推定評価回数を返します。

すべて折りたたむ

この例では、最適化された SVM 分類用のベイズ モデルにおける目的関数の評価回数を推定する方法を示します。

最適化された SVM モデルを作成します。このモデルの詳細については、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);

Figure contains an axes object. The axes object with title Objective function model, xlabel sigma, ylabel box contains 5 objects of type line, surface, contour. One or more of the lines displays its values using only markers 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, xlabel Function evaluations, ylabel Min objective contains 2 objects of type line. These objects represent Min observed objective, Estimated min objective.

さまざまな点における評価回数を予測します。

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.25999
    0.0001    1e+05    0.27678
     0.001    1e+05    0.24152
      0.01    1e+05    0.23432
       0.1    1e+05    0.18991
         1    1e+05    0.32159
        10    1e+05     1.2852
       100    1e+05    0.46865
      1000    1e+05    0.17883
     10000    1e+05    0.28235
     1e+05    1e+05    0.23559

入力引数

すべて折りたたむ

ベイズ最適化の結果。BayesianOptimization オブジェクトを指定します。

予測点。列数が D のテーブルを指定します。D は、問題に含まれている変数の個数です。これらの点で予測が実行されます。

データ型: table

出力引数

すべて折りたたむ

目的関数の推定評価回数。N1 列のベクトルとして返されます。NXTable の行数です。この推定値は、目的関数の評価回数に対応するガウス過程モデルの事後分布の平均です。

バージョン履歴

R2016b で導入