HALF.Hooks#

HALF.Hooks.LoadModelHook#

class HALF.Hooks.LoadModelHook.LoadModelHook[source]#

Bases: IHook

__init__(name=None, path=None)[source]#

Hook to load model parameters from disk Note: if path is provided name will be ignored

Parameters:
  • name (str, optional) – name of the model in the config model_path dir. Defaults to None.

  • path (str, optional) – path to the model. Defaults to None.

apply(al)[source]#

Load model parameters from disk and assign them to al’s model

Parameters:

al (ActiveLearner) – The ActiveLearner whose model weights should be loaded from disk

get_loading_path()[source]#

Returns path from which the model will be loaded

Return type:

str

HALF.Hooks.SaveModelHook#

class HALF.Hooks.SaveModelHook.SaveModelHook[source]#

Bases: IHook

__init__(saving_dir, name=None, with_time=False)[source]#

Saves model parameters to disk

Parameters:
  • saving_dir (str) – output directory

  • name (str, optional) – output name for the model. Defaults to None.

  • with_time (bool, optional) – if True, prepend the current time to the output filename. Defaults to False.

apply(al)[source]#

Save model parameters to disk

Parameters:

al (ActiveLearner) – The ActiveLearner whose model parameters should be saved to disk

get_saving_path()[source]#

Builds the save path

Return type:

str

HALF.Hooks.SetupTensorboardHook#

class HALF.Hooks.SetupTensorboardHook.SetupTensorboardHook[source]#

Bases: IHook

__init__(experiment_name='experiment_name', dir_path=None, with_time=False)[source]#
Parameters:
  • experiment_name (str) –

  • dir_path (Optional[str]) –

apply(al)[source]#
Parameters:

al (ActiveLearner) –

get_experiment_name()[source]#

HALF.Hooks.TestAccuracyLoggerHook#

class HALF.Hooks.TestAccuracyLoggerHook.TestAccuracyLoggerHook[source]#

Bases: IHook

__init__()[source]#

Updates test accuracy logs

apply(al)[source]#

Log test accuracy

Parameters:

al (ActiveLearner) – The ActiveLearner whose test accuracy should be logged

HALF.Hooks.WriteAccuracyLogsHook#

class HALF.Hooks.WriteAccuracyLogsHook.WriteAccuracyLogsHook[source]#

Bases: IHook

__init__(saving_dir, name)[source]#

Writes accuracy logs to disk

Parameters:
  • saving_dir (str) – output directory

  • name (str) – output name for the accuracy logs

apply(al)[source]#

Saves accuracy logs to csv file

Parameters:

al (ActiveLearner) – The ActiveLearner whose accuracy logs should be written to disk