visualizations¶
Module of classes used to create visualizations of data produced by the experiment and learners.
-
class
mloop.visualizations.
ControllerVisualizer
(filename, file_type='pkl', **kwargs)¶ Bases:
object
ControllerVisualizer creates figures from a Controller Archive.
Parameters: filename (String) – Filename of the GaussianProcessLearner archive. Keyword Arguments: file_type (String) – Can be ‘mat’ for matlab, ‘pkl’ for pickle or ‘txt’ for text. Default ‘pkl’. -
plot_cost_vs_run
()¶ Create a plot of the costs versus run number.
-
plot_parameters_vs_cost
()¶ Create a plot of the parameters versus run number.
-
plot_parameters_vs_run
()¶ Create a plot of the parameters versus run number.
-
-
class
mloop.visualizations.
DifferentialEvolutionVisualizer
(filename, file_type='pkl', **kwargs)¶ Bases:
object
DifferentialEvolutionVisualizer creates figures from a differential evolution archive.
Parameters: filename (String) – Filename of the DifferentialEvolutionVisualizer archive. Keyword Arguments: file_type (String) – Can be ‘mat’ for matlab, ‘pkl’ for pickle or ‘txt’ for text. Default ‘pkl’. -
plot_costs_vs_generations
()¶ Create a plot of the costs versus run number.
-
plot_params_vs_generations
()¶ Create a plot of the parameters versus run number.
-
-
class
mloop.visualizations.
GaussianProcessVisualizer
(filename, file_type='pkl', **kwargs)¶ Bases:
mloop.learners.GaussianProcessLearner
GaussianProcessVisualizer extends of GaussianProcessLearner, designed not to be used as a learner, but to instead post process a GaussianProcessLearner archive file and produce useful data for visualization of the state of the learner. Fixes the Gaussian process hyperparameters to what was last found during the run.
Parameters: filename (String) – Filename of the GaussianProcessLearner archive. Keyword Arguments: file_type (String) – Can be ‘mat’ for matlab, ‘pkl’ for pickle or ‘txt’ for text. Default ‘pkl’. -
plot_cross_sections
()¶ Produce a figure of the cross section about best cost and parameters
-
plot_hyperparameters_vs_run
()¶
-
return_cross_sections
(points=100, cross_section_center=None)¶ Finds the predicted global minima, then returns a list of vectors of parameters values, costs and uncertainties, corresponding to the 1D cross sections along each parameter axis through the predicted global minima.
Keyword Arguments: - points (int) – the number of points to sample along each cross section. Default value is 100.
- cross_section_center (array) – parameter array where the centre of the cross section should be taken. If None, the parameters for the best returned cost are used.
Returns: a tuple (cross_arrays, cost_arrays, uncer_arrays) cross_parameter_arrays (list): a list of arrays for each cross section, with the values of the varied parameter going from the minimum to maximum value. cost_arrays (list): a list of arrays for the costs evaluated along each cross section about the minimum. uncertainty_arrays (list): a list of uncertainties
-
run
()¶ Overides the GaussianProcessLearner multiprocessor run routine. Does nothing but makes a warning.
-
-
class
mloop.visualizations.
NeuralNetVisualizer
(filename, file_type='pkl', **kwargs)¶ Bases:
mloop.learners.NeuralNetLearner
NeuralNetVisualizer extends of NeuralNetLearner, designed not to be used as a learner, but to instead post process a NeuralNetLearner archive file and produce useful data for visualization of the state of the learner.
Parameters: filename (String) – Filename of the GaussianProcessLearner archive. Keyword Arguments: file_type (String) – Can be ‘mat’ for matlab, ‘pkl’ for pickle or ‘txt’ for text. Default ‘pkl’. -
do_cross_sections
(upload)¶ Produce a figure of the cross section about best cost and parameters
-
plot_density_surface
()¶ Produce a density plot of the cost surface (only works when there are 2 parameters)
-
plot_losses
()¶ Produce a figure of the loss as a function of training run.
-
plot_surface
()¶ Produce a figure of the cost surface (only works when there are 2 parameters)
-
return_cross_sections
(points=100, cross_section_center=None)¶ Finds the predicted global minima, then returns a list of vectors of parameters values, costs and uncertainties, corresponding to the 1D cross sections along each parameter axis through the predicted global minima.
Keyword Arguments: - points (int) – the number of points to sample along each cross section. Default value is 100.
- cross_section_center (array) – parameter array where the centre of the cross section should be taken. If None, the parameters for the best returned cost are used.
Returns: a tuple (cross_arrays, cost_arrays, uncer_arrays) cross_parameter_arrays (list): a list of arrays for each cross section, with the values of the varied parameter going from the minimum to maximum value. cost_arrays (list): a list of arrays for the costs evaluated along each cross section about the minimum. uncertainty_arrays (list): a list of uncertainties
-
run
()¶ Overides the GaussianProcessLearner multiprocessor run routine. Does nothing but makes a warning.
-
-
mloop.visualizations.
_color_from_controller_name
(controller_name)¶ Gives a color (as a number betweeen zero an one) corresponding to each controller name string.
-
mloop.visualizations.
_color_list_from_num_of_params
(num_of_params)¶ Gives a list of colors based on the number of parameters.
-
mloop.visualizations.
configure_plots
()¶ Configure the setting for the plots.
-
mloop.visualizations.
create_controller_visualizations
(filename, file_type='pkl', plot_cost_vs_run=True, plot_parameters_vs_run=True, plot_parameters_vs_cost=True)¶ Runs the plots for a controller file.
Parameters: filename (Optional [string]) – Filename for the controller archive.
Keyword Arguments: - file_type (Optional [string]) – File type ‘pkl’ pickle, ‘mat’ matlab or ‘txt’ text.
- plot_cost_vs_run (Optional [bool]) – If True plot cost versus run number, else do not. Default True.
- plot_parameters_vs_run (Optional [bool]) – If True plot parameters versus run number, else do not. Default True.
- plot_parameters_vs_cost (Optional [bool]) – If True plot parameters versus cost number, else do not. Default True.
-
mloop.visualizations.
create_differential_evolution_learner_visualizations
(filename, file_type='pkl', plot_params_vs_generations=True, plot_costs_vs_generations=True)¶ Runs the plots from a differential evolution learner file.
Parameters: filename (Optional [string]) – Filename for the differential evolution archive. Must provide datetime or filename. Default None.
Keyword Arguments: - file_type (Optional [string]) – File type ‘pkl’ pickle, ‘mat’ matlab or ‘txt’ text.
- plot_params_generations (Optional [bool]) – If True plot parameters vs generations, else do not. Default True.
- plot_costs_generations (Optional [bool]) – If True plot costs vs generations, else do not. Default True.
-
mloop.visualizations.
create_gaussian_process_learner_visualizations
(filename, file_type='pkl', plot_cross_sections=True, plot_hyperparameters_vs_run=True)¶ Runs the plots from a gaussian process learner file.
Parameters: filename (Optional [string]) – Filename for the gaussian process archive. Must provide datetime or filename. Default None.
Keyword Arguments: - file_type (Optional [string]) – File type ‘pkl’ pickle, ‘mat’ matlab or ‘txt’ text.
- plot_cross_sections (Optional [bool]) – If True plot predict landscape cross sections, else do not. Default True.
-
mloop.visualizations.
create_neural_net_learner_visualizations
(filename, file_type='pkl', plot_cross_sections=True, upload_cross_sections=False)¶ Creates plots from a neural nets learner file.
Parameters: filename (Optional [string]) – Filename for the neural net archive. Must provide datetime or filename. Default None.
Keyword Arguments: - file_type (Optional [string]) – File type ‘pkl’ pickle, ‘mat’ matlab or ‘txt’ text.
- plot_cross_sections (Optional [bool]) – If True plot predict landscape cross sections, else do not. Default True.
-
mloop.visualizations.
show_all_default_visualizations
(controller, show_plots=True)¶ Plots all visualizations available for a controller, and it’s internal learners.
Parameters: controller (Controller) – The controller to extract plots from Keyword Arguments: show_plots (Controller) – Determine whether to run plt.show() at the end or not. For debugging.
-
mloop.visualizations.
show_all_default_visualizations_from_archive
(controller_filename, learner_filename, controller_type, show_plots=True, upload_cross_sections=False)¶