src.model.decorated_model

Classes

DecoratedModel(**kwargs)

class src.model.decorated_model.DecoratedModel(**kwargs)
Author:

Alberto M. Esmoris Pena

Abstract decorator for machine learning models that provides the common logic for different types of model decorators.

See Model.

Variables:
  • decorated_model_spec (dict) – The specification of the decorated model.

  • decorated_model (Model) – The decorated model object.

  • undecorated_predictions (bool) – Whether to use the decorated model without decoration when computing the predictions (true) or not (false).

static extract_model_args(spec)

Extract the arguments to initialize/instantiate a DecoratedModel from a key-word specification.

Parameters:

spec – The key-word specification containing the arguments.

Returns:

The arguments to initialize/instantiate a DecoratedModel.

__init__(**kwargs)

Initialization for any instance of type DecoratedModel.

predict(pcloud, X=None)

Decorate the main predictive logic to work on the representation generated by the decorator.

See Model and Model.predict().

prepare_model()

Prepare the decorated model. See Model and Model.prepare_model().

overwrite_pretrained_model(spec)

Overwrite the decorated pretrained model. See Model and Model.overwrite_pretrained_model().

get_input_from_pcloud(pcloud)

Get input from the decorated pretrained model. See Model and Model.get_input_from_pcloud().

is_deep_learning_model()

Check whether the decorated model is a deep learning model. See Model and Model.is_deep_learning_model().

training(X, y, info=True)

Use the training logic of the decorated model. See Model and Model.training().

autoval(y, yhat, info=True)

Auto validation during training through decorated model. See Model and Model.autoval().

train_base(pcloud)

Straightforward training through decorated model. See Model and Model.train_base().

train_autoval(pcloud)

Use autovalidation training strategy from decorated model. See Model and Model.train_autoval().

train_stratified_kfold(pcloud)

Use stratified k-fold training strategy from decorated model. See Model and Model.train_stratified_kfold().

on_training_finished(X, y)

Use on training finished callback from decorated model. See Model and Model.on_training_finished().

abstractmethod decorate_pcloud(pcloud)

Obtain the representation of the input point cloud generated by the decorator.

Parameters:

pcloud (PointCloud) – The input point cloud whose decorated representation must be computed.

Returns:

The decorated representation of the input point cloud.

Return type:

PointCloud

abstractmethod propagate(rf_yhat)

Propagate the values (typically predictions) from the receptive field back to the original point cloud.

Parameters:

rf_yhat (np.ndarray) – The values (typically predictions) in the receptive field representation generated by the decorator.

Returns:

The values (typically predictions) propagated back to the original point cloud.

Return type:

np.ndarray

get_fnames_recursively()

Find through any potential decoration graph until the deepest model is found, then consider its feature names.

Returns:

The feature names of the deepest model in the decoration hierarchy.

Return type:

list of str

property fnames

Getter for feature names to get them from the decorated model. :return: The feature names from the decorated model. :rtype: None or list of str