paddy.utils module¶
The paddy.utils
module contains suporting functions for the
paddy.Paddy_Runner
module.
Routine listings¶
get_param_names(p_space)
get_top_fitness(dirty_values)
random_propogation(rand_seed_number, p_space, seed_counter)
paddy_recover(file_name)
-
paddy.utils.
get_param_names
(p_space)[source]¶ Return list of parameter names.
- Parameters
- p_spaceclass
A class containing attributes exclusively of PaddyParameter instances.
- Returns
- param_name_listlist of strings
A list of PaddyParameter instances as string types of the instance variable name.
-
paddy.utils.
get_top_fitness
(dirty_values)[source]¶ Return top fitness value.
Returns the top fitness values of a
PFARunner
, solely, for each iteration as a list when passed a dictionary with the structure type oftop_values
.- Parameters
- dirty_valuesdictionary
A dictionary in the form of
top_values
.
- Returns
- fitness_listlist of floats
A list of the top fitness value evaluated for sowing during each itteration.
Notes
The top value evaluated for sowing when using ‘population’ for the paddy_type parameter of a PFARunner instance might not be the value of a seed generated during that itteration. See (need to find home for the full description of the PFA)
-
paddy.utils.
paddy_recover
(file_name)[source]¶ Recover pickled paddy file.
Trys to recover the pickled PFARunner instance, and will then use the backup file if there is an issue recovering the origional.
- Parameters
- file_namestring or nonetype, optional (default
A user defined string that is used as the file handle for PFARunner instance pickling.
- Returns
- recovered_paddy
PFARunner
Depickled PFARunner class instance.
- recovered_paddy
- Raises
- PaddyRecoveryError
If the recovery of a previous PFARunner fails.
Warning
The
pickle
module is not secure against malicious data!See also
Notes
All functions that the PFARPaddyRecoveryErrorunner instance being recoverd is dependant on need to be defined for successfull depickling, namely the eval_func parameter input.
Examples
>>> import paddy >>> from paddy.Default_Numerics import * >>> recovered_PFARunner = paddy.paddy_recover('old_PFARunner')
-
paddy.utils.
random_propogation
(rand_seed_number, p_space, seed_counter)[source]¶ Return updatad seed counter and random seed parameters.
This function takes parameter space and generates random seeds as an array with length determined by the user parameter rand_seed_number and returns the array as well as an updated seed_counter.