src.model.deeplearn.handle.simple_dl_model_handler

Classes

SimpleDLModelHandler(arch, **kwargs)

Class to handle deep learning models in a simple way.

class src.model.deeplearn.handle.simple_dl_model_handler.SimpleDLModelHandler(arch, **kwargs)

Class to handle deep learning models in a simple way. It can be seen as the baseline deep learning model handler. See DLModelHandler.

Variables:
  • path_manager (DLPathManager) – The object that handles the paths involved in model handling.

  • transfer_handler (DLTransferHandler) – The object that handles transfer learning operations, if any.

  • out_prefix (str) – The output prefix for path expansions, when necessary.

  • training_epochs (int) – The number of training epochs for fitting the model.

  • batch_size (int) – The batch size governing the model’s input.

  • history (None or keras.callbacks.History) – By default None. It will be updated to contain the training history when calling fit.

  • checkpoint_monitor (str) – The name of the metric to choose the best model. By default, it is “loss”, which represents the loss function.

  • learning_rate_on_plateau (dict) – The key-word arguments governing the instantiation of the learning rate on plateau callback.

  • early_stopping (dict) – The key-word arguments governing the instantiation of the early stopping callback.

  • sequencer_spec (dict) – The specification on how to build the sequencer for the input data during model training. See SimpleDLModelHandler.build_sequencer().

  • fit_verbose (str or int) – Whether to use silent mode (0), show a progress bar (1), or print one line per epoch (2). Alternatively, “auto” can be used which typically means (1).

  • predict_verbose (str or int) – Whether to use silent mode (0), show a progress bar (1) or print one line per epoch (2). Alternatively, “auto” can be used which typically means (1).

__init__(arch, **kwargs)

Initialize/instantiate a simple deep learning model handler.

See DLModelHandler and dl_model_handler.DLModelHandler.__init__().

predict_rf(X_rf)

Compute the predictions on the given receptive fields.

Parameters:

X_rf (list or np.ndarray) – The receptive fields that must be predicted. It can be a list with the different inputs (e.g., for hierarchical models that use a hierarchical pre-processor like HierarchicalFPSPreProcessorPP or HierarchicalSGPreProcessorPP) or directly an input np.ndarray (e.g., input structure space).

Returns:

The predictions as directly computed by the model (e.g., the softmax probabilities from a point-wise classifier).

Return type:

np.ndarray

compile(X=None, y=None, y_rf=None, **kwargs)

See DLModelHandler, dl_model_handler.DLModelHandler.compile(), DLModelCompiler, and dl_model_compiler.DLModelCompiler.compile().

build_callbacks()

See dl_model_handler.DLModelHandler.build_callbacks().

update_paths(model_args)

Consider the current specification of model handling arguments to update the paths.

build_sequencer(X, y_rf, training)

Build/instantiate a sequencer from the given input data and specification.

Parameters:
  • X – The input data.

  • y_rf – The input reference values.

  • training – Whether the sequencer must be built for a training context (True) or a predictive context (False).

Returns:

The built sequencer.

Return type:

DLSequencer