paddy.writer module¶
The paddy.writer
module contains built in data display functions.
Module functions are used to print specific data to terminal, formating
output in a user friendly manner, and quickly generate plots via the
matplotlib.pyplot module. Data is often passed via methods found in
paddy.Paddy_Runner
.
Routine Listings¶
- box(g_data, box_type)
Function that produces box plots.
- average_gen_plot(g_data)
Function that plots the average fitness for each generation.
- average_population_plot(g_data)
Function that plots the average fitness for the population during each itteration.
- preformace_plotter(info,verbose)
Function that handles other module level functions for plotting.
- clean_parameter_print(dirty_values)
Function that prints information regarding the top evaluated seed for each iteration, including a list of parameter values on a single line.
- single_param_print(dirty_values,value_key)
Function that prints the parameters for a user specified seed.
See Also¶
paddy.Paddy_Runner.PFARunner.paddy_plot_and_print()
PFARunner methodthat handles data output functions.
- matplotlib.pyplotPlotting package dependancy.
See more at <https://matplotlib.org/> for specifics.
Notes¶
The PFARunner method paddy_plot_and_print calls preformace_plotter when passed relevant arguments such as ‘scatter’. Refer to paddy_plot_and_print documentation for information regarding how data is generated and passed to preformace_plotter
-
paddy.writer.
average_gen_plot
(g_data)[source]¶ Plot average fitness for each generation.
Function that plots the average fitness value for the seeds sown during each iteration.
- Parameters
- g_datadictionary
A dictionary with keys being the paddy iteration, with ‘0’ representing the random initiation step, and values being a numpy-array containig parameter and gausian values.
See also
paddy.Paddy_Runner.PFARunner.paddy_plot_and_print()
PFARunner method that handles data output functions.
preformance_plotter
Function that manages plotting arguments passed by Paddy_Runner.PFARunner.paddy_plot_and_print.
plt.plot
Plotting function as part of the matplotlib.pyplot module.
Notes
average_gen_plot is typically called by preformance_plotter via the PFARunner method paddy_plot_and_print. See respective documentation for detailes on how average_gen_plot is called.
-
paddy.writer.
average_population_plot
(g_data)[source]¶ Plot average fitness for the population during each iteration.
Function that plots the average fitness value for the seeds within the population of evaluated seeds at each given interation.
- Parameters
- g_datadictionary
A dictionary with keys being the paddy iteration, with ‘0’ representing the random initiation step, and values being a numpy-array containig parameter and gausian values.
See also
paddy.Paddy_Runner.PFARunner.paddy_plot_and_print()
PFARunner method that handles data output functions.
preformance_plotter
Function that manages plotting arguments passed by paddy.Paddy_Runner.PFARunner.paddy_plot_and_print
matplotlib.pyplot
Notes
average_population_plot is typically called by preformance_plotter via the PFARunner method paddy_plot_and_print. See respective documentation for detailes on how average_gen_plot is called.
-
paddy.writer.
box
(g_data, box_type)[source]¶ Plot boxplots via preformance_plotter.
Function that plots the desired box plot type as specified by the user.
- Parameters
- g_datadictionary
A dictionary with keys being the paddy iteration, with ‘0’ representing the random initiation step, and values being a numpy-array containig parameter and gausian values.
- box_typeinteger
One of the integers: 1, 2, or 3. The number is associated with a respective box plot type detailed in the notes section.
See also
paddy.Paddy_Runner.PFARunner.paddy_plot_and_print()
PFARunner method that handles data output functions.
preformance_plotter
Function that manages plotting arguments passed by paddy.Paddy_Runner.PFARunner.paddy_plot_and_print
plt.boxplot
Function that generates boxplots as part of the matplotlib.pyplot module.
Notes
The box_type parameter is an integer assigned as a numeric representation of a string argument passed via the verbose parameter of the preformance_plotter function. The numeric values are related to the string arguments as:
1: equivalent to ‘box’.
2: equivalent to ‘box_hidden’
3: equivalent to ‘box_notched’
See documentation for preformance_plotter and paddy_plot_and_print for details on how box is called.
-
paddy.writer.
clean_parameter_print
(dirty_values)[source]¶ Prints parameter values of PFARunner atribute
top_values
.Function that prints information regarding the top seed evaluated for sowing during each iteration of paddy.
- Parameters
- dirty_valuesdictionary
Dictionary with the same structure of PFARunner.top_values.
See also
Notes
This function prints two lines for each iteration, where the first line contains details on what seed was most fit during the selection step and the second line consists of a list of parameter values. Be mindfull of this when using this function as it is intended for low iteration implementations of paddy, such as deep learning, and a high iteration run will result in a proportionaly long print time.
The function is typically called by PFARunner.paddy_plot_and_print when passed the argument ‘final_results’.
-
paddy.writer.
preformance_plotter
(info, verbose, figure_name=None)[source]¶ Plot preformance as specified.
Function that plots the results from a completed paddy run. The type of plot argument string is typically passed through the PFARunner method paddy_plot_and_print.
- Parameters
- infolist
A list containing a list generated by get_top_fitness, and a dictionary of the form PFARunner.generation_fitness.
- verboseset of strings
A set of string comand(s), typically passed by paddy_plot_and_print. See the notes section for a full list of valid strings.
- figure_namestring
A string passed by paddy_plot_and_print that provides a file handle for the figure being saved.
See also
paddy.utils.get_top_fitness
Function that returns a list of fitness values.
paddy.Paddy_Runner.PFARunner.paddy_plot_and_print()
PFARunner method that handles data output functions.
average_gen_plot
average_population_plot
box
matplotlib.pyplot
Notes
preformance_plotter is typically called by the PFARunner method paddy_plot_and_print when valid string arguments are passed by the user. Valid strings that will call preformace_plotter from the paddy_plot_and_print method are:
- ‘best_sown’
A line plot of the best seed sown during each iteration.
- ‘average_gen’
A line plot of the average fitness of the seeds sown during each iteration.
- ‘average_population’
A line plot of the average fitness value of all seeds at the end of each iteration.
- ‘scatter’
A scatter plot of each seeds fitness value for each iteration.
- ‘box’
A box plot of the sown seeds for each iteration.
- ‘box_notched’
Same as box, but with notched boxes.
- ‘box_hidden’
Same as box, but with outliers ommited.
Refer to https://matplotlib.org/ for specifics regarding plotting.
-
paddy.writer.
single_param_print
(dirty_values, value_key)[source]¶ Prints the parameters for a specific seed.
Function that typically prints parameter values stored in PFARunner.seed_params when called throughout a paddy run.
- Parameters
- dirty_valueslist of array-like, shape = (seed_counter,parameters,2)
A list of numpy-arrays containing the parameter and gaussian values for each PaddyParameter instance in PFARunner.space of a given paddy run. Typically the PFARunner.seed_params atribute.
- value_keyinteger
A integer that represents the seed number that the parameters are to be printed for.
See also
paddy.Paddy_Runner.PFARunner.run_paddy()
method that excecutes the paddy field algorithm.
Notes
This function is natively called when ‘top_gen’ or ‘pop’ are passed via paddy.Paddy_Runner.PFARunner.run_paddy when listed as an element in the verbose parameter. The list that is printed contains strictly the parameter values of the PFARunner.space atributes of a given seed, rather than the associated gaussian values.