experiment.hooks package¶
Submodules¶
experiment.hooks.hook_skeleton module¶
-
class
experiment.hooks.hook_skeleton.CompositeHook(hook_list)¶ Bases:
objectA hook that calls other hooks.
experiment.hooks.ldst_filterstats_hook module¶
Created on 3 de abr de 2019
@author: klaus
-
class
experiment.hooks.ldst_filterstats_hook.LDSTFilterStatsHook(experiment, step_size=5)¶ Bases:
experiment.hooks.hook_skeleton.GSSLHookHook that saves stats of the filter at each step.
-
__init__(experiment, step_size=5)¶ Constructor for LDSTFilterStatsHook.
- Parameters
experiment (
experiment.experiments.Experiment) – The Experiment object. The experiment’soutput_dictwill be modified.step_size (int) – Determines after how many iterations to save the filter stats.
-
best_f1= -1.0¶
-
experiment.hooks.plot_hooks module¶
Created on 2 de abr de 2019
@author: klaus
-
class
experiment.hooks.plot_hooks.plotHook(filename_path, title, experiment, when='begin', only_labeled=True, force_Y_callback=None, force_lb_callback=None, plot_mode='discrete', palette=None)¶ Bases:
experiment.hooks.hook_skeleton.GSSLHookHook that plots labels. Uses a callback to an Experiment object to get X and W, if available.
-
__init__(filename_path, title, experiment, when='begin', only_labeled=True, force_Y_callback=None, force_lb_callback=None, plot_mode='discrete', palette=None)¶ Constructor for the plotHook.
- Parameters
filename_path (str) – Path to the output file (including filename and extension).
title (str) – The title to be displayed on the plot.
experiment (
experiment.experiments.Experiment) – The Experiment object, used for callbacks.when (str) – Either ‘begin’ or ‘end’. If it is ‘begin’, plotting occurs when ‘_begin’ method is called. Otherwise, it occurs when ‘_end’ is called. Default is
'begin'.only_labeled (bool) – If
True, future calls must have ‘labeledIndexes’ kwarg, and data marked as unlabeled will have a different color. Default isTrue.force_Y_callback (str) – Optional. Should be an attribute from
experiment.experiments.Experimentthat will override the Y variable (which determines the color of the plot).plot_mode (str) – Either
'discrete'`or'continuous'. The plot type. Default is'discrete'.palette (str) – Optional. Overrides the palette setting for the plot.
-
plot(**kwargs)¶
-
-
class
experiment.hooks.plot_hooks.plotIterGTAMHook(video_path, title, experiment, step_size=10, mode='Y', palette=None, keep_images=False, create_video=True)¶ Bases:
experiment.hooks.plot_hooks.plotIterHookHook that is specific to the GTAM algorithm. There are 3 modes: 1.
'Y': Plots the updated initial belief matrix for each iteration. 2.'Q': Plots the argmin of each row of the gradient. The lower the values, the more the cost function is decreasedwith the labeling of that instance.
'F': Plots the updated classification for each iteration.
-
__init__(video_path, title, experiment, step_size=10, mode='Y', palette=None, keep_images=False, create_video=True)¶ Constructor for the plotIterGTAMHook.
- Parameters
video_path (str) – Path to the output video (including filename and ‘.mp4’ extension).
title (str) – The title to be displayed on the plot.
experiment (
experiment.experiments.Experiment) – The Experiment object, used for callbacks.step_size (int) – Determines after how many steps should a plotting operation occur.
mode (str) – The mode of this plotIterGTAMHook. Must be in
['Y','Q','F']. Default is Y.palette (str) – Optional. Overrides the palette setting for the plot.
keep_images (bool) – Whether to keep the images. Default is
False.create_video (bool) – Whether to create a video showcasing a slideshow of the images. Default is
True.
-
class
experiment.hooks.plot_hooks.plotIterHook(video_path, title, experiment, only_labeled=True, step_size=5, force_Y_callback=None, force_lb_callback=None, temp_subfolder_name='iter', plot_mode='discrete', palette=None, keep_images=False, create_video=True, slowdown_factor=1.0, plot_id=0)¶ Bases:
experiment.hooks.plot_hooks.plotHookHook that plots the labels iteratively. Uses a callback to an Experiment object to get X and W, if available.
-
__init__(video_path, title, experiment, only_labeled=True, step_size=5, force_Y_callback=None, force_lb_callback=None, temp_subfolder_name='iter', plot_mode='discrete', palette=None, keep_images=False, create_video=True, slowdown_factor=1.0, plot_id=0)¶ Constructor for the plotHook.
- Parameters
video_path (str) – Path to the output video (including filename and ‘.mp4’ extension).
title (str) – The title to be displayed on the plot.
experiment (
experiment.experiments.Experiment) – The Experiment object, used for callbacks.only_labeled (bool) – If
True, future calls must have ‘labeledIndexes’ kwarg, and data marked as unlabeled will have a different color. Default isTrue.step_size (int) – Determines after how many steps should a plotting operation occur.
force_Y_callback (str) – Optional. Should be an attribute from
experiment.experiments.Experimentthat will override the Y variable (which determines the color of the plot).temp_subfolder_name (str) – Determines the name of the temporary subfolder to store the plot slideshow images. Default is
'iter'.plot_mode (str) – Either
'discrete'`or'continuous'. The plot type. Default is'discrete'.palette (str) – Optional. Overrides the palette setting for the plot.
-
createVideo()¶
-
rmFolders()¶
-
experiment.hooks.time_hook module¶
Created on 2 de abr de 2019
@author: klaus
-
class
experiment.hooks.time_hook.timeHook(experiment, timer_name)¶ Bases:
experiment.hooks.hook_skeleton.GSSLHookHook that times some part of the experiment execution.
-
__init__(experiment, timer_name)¶ Constructor for the timeHook.
- Parameters
experiment (
experiment.experiments.Experiment) – The Experiment object. The experiment’soutput_dictwill be modified.timer_name (str) – The name of the timer. This name will be a key added to
experiment.output_dict. Initially the corresponding value will benp.nan, but at the end it will be updated to be the time taken between _begin and _end calls.
-