src.model.random_forest_classification_model

Classes

RandomForestClassificationModel(**kwargs)

class src.model.random_forest_classification_model.RandomForestClassificationModel(**kwargs)
Author:

Alberto M. Esmoris Pena

RandomForest model for classification tasks. See Model.

Variables:
  • model_args (dict) – The arguments to initialize a new RandomForest model.

  • model (RandomForestClassifier) – The internal representation of the model.

  • importance_report_path (str) – Path to the file to store the report.

  • importance_report_permutation – Flag to control whether to include the permutation importance in the report (True, default) or not (False).

  • decision_plot_path (str) – Path to the file to store the plots representing the decision trees in the random forest. If only one decision tree is going to be exported, the path is used literally. Otherwise, incrementally updated paths by appending “_n” before the file extension will be considered.

  • decision_plot_trees (int) – The number of decision trees to consider. If -1, then all the decision trees will be considered.

static extract_model_args(spec)

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

Parameters:

spec – The key-word specification containing the arguments.

Returns:

The arguments to initialize/instantiate a RandomForestClassificationModel

__init__(**kwargs)

Initialize an instance of RandomForestModel.

Parameters:

kwargs – The attributes for the RandomForestClassificationModel that will also be passed to the parent.

prepare_model()

Prepare a random forest classifier with current model arguments

Returns:

The prepared model itself. Note it is also assigned as the model attribute of the object/instance.

training(X, y, info=True)

The fundamental training logic to train a random forest classifier.

See ClassificationModel and Model. Also see model.Model.training().

on_training_finished(X, y, yhat=None)

See model.Model.on_training_finished().