• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    MATLAB
  • License
    GNU General Publi...
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Visualize optimization algorithms in MATLAB.

OptimViz - Optimizer visualization demo for MATLAB

This demo visualizes several MATLAB derivative-free optimizers at work on standard test functions. This is purely for demonstration purposes. For a proper benchmark of different MATLAB optimizers, see [1].

Follow me on Twitter for updates about other projects I am involved with, or drop me an email at [email protected] to talk about computational modeling, optimization, and (approximate) Bayesian inference.

I have been giving seminars and tutorials on optimization, model fitting, and model comparison around the world (see here). If you are interested in this research, find more on my group webpage at the Department of Computer Science of the University of Helsinki, Finland.

Optimizers

The optimization algorithms visualized here are:

  • BADS (Bayesian adaptive direct search), a novel algorithm that combines a direct search approach with local Bayesian optimization (link);
  • fminsearch (Nelder-Mead), the standard simplex method for nonlinear optimization;
  • fmincon, a powerful method for constrained optimization based on numerical approximation of the gradient;
  • ga (genetic algorithms), a heuristic population-based method for global optimization;
  • MCS (Multi-level coordinate search), an advanced method for global optimization (link);
  • CMA-ES (Covariance matrix adaptation - evolution strategies), a state-of-the-art method for nonconvex optimization (link).

Examples

We see here an example on the Rosenbrock banana function:

demo_opt

We see how the algorithms react to noise, by adding unit Gaussian noise at each function evaluation:

demo_opt

We see here another noiseless example on the Ackley function:

demo_opt

Comments

  • BADS works well on these examples, which were chosen to show how different algorithms explore the space. More generally, BADS is best for functions with a noisy or jagged landscape, and with non-negligible computational cost (see here). BADS is available as a ready-to-use MATLAB toolbox here.
  • fminsearch is a generic optimizer which can deal with simple functions, but it should never be the main choice as there are always better alternatives.
  • fmincon is generally superior to most optimizers (and in partcular, to fminsearch) on smooth functions. However, fmincon deals very badly with jagged or noisy landscapes.
  • We are not aware of scenarios in which ga is a good off-the-shelf choice for continuous-valued optimization. It is often just barely better than random search.
  • MCS can be a great optimizer, but it is somewhat idiosyncratic (it might converge very quickly to a solution).
  • CMA-ES, despite the poor performance shown here, is a good optimizer if allowed a very large number of function evaluations.

Code

These animated gifs can be generated via the optimviz.m function. You can easily test different optimizers and add other functions.

The generated animated gifs are uncompressed. We recommend to compress them before using them in any form (e.g., via some online tool).

To run some of these algorithms you will need MATLAB's Optimization Toolbox and Global Optimization Toolbox.

References

For more details about the benchmark comparing different MATLAB optimizers on artificial and real applied problems (fitting of computational models), see the following reference:

  1. Acerbi, L. & Ma, W. J. (2017). Practical Bayesian Optimization for Model Fitting with Bayesian Adaptive Direct Search. In Advances in Neural Information Processing Systems 30, pages 1834-1844. (link, arXiv preprint)

For more info about my work in machine learning and computational neuroscience, follow me on Twitter: https://twitter.com/AcerbiLuigi

License

OptimViz is released under the terms of the GNU General Public License v3.0.

More Repositories

1

bamb2022-model-fitting

Tutorials on statistical model fitting (optimization, Bayesian inference) for Day 2 of BAMB! 2022.
MATLAB
23
star
2

workshop-nyu-2019

Introductory workshop to modeling and model fitting in cognitive and computational neuroscience
MATLAB
15
star
3

vbgmm

Variational Gaussian mixture model for MATLAB.
MATLAB
11
star
4

workshop-bristol-2019

Introductory workshop to modeling and model fitting in psychophysics and neuroscience
MATLAB
11
star
5

psybayes

Bayesian adaptive stimulus placement of psychometric function for MATLAB.
MATLAB
9
star
6

visvest-causinf

Bayesian comparison of causal inference strategies in multisensory heading perception
MATLAB
7
star
7

infbench

Benchmark of posterior and model inference algorithms for (moderately) expensive likelihoods.
MATLAB
6
star
8

bads

Bayesian Adaptive Direct Search (BADS) optimization algorithm for model fitting in MATLAB (old location)
5
star
9

ChangeProb

Human Online Adaptation to Changes in Prior Probability
MATLAB
5
star
10

lautils-mat

Luigi Acerbi's utility functions for MATLAB.
MATLAB
5
star
11

neurobench

Benchmark of derivative-free optimization algorithms applied to models in cognitive and neural science.
MATLAB
5
star
12

eissample

Ensemble (inversion) slice sampling: a robust, self-tuning MCMC method for posterior inference.
MATLAB
4
star
13

tics-2020-tutorial

Tutorial on computational modeling and statistical model fitting part of the *Trends in Computational Neuroscience* graduate course of the University of Geneva (2020).
Jupyter Notebook
4
star
14

mexxer

Template/interface generator for C code from MATLAB functions.
MATLAB
3
star
15

gmm1

1-D Gaussian mixture model toolbox for MATLAB.
MATLAB
3
star
16

multiESS

Multivariate effective sample size (mESS) of Markov chain in MATLAB.
MATLAB
3
star
17

padova2022-bayes

Tutorial on Bayesian model fitting with PyVBMC.
Jupyter Notebook
2
star
18

marglike

Computation of the marginal likelihood from MCMC output
2
star
19

gofit

Compute absolute goodness of fit via entropy estimation
MATLAB
2
star
20

nyu2023-bayes

Tutorial on Bayesian model fitting with (Py)VBMC.
Jupyter Notebook
2
star
21

ModelWork

MATLAB suite for model building and model fitting.
MATLAB
2
star
22

vbmc

Variational Bayesian Monte Carlo (VBMC) algorithm for posterior and model inference in MATLAB (old location)
2
star
23

ibl-2020-tutorial

Tutorial on computational modeling and statistical model fitting part of the IBL Computational Neuroscience course (2020).
Jupyter Notebook
1
star
24

gplite

Lite Gaussian process regression toolbox
MATLAB
1
star
25

cosmo-2017-tutorial

Tutorial on optimization and model fitting held at the CoSMo 2017 summer school.
MATLAB
1
star
26

intro-modeling-psych-2018

Materials for an intro workshop to modeling and model fitting in psychophysics and neuroscience
MATLAB
1
star
27

bayescausinf-models

Models of visuo-vestibular Bayesian causal inference
MATLAB
1
star
28

cosmo-2018-tutorial

Tutorial on optimization and model fitting held at the CoSMo 2018 summer school.
MATLAB
1
star
29

compstats-files

Repository of utility files for the Computational Statistics course.
1
star