Hooks are useful for defining additional checks that should be performed prior to and during training and prediction. For example, one might want to issue a warning if the user is predicting on rows that were used for training, or a sanity check might be present prior to training to ensure a dependent variable is present.

Add a hook to a tundraContainer.

run_hooks(hook_name)

add_hook(hook_name, hook_function)

Arguments

hook_name

character. The hook to run. Must be one of the available hooks.

hook_function

function. The hook to execute. It will be provided the tundraContainer as its only argument.

Details

The following hooks are available.

  1. train_pre_mungeThis hook runs during a call to the container's train method, just prior to invoking the munge_procedure to clean up the dataset. It could be useful for defining pre-conditions on the dataset to ensure it can be munged successfully.

  2. train_post_mungeThis hook runs during a call to the container's train method, just after invoking the munge_procedure to clean up the dataset. It could be useful for defining post-conditions on the dataset to ensure it was munged successfully.

  3. train_finalizeThis hook runs just after the train method calls the train_function. It could be used to verify presence or validate properties of the trained model.

  4. predict_pre_mungeThis hook runs during a call to the container's predict method, just prior to invoking the munge_procedure to clean up the dataset. It could be useful for defining pre-conditions on the dataset to ensure it can be munged successfully.

  5. predict_post_mungeThis hook runs during a call to the container's predict method, just after invoking the munge_procedure to clean up the dataset. It could be useful for defining post-conditions on the dataset to ensure it was munged successfully.

Each hook will be provided the tundraContainer as input (unless it has no arguments, in which case it will simply be called).