Several Monte Carlo Comparison

Small code example

paths = [
    "path/to/relu/run/run_data",        # montecarlo result using relu
    "path/to/tanh/run/run_data",        # montecarlo result using tanh
    "path/to/sigmoid/run/run_data"      # montecarlo result using sigmoid
]
several = SeveralMonteCarloComparison('Activation Functions', x=['ReLU', 'tanh', 'sigmoid'], paths=paths)
several.box_plot(library='seaborn', showfig=True, savefile='path/to/save/result/act_fun_comparison_box_plot')

You can automate this code knowing that the return of each monte carlo run is the path.

paths = []
# Run several Monte Carlo's
for monte_carlo in monte_carlo_with_different_learning_rates:
    paths.append(monte_carlo.run(x, y))
# Run self
several = SeveralMonteCarloComparison('learning rate', x = learning_rates, paths =paths)
several.box_plot(showfig=True)
class SeveralMonteCarloComparison

This class is used to compare several monte carlo runs done with cvnn.montecarlo.MonteCarlo class. It let’s you compare different models between them but let’s you not change other values like epochs. You can run as several MonteCarlo runs and then use SeveralMonteCarloComparison class to compare the results.

__init__(self, label, x, paths, round=2)
Parameters:
  • label – string that describes what changed between each montecarlo run
  • x – List of the value for each monte carlo run wrt :label:.
  • paths – Full path to each monte carlo run_data saved file (Must end with run_data)

Note

x and paths must be the same size

box_plot(self, key='accuracy', library='plotly', epoch=-1, showfig=False, savefile=None)

Saves/shows a box plot of the results.

Parameters:
  • key – String stating what to plot using tf.keras.History labels. ex. val_accuracy for the validation accuracy.
  • library

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

  • epoch – Which epoch to use for the box plot. If -1 (default) it will use the last epoch.
  • showfig – If True, it will show the grated box plot.
  • savefile – String with the path + filename where to save the boxplot. If None (default) no figure is saved.

Output example using pyplot

Output example using seaborn