Monte Carlo Plotter

Note

All seaborn and matplotlib saved figures also generates a tikz figure (.tex) for LaTeX reports.

Small code example

path = "path/to/the/run_data/file"
monte = MonteCarloAnalyzer(path=path)       # MonteCarloAnalyzer uses MonteCarloPlotter by default as a variable :code:`monte_carlo_plotter`
monte.monte_carlo_plotter.plot_line_confidence_interval(x_axis='epoch')
class MonteCarloPlotter(Plotter)

Inherits from Plotter. Used by Monte Carlo Analyzer.

As Plotter, this class is used to plot evolution graphs with respect to each epoch like loss or accuracy but uses the average and/or median result of a monte carlo simulation. It also enables the plot of the same figures but with confidence intervals as it can be seen in the figures at the end of the page.

__init__(self, path)
Parameters:path – Path where with all the csv files that ends with _statistical_result.csv. These csv are generated by Monte Carlo Analyzer.
plot_line_confidence_interval(self, key='accuracy', showfig=False, savefig=True, library='matplotlib', title='', full_border=True, x_axis='epoch', extension=".svg")

Saves/shows the evolution of the trainig median and mean with the corresponding confidence intervals of the results.

Parameters:
  • library – string stating the library to be used to generate the box plot. matplotlib, plotly or seaborn
  • key – String stating what to plot using tf.keras.History labels. ex. val_accuracy, val_loss, accuracy or loss.
  • showfig – If True, it will show the grated box plot
  • savefig – If True, it saves the figure at: self.path / "plots/box_plot/"
  • title – Figure title
  • full_border
  • x_axis – What to use for the x_axis, by default, epoch (Not recommended to change)
  • extension – file extensions (default svg) to be used when saving the file (ignored if library is plotly).

Output example using pyplot

Output example using seaborn

plot_key(self, key='accuracy', reload=False, library='plotly', showfig=False, savefig=True, index_loc='mean', extension=".svg")
Parameters:
  • library

    String stating the library to be used to generate the box plot.

  • key – String stating what to plot using tf.keras.History labels. ex. val_accuracy for the validation acc
  • showfig – If True, it will show the grated box plot
  • savefig – If True, it saves the figure at self.path/key_library.extension
  • reload – If True it will reload data from the csv file in case it has changed.
  • index_loc
  • extension – file extensions (default svg) to be used when saving the file (ignored if library is plotly).