elman_fp_finder¶
- class mrnntorch.analysis.fixed_points.elman_fp_finder.emFixedPointFinder(rnn: ElmanmRNN, lr_init: float = 0.0001, lr_patience: float = 5, lr_factor: float = 0.95, lr_cooldown: float = 0, tol_q: float = 1e-12, tol_dq: float = 1e-20, max_iters: int = 5000, do_rerun_q_outliers: bool = False, outlier_q_scale: float = 10.0, do_exclude_distance_outliers: bool = True, outlier_distance_scale: float = 10.0, tol_unique: float = 0.001, max_n_unique: int = inf, dtype: str = 'float32', random_seed: int = 0, verbose: bool = True, super_verbose: bool = False, n_iters_per_print_update: int = 100)[source]¶
Bases:
FixedPointFinderBase[ElmanmRNN]Fixed-point finder specialized for
ElmanmRNNdynamics.- classmethod default_hps()[source]¶
Returns a deep copy of the default hyperparameters dict.
The deep copy protects against external updates to the defaults, which in turn protects against unintended interactions with the hashing done by the Hyperparameters class.
- Args:
None.
- Returns:
dict of hyperparameters.
- find_fixed_points(initial_states: Tensor, ext_inputs: Tensor, *args, stim_inp: Tensor | None = None, W_rec: Tensor | None = None, n_rounds_q_opt: int = 1) tuple[FixedPointCollection, FixedPointCollection][source]¶
Finds RNN fixed points and the Jacobians at the fixed points.
- Args:
initial_states: Tensor specifying the initial states of the RNN, from which the optimization will search for fixed points.
ext_inputs: external inputs to the RNN
stim_inp: Additional stimulus input to the network
W_rec: Fixed weight matrix to replace self.mrnn.W_rec in forward pass
W_rec: Fixed weight matrix to replace self.mrnn.W_inp in forward pass
n_rounds_q_opt: Number of rounds to run extra iterations on q outliers
- Returns:
unique_fps: A FixedPoints object containing the set of unique fixed points after optimizing from all initial_states. Two fixed points are considered unique if all absolute element-wise differences are less than tol_unique AND the corresponding inputs are unique following the same criteria. See FixedPoints.py for additional detail.
all_fps: A FixedPoints object containing the likely redundant set of fixed points (and associated metadata) resulting from ALL initializations in initial_states (i.e., the full set of fixed points before filtering out putative duplicates to yield unique_fps).
leaky_fp_finder¶
- class mrnntorch.analysis.fixed_points.leaky_fp_finder.mFixedPointFinder(rnn: mRNN, lr_init: float = 0.0001, lr_patience: float = 5, lr_factor: float = 0.95, lr_cooldown: float = 0, tol_q: float = 1e-12, tol_dq: float = 1e-20, max_iters: int = 5000, do_rerun_q_outliers: bool = False, outlier_q_scale: float = 10.0, do_exclude_distance_outliers: bool = True, outlier_distance_scale: float = 10.0, tol_unique: float = 0.001, max_n_unique: int = inf, dtype: str = 'float32', random_seed: int = 0, verbose: bool = True, super_verbose: bool = False, n_iters_per_print_update: int = 100)[source]¶
Bases:
FixedPointFinderBase[mRNN]Fixed-point finder specialized for leaky
mRNNdynamics.- classmethod default_hps()[source]¶
Returns a deep copy of the default hyperparameters dict.
The deep copy protects against external updates to the defaults, which in turn protects against unintended interactions with the hashing done by the Hyperparameters class.
- Args:
None.
- Returns:
dict of hyperparameters.
- find_fixed_points(initial_states: Tensor, ext_inputs: Tensor, *args, optimize_h: bool = False, stim_inp: Tensor | None = None, W_rec: Tensor | None = None, n_rounds_q_opt: int = 1) tuple[FixedPointCollection, FixedPointCollection][source]¶
Finds RNN fixed points and the Jacobians at the fixed points.
- Args:
initial_states: Tensor specifying the initial states of the RNN, from which the optimization will search for fixed points.
ext_inputs: external inputs to the RNN
stim_inp: Additional stimulus input to the network
W_rec: Fixed weight matrix to replace self.mrnn.W_rec in forward pass
W_rec: Fixed weight matrix to replace self.mrnn.W_inp in forward pass
n_rounds_q_opt: Number of rounds to run extra iterations on q outliers
- Returns:
unique_fps: A FixedPoints object containing the set of unique fixed points after optimizing from all initial_states. Two fixed points are considered unique if all absolute element-wise differences are less than tol_unique AND the corresponding inputs are unique following the same criteria. See FixedPoints.py for additional detail.
all_fps: A FixedPoints object containing the likely redundant set of fixed points (and associated metadata) resulting from ALL initializations in initial_states (i.e., the full set of fixed points before filtering out putative duplicates to yield unique_fps).