RW¶
-
class biophysics_fitting.exploration_from_seedpoint.RW.RW(df_seeds=
None, param_ranges=None, params_to_explore=None, evaluation_function=None, MAIN_DIRECTORY=None, min_step_size=0, max_step_size=0.02, checkpoint_every=100, checkpoint_by_time=None, concat_every_n_save=60, n_iterations=60000, mode=None, aim_params=None, stop_n_inside_with_aim_params=-1)¶ Class to perform RW exploration from a seedpoint.
- Parameters:¶
- df_seeds : pd.DataFrame¶
individual seed points as rows and the parameters as columns
- param_ranges : pd.DataFrame¶
parameters as rows and has a
min_andmax_column denoting range of values this parameter may take- params_to_explore : list¶
list of parameters that should be explored. If None, all parameters are explored.
- evaluation_function : Callable¶
takes one argument (a new parameter vector) and returns:
inside: boolean that indicates if the parameter vector is within experimental constraits (i.e. results in acceptable physiology) or not.
evaluation: dictionary that will be saved alongside the parameters. For example, this should contain ephys features.
- checkpoint_every : int¶
save the results every n iterations
- check_point_by_time : float
time interval in minutes for checkpointing for using time-based checkpointing. If both checkpoint_every and checkpoint_by_time are set, checkpointing will be done by time.
- concat_every_n_save : int¶
number of checkpoints after which the intermediate
.pickle` files are concatenated to a single ``.parquetdataframe.- mode : str¶
Random walk mode. Options: (None, ‘expand’). default: None ‘expand’: only propose new points that move further away from seedpoint
- aim_params : dict¶
this param will make the exploration algorithm propose only new points such that a set of parameters aims certain values during exploration. Default: {}
- stop_n_inside_with_aim_params : int¶
number of successful models / set of parameters inside space with aim_params to find before stopping exploration
- MAIN_DIRECTORY : str¶
output directory in which results are stored.
- Attributes:¶
-
- param_ranges¶
parameters as rows and has a
min_andmax_column denoting range of values this parameter may take- Type:¶
pd.DataFrame
- params_to_explore¶
list of parameters that should be explored. If None, all parameters are explored.
- Type:¶
list
- evaluation_function¶
Function use to evaluate a vector of biphysical parameters. Must take one argument (a parameter vector) and return a tuple of
(inside, evaluation):- inside: boolean that indicates if the parameter vector is within experimental constraits
(i.e. results in acceptable physiology) or not.
- evaluation: dictionary that will be saved alongside the parameters. For example, this should contain
ephys features.
This function is usually
evaluation_function_incremental_helper().- Type:¶
Callable
- checkpoint_by_time¶
time interval in minutes for checkpointing for using time-based checkpointing. If both checkpoint_every and checkpoint_by_time are set, checkpointing will be done by time.
- Type:¶
float
- concat_every_n_save¶
number of checkpoints after which the pickle files are concatenated and cleaned
- Type:¶
int
- mode¶
Random walk mode. Options: (None, ‘expand’). default: None ‘expand’: only propose new points that move further away from seedpoint
- Type:¶
str
- aim_params¶
this param will make the exploration algorithm propose only new points such that a set of parameters aims certain values during exploration. Default: {}
- Type:¶
dict
- Methods:¶
_normalize_aim_params(aim_params)Normalize aim parameters to be between 0 and 1.
Normalize parameters to be between 0 and 1.
Unnormalize parameters to be between min and max.
_concatenate_and_clean(seed_folder, particle_id, iteration)Concatenate the intermediate
.pickleresults and save as one parquet file._clean_the_pickles(outdir, files, iteration)Remove the pickle files that correspond to the intermediate results of a iteration.
_load_pickle_or_parquet(outdir, iteration, mode)Load the results of a iteration from a pickle or parquet file.
assess_aim_params_reached(normalized_params, tolerance)Check whether the aim parameters have been reached.
run_RW(selected_seedpoint, particle_id, seed)Run random walk exploration from a seed point.
Documentation unclear, incomplete, broken or wrong? Let us know