brainpy.analysis.SlowPointFinder
brainpy.analysis.SlowPointFinder#
- class brainpy.analysis.SlowPointFinder(f_cell, f_type=None, f_loss=None, verbose=True, args=(), inputs=None, t=None, dt=None, target_vars=None, excluded_vars=None, f_loss_batch=None, fun_inputs=None)[source]#
Find fixed/slow points by numerical optimization.
This class can help you:
optimize to find the closest fixed points / slow points
exclude any fixed points whose fixed point loss is above threshold
exclude any non-unique fixed points according to a tolerance
exclude any far-away “outlier” fixed points
- Parameters
f_cell (callable, function, DynamicalSystem) – The target of computing the recurrent units.
f_type (str) –
The system’s type: continuous system or discrete system.
’continuous’: continuous derivative function, denotes this is a continuous system, or
’discrete’: discrete update function, denotes this is a discrete system.
verbose (bool) – Whether output the optimization progress.
f_loss (callable) –
The loss function. - If
f_type
is “discrete”, the loss function must receive threearguments, i.e.,
loss(outputs, targets, axis)
.If
f_type
is “continuous”, the loss function must receive two arguments, i.e.,loss(outputs, axis)
.
New in version 2.2.0.
t (float) –
Parameter for
f_cell
is instance ofDynamicalSystem
. The time to evaluate the fixed points. Default is 0.New in version 2.2.0.
dt (float) –
Parameter for
f_cell
is instance ofDynamicalSystem
. The numerical integration step, which can be used when . The default is given by brainpy.math.get_dt().New in version 2.2.0.
inputs (sequence, callable) –
Parameter for
f_cell
is instance ofDynamicalSystem
. Same asinputs
inDSRunner
.New in version 2.2.0.
excluded_vars (sequence, dict) –
Parameter for
f_cell
is instance ofDynamicalSystem
. The excluded variables (can be a sequence of Variable instances). These variables will not be included for optimization of fixed points.New in version 2.2.0.
target_vars (dict) –
Parameter for
f_cell
is instance ofDynamicalSystem
. The target variables (can be a dict of Variable instances). These variables will be included for optimization of fixed points. The candidate points later provided should have same keys as intarget_vars
.New in version 2.2.0.
f_loss_batch (callable, function) –
Parameter for
f_cell
is instance ofDynamicalSystem
. The function to compute the loss.Deprecated since version 2.2.0: Has been removed. Please use
f_loss
to set different loss function.fun_inputs (callable) –
Deprecated since version 2.3.1: Will be removed since version 2.4.0.
- __init__(f_cell, f_type=None, f_loss=None, verbose=True, args=(), inputs=None, t=None, dt=None, target_vars=None, excluded_vars=None, f_loss_batch=None, fun_inputs=None)[source]#
Methods
__init__
(f_cell[, f_type, f_loss, verbose, ...])compute_jacobians
(points[, stack_dict_var, ...])Compute the Jacobian matrices at the points.
decompose_eigenvalues
(matrices[, sort_by, ...])Compute the eigenvalues of the matrices.
exclude_outliers
([tolerance])Exclude points whose closest neighbor is further than threshold.
filter_loss
([tolerance])Filter fixed points whose speed larger than a given tolerance.
find_fps_with_gd_method
(candidates[, ...])Optimize fixed points with gradient descent methods.
find_fps_with_opt_solver
(candidates[, ...])Optimize fixed points with nonlinear optimization solvers.
keep_unique
([tolerance])Filter unique fixed points by choosing a representative within tolerance.
Attributes
fixed_points
The final fixed points found.
losses
Losses of fixed points.
num_fps
- rtype
opt_losses
The optimization losses.
selected_ids
The selected ids of candidate points.