glassbox.models.ensemble._base¶
Abstract BaseRandomForest with bootstrap sampling and feature subsets.
BaseRandomForest
¶
Bases: BaseModel
Abstract base class for all random forest models.
Initialize the random forest model.
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/_base.py
fit
¶
Fits the ensemble model to the training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Training data of shape (n_samples, n_features). |
required |
y
|
ndarray
|
Target values of shape (n_samples,). |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The fitted model. |
Source code in glassbox/models/ensemble/_base.py
predict
¶
Predicts target values for the given data using the ensemble.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Data to predict on, of shape (n_samples, n_features). |
required |
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Predicted target values. |