Skip to content

glassbox.models.ensemble

Random Forest ensemble models.


RandomForestClassifier

RandomForestClassifier(
    n_estimators=100, max_depth=100, min_samples_split=2
)

Bases: BaseRandomForest

Random Forest classifier using Decision Tree classification models.

Initialize the random forest classifier.

Parameters:

Name Type Description Default
n_estimators int

The number of trees in the forest.

100
max_depth int

Maximum depth of individual trees.

100
min_samples_split int

Minimum number of samples required to split an internal node.

2
Source code in glassbox/models/ensemble/classifier.py
def __init__(
    self, n_estimators: int = 100, max_depth: int = 100, min_samples_split: int = 2
) -> None:
    """
    Initialize the random forest classifier.

    Parameters
    ----------
    n_estimators : int, default=100
        The number of trees in the forest.
    max_depth : int, default=100
        Maximum depth of individual trees.
    min_samples_split : int, default=2
        Minimum number of samples required to split an internal node.
    """
    super().__init__(
        n_estimators=n_estimators,
        max_depth=max_depth,
        min_samples_split=min_samples_split,
    )
    self.trees: List[DecisionTreeClassifier] = []

RandomForestRegressor

RandomForestRegressor(
    n_estimators=100, max_depth=100, min_samples_split=2
)

Bases: BaseRandomForest

Random Forest regressor using Decision Tree regression models.

Initialize the random forest regressor.

Parameters:

Name Type Description Default
n_estimators int

The number of trees in the forest.

100
max_depth int

Maximum depth of individual trees.

100
min_samples_split int

Minimum number of samples required to split an internal node.

2
Source code in glassbox/models/ensemble/regressor.py
def __init__(
    self, n_estimators: int = 100, max_depth: int = 100, min_samples_split: int = 2
) -> None:
    """
    Initialize the random forest regressor.

    Parameters
    ----------
    n_estimators : int, default=100
        The number of trees in the forest.
    max_depth : int, default=100
        Maximum depth of individual trees.
    min_samples_split : int, default=2
        Minimum number of samples required to split an internal node.
    """
    super().__init__(
        n_estimators=n_estimators,
        max_depth=max_depth,
        min_samples_split=min_samples_split,
    )
    self.trees: List[DecisionTreeRegressor] = []