glassbox.models.trees._base¶
Abstract BaseTree with recursive tree building and traversal logic.
BaseTree
¶
Bases: BaseModel
Abstract base class for all tree-based models.
Initialize the base tree model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_depth
|
int
|
Maximum depth of the tree. |
100
|
min_samples_split
|
int
|
Minimum number of samples required to split an internal node. |
2
|
Source code in glassbox/models/trees/_base.py
fit
¶
Fits the tree 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/trees/_base.py
predict
¶
Predicts target values for the given data.
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. |