Whenever the Python API requires a dictionary, we use a MATLAB struct. As MATLAB has no keyword
arguments, we use varargs with the convention of <name>, <value>. Please refer to each
function’s help for details on how to use it.

Warning

Since MATLAB does not have keyword arguments, every objective function you define
should accept a single struct argument, whose fields represent hyperparameters.

If MATLAB hangs while using Optunity there is a communication issue. This should not occur,
if you encounter this please file an issue at https://github.com/claesenm/optunity/issues/new. Currently the only way out of this is to kill MATLAB.

The MATLAB version has an extra argument constraints where you can specify domain constraints
(the MATLAB wrapper has no equivalent of optunity.wrap_constraints()). Constraints are
communicated as a struct with the correct field names and corresponding values (more info at Domain constraints).

As an example, to add constraints \(x < 3\) and \(y \geq 0\), we use the following code:

constraints=struct('ub_o',struct('x',3),'lb_c',struct('y',0));

Information about the solvers can be obtained at Solver overview. To learn about the specific parameter names
for each solver, check out the optunity.solvers.

Cross-validation folds are returned as a matrix of num_instances * num_iter with entries ranging from 1 to num_folds to indicate
the fold each instance belongs to per iteration.

optunity.cross_validate() requires a function handle as its first argument. This is the function that will be decorated, which
must have the following first arguments: x_train and x_test (if unsupervised) or x_train, y_train, x_test, y_test.

As an example, assume we have a function optunity_cv_fun(x_train, x_test, pars):