SigOpt MATLAB Toolbox
You can use our SigOpt Toolbox to call API endpoints.
The SigOpt MATLAB library is a custom toolbox by SigOpt. Follow the installation instructions on GitHub.
Find your SigOpt API token on the API tokens page.
Run Some Code
Now, you can run SigOpt's Optimization Loop.
First, setup the experiment:
import sigopt.Connection
conn = Connection(SIGOPT_API_TOKEN);
% Create your experiment
experiment = conn.experiments().create(struct( ...
'name', 'Franke Optimization (MATLAB)', ...
'project', 'sigopt-examples', ...
% Define which parameters you would like to tune
'parameters', [ ...
struct( ...
'name', 'x', ...
'type', 'double', ...
'bounds', struct( ...
'min', 0, ...
'max', 1 ...
) ...
), ...
struct( ...
'name', 'y', ...
'type', 'double', ...
'bounds', struct( ...
'min', 0, ...
'max', 1 ...
) ...
) ...
], ...
'metrics': [ ...
struct( ...
'name', 'function_value', ...
), ...
], ...
'parallel_bandwidth', 1, ...
% Define an Observation Budget for your experiment
'observation_budget', 30 ...
))
experiment_id = experiment.id;
Then, run the optimization loop itself:
% Run the Optimization Loop until the Observation Budget is exhausted
while experiment.progress.observation_count < experiment.observation_budget:
% Receive a suggestion
suggestion = conn.experiments(experiment.id).suggestions().create()
% Evaluate your metric
assignments = suggestion.assignments;
value = objective_function(assignments.x, assignments.y)
% Report an observation
observation = conn.experiments(experiment.id).observations().create(struct( ...
'suggestion', suggestion.id, ...
'value', value ...
))
% Update the experiment object
experiment = conn.experiments(experiment.id).fetch()
end