The model fitting toolbox uses the package Playdoh, you can see the documentation here.
Model fitting function.
Fits a spiking neuron model to electrophysiological data (injected current and spikes).
See also the section Model fitting in the user manual.
Arguments
The refractory period in second. If it’s a single value, the same refractory will be used in all the simulations. If it’s a list or a tuple, the fitting will also optimize the refractory period (see **params below).
Warning: when using a refractory period, you can’t use a custom reset, only a fixed one.
The list of parameters to fit the model with. Each parameter must be set as follows: param_name=[bound_min, min, max, bound_max] where bound_min and bound_max are the boundaries, and min and max specify the interval from which the parameter values are uniformly sampled at the beginning of the optimization algorithm. If not using boundaries, set param_name=[min, max].
Also, you can add a fit parameter which is a spike delay for all spikes : add the special parameter delays in **params, for example modelfitting(..., delays=[-10*ms, 10*ms]).
You can also add fit the refractory period by specifying modelfitting(..., refractory=[-10*ms, 10*ms]).
Return values
Return an OptimizationResult object with the following attributes:
Also, the following syntax is possible with an OptimizationResult instance or. The key is either an optimizing parameter name for keyword-like fitness functions, or a dimension index for array-like fitness functions.
For more details on the gamma factor, see Jolivet et al. 2008, “A benchmark test for a quantitative assessment of simple neuron models”, J. Neurosci. Methods (available in PDF here).
Displays the results of an optimization in a table.
Arguments:
Start the Playdoh server.
Arguments:
Retrieves the spike times corresponding to the best parameters found by the modelfitting function.
Arguments
Returns
Predicts the gamma factor of a fitted model with respect to the data with a different input current.
Arguments
Returns
Particle Swarm Optimization algorithm. See the wikipedia entry on PSO.
Optimization parameters:
See the wikipedia entry on PSO for more details (note that they use c_1 and c_2 instead of cl and cg). Reasonable values are (.9, .5, 1.5), but experimentation with other values is a good idea.
Standard genetic algorithm. See the wikipedia entry on GA
If more than one worker is used, it works in an island topology, i.e. as a coarse - grained parallel genetic algorithms which assumes a population on each of the computer nodes and migration of individuals among the nodes.
Optimization parameters:
proportion (out of 1) of the entire population which will be kept for the next generation based on their best fitness.
func_xover = 'intermediate'
- func_xover specifies the function that performs the crossover.
- The following ones are available:
- intermediate: creates children by taking a random weighted average
of the parents. You can specify the weights by a single parameter, ratio_xover (which is 0.5 by default). The function creates the child from parent1 and parent2 using the following formula:
child = parent1 + rand * Ratio * ( parent2 - parent1)
- discrete_random: creates a random binary vector and selects the
genes where the vector is a 1 from the first parent, and the gene where the vector is a 0 from the second parent, and combines the genes to form the child.
one_point: chooses a random integer n between 1 and ndimensions and then selects vector entries numbered less than or equal to n from the first parent. It then Selects vector entries numbered greater than n from the second parent. Finally, it concatenates these entries to form a child vector.
- two_points: it selects two random integers m and n between 1 and
ndimensions. The function selects vector entries numbered less than or equal to m from the first parent. Then it selects vector entries numbered from m + 1 to n, inclusive, from the second parent. Then it selects vector entries numbered greater than n from the first parent. The algorithm then concatenates these genes to form a single gene.
heuristic: returns a child that lies on the line containing the two parents, a small distance away from the parent with the better fitness value in the direction away from the parent with the worse fitness value. You can specify how far the child is from the better parent by the parameter ratio_xover (which is 0.5 by default)
linear_combination: creates children that are linear combinations of the two parents with the parameter ratio_xover (which is 0.5 by default and should be between 0 and 1):
child = parent1 + Ratio * ( parent2 - parent1)For ratio_xover = 0.5 every child is an arithmetic mean of two parents.
func_mutation = 'gaussian'
This function define how the genetic algorithm makes small random changes in the individuals in the population to create mutation children. Mutation provides genetic diversity and enable the genetic algorithm to search a broader space. Different options are available:
gaussian: adds a random number taken from a Gaussian distribution with mean 0 to each entry of the parent vector.
The ‘scale_mutation’ parameter (0.8 by default) determines the standard deviation at the first generation by scale_mutation * (Xmax - Xmin) where Xmax and Xmin are the boundaries.
The ‘shrink_mutation’ parameter (0.2 by default) controls how the standard deviation shrinks as generations go by:
:math:`sigma_{i} = \sigma_{i-1}(1-shrink_{mutation} * i/maxiter)` at iteration i.uniform: The algorithm selects a fraction of the vector entries of an individual for mutation, where each entry has a probability mutation_rate (default is 0.1) of being mutated. In the second step, the algorithm replaces each selected entry by a random number selected uniformly from the range for that entry.
Covariance Matrix Adaptation Evolution Strategy algorithm See the wikipedia entry on CMAES and also the author’s website <http://www.lri.fr/~hansen/cmaesintro.html>`
Optimization parameters:
In the case of a bounded problem, there are two ways to handle the new generated points which fall outside the boundaries. (note for different groups case: this parameter can only have one value, i.e. every group will have the same value (the first of the list))
bound_strategy = 1. With this strategy, every point outside the domain is repaired, i.e. it is projected to its nearset possible value . In other words, components that are infeasible in are set to the (closest) boundary value in The fitness function on the repaired search points is evaluated and a penalty which depends on the distance to the repaired solution is added The repaired solution is disregarded afterwards.
bound_strategy = 2. With this strategy any infeasible solution x is resampled until it become feasible. It should be used only if the optimal solution is not close to the infeasible domain.
See p.28 of <http://www.lri.fr/~hansen/cmatutorial.pdf> for more details gamma:
gamma is the weight in the previously introduced penalty function. (note for different groups case: this parameter can only have one value, i.e. every group will have the same value (the first of the list))