optimize Optimize action parameter by exhaustive function maximization.
OPTIMACT = optimize(DS, EVALFN, PARAMNAME, PARAMVALS)
returns an optimized prtAction object, with parameter
PARAMNAME set to the optimal value. DS must be a prtDataSet
object. EVALFN must be a function handle that returns a
scalar value that indicates a performance metric for the
prtAction object, for example a prtEval function. PARAMNAME
must be a string that indicates the parameter of the
prtAction that is to be optimized. PARAMVALS must be a
vector of possible values of the parameter at which
prtAction will be evaluated.
[OPTIMACT, PERF] = optimize(...) returns a vector of
performance values that correspond to each element of
PARAMVALS.
Example:
ds = prtDataGenBimodal; % Load a data set
knn = prtClassKnn; % Create a classifier
kVec = 3:5:50; % Create a vector of parameters to
% optimze over
% Optimize over the range of k values, using the area under
% the receiver operating curve as the evaluation metric.
% Validation is performed by a k-folds cross validation with
% 10 folds as specified by the call to prtEvalAuc.
[knnOptimize, percentCorrects] = knn.optimize(ds, @(class,ds)prtEvalAuc(class,ds,10), 'k',kVec);
plot(kVec, percentCorrects)
Help for prtRvUniform/optimize is inherited from superclass prtAction