nrv.optim

Description

OPTIMIZATION methods - optim: automated optimization of any simulation parameter

optim has been designed to enable optimization or automated space search of parameters. Any simulation can be considered as a context for optimization. NRV has to simple descriptors for optimization of geometrical quantities as well as stimulation waveforms. However, there is no formal restriction and specific search space can be described by the used (even electrophysiological quantities or morphology).

The The optimization problem, defined in a Problem-class, couples a Cost_Function-object, which evaluates the cost of the problem based on user-specified outcomes, to an optimization method or algorithm embedded in a Optimizer-object (see below for access to class description).

The Cost_Function-class is constructed around 389 four main objects:

  • a filter: which is an optional Python callable-object, for vector formatting or space restriction of the optimization space,

  • a static context: it defines the starting point of the simulation model to be optimized. It can be any of the nmod-objects or more genenerally a NRV simulable-object,

  • a ContextModifier-object: it updates the static context according to the output of the optimization algorithm and the optimization space. The ContextModifier-object is an abstract class, and two daughter classes for specific optimization problems are currently predefined: for stimulus waveform or geometry optimization (see below in the class list). Novel form of user-defined optimization should be described in a custom class that inherits from ContextModifier,

  • a CostEvaluation-class, which is a generic Python callable-class, and that can also be user-defined.

Optimization methods and algorithms implemented in NRV rely on third-party optimization libraries:

  • SciPy optimize, that should be prefered for continuous problems,

  • Pyswarms for Particle Swarms Optimization metaheuristic in high-dimensional or discontinuous cases.

Subpackages

optim_utils

NeuRon Virtualizer, large scale modeling of Peripheral Nervous System with random stimulation waveforms optim utils submodule

Classes

Problem([cost_function, optimizer, ...])

Problem Class

Optimizer([method])

scipy_optimizer(method, x0, args, jac, hess, ...)

PSO_optimizer([n_particles, bounds, ...])

Perform a Particle swarm optimization (PSO) on with a defined cost function using pyswarms library[1]

cost_function([static_context, ...])

A class to define cost from position input vector

Functions

cost_function_swarm_from_particle(...)

Generate a cost function for a swarm from a cost function for a particle