PlottingΒΆ

Once you have the metrics results for a set of learning strategies you can plot the behaviour the evolution of the metrics:

  • Accuracy: fraction of correct classifications;
  • Efficiency: fraction of total SN Ia correctly classified;
  • Purity: fraction of correct Ia classifications;
  • Figure of merit: efficiency x purity with a penalty factor of 3 for false positives (contamination).

The class Canvas <https://actsnclass.readthedocs.io/en/latest/api/actsnclass.Canvas.html#actsnclass.Canvas>_ enables you do to it using:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
>>> from actsnclass.plot_results import Canvas

>>> # define parameters
>>> path_to_files = ['results/metrics_canonical.dat',
>>>                  'results/metrics_random.dat',
>>>                  'results/metrics_unc.dat']
>>> strategies_list = ['Canonical', 'RandomSampling', 'UncSampling']
>>> output_plot = 'plots/metrics.png'

>>> #Initiate the Canvas object, read and plot the results for
>>> # each metric and strategy.
>>> cv = Canvas()
>>> cv.load_metrics(path_to_files=path_to_files,
>>>                    strategies_list=strategies_list)
>>> cv.set_plot_dimensions()
>>> cv.plot_metrics(output_plot_file=output_plot,
>>>                    strategies_list=strategies_list)

This will generate:

Plot metrics evolution.

Alternatively, you can use it directly from the command line.

For example, the result above could also be obtained doing:

>>> make_metrics_plots.py -m <path to canonical metrics> <path to rand sampling metrics>  <path to unc sampling metrics>
>>>        -o <path to output plot file> -s Canonical RandomSampling UncSampling

OBS: the color pallete for this project was chosen to honor the work of Piet Mondrian.