Random forest pyrfr
smac.model.random_forest.pyrfr.random_forest_pyrfr
#
PyrfrRandomForest
#
PyrfrRandomForest(
configspace: ConfigurationSpace,
n_trees: int = N_TREES,
n_points_per_tree: int = -1,
ratio_features: float = 5.0 / 6.0,
min_samples_split: int = 3,
min_samples_leaf: int = 3,
max_depth: int = 2**20,
eps_purity: float = 1e-08,
max_nodes: int = 2**20,
bootstrapping: bool = True,
log_y: bool = False,
instance_features: (
dict[str, list[int | float]] | None
) = None,
pca_components: int | None = 7,
seed: int = 0,
)
Bases: AbstractRandomForest
Random forest that takes instance features into account.
| PARAMETER | DESCRIPTION |
|---|---|
n_trees
|
The number of trees in the random forest.
TYPE:
|
n_points_per_tree
|
Number of points per tree. If the value is smaller than 0, the number of samples will be used.
TYPE:
|
ratio_features
|
The ratio of features that are considered for splitting.
TYPE:
|
min_samples_split
|
The minimum number of data points to perform a split.
TYPE:
|
min_samples_leaf
|
The minimum number of data points in a leaf.
TYPE:
|
max_depth
|
The maximum depth of a single tree.
TYPE:
|
eps_purity
|
The minimum difference between two target values to be considered.
TYPE:
|
max_nodes
|
The maximum total number of nodes in a tree.
TYPE:
|
bootstrapping
|
Enables bootstrapping.
TYPE:
|
log_y
|
The y values (passed to this random forest) are expected to be log(y) transformed. This will be considered during predicting.
TYPE:
|
instance_features
|
Features (list of int or floats) of the instances (str). The features are incorporated into the X data, on which the model is trained on.
TYPE:
|
pca_components
|
Number of components to keep when using PCA to reduce dimensionality of instance features.
TYPE:
|
seed
|
TYPE:
|
Source code in smac/model/random_forest/pyrfr/random_forest_pyrfr.py
predict
#
Predicts mean and variance for a given X. Internally, calls the method _predict.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Input data points.
TYPE:
|
covariance_type
|
Specifies what to return along with the mean. Applied only to Gaussian Processes. Takes four valid inputs: * None: Only the mean is returned. * "std": Standard deviation at test points is returned. * "diagonal": Diagonal of the covariance matrix is returned. * "full": Whole covariance matrix between the test points is returned.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
means
|
The predictive mean.
TYPE:
|
vars
|
Predictive variance or standard deviation.
TYPE:
|
Source code in smac/model/abstract_model.py
predict_marginalized
#
Predicts mean and variance marginalized over all instances.
Note
The method is random forest specific and follows the SMAC2 implementation. It requires no distribution assumption to marginalize the uncertainty estimates.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Input data points.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
means
|
The predictive mean.
TYPE:
|
vars
|
The predictive variance.
TYPE:
|
Source code in smac/model/random_forest/pyrfr/random_forest_pyrfr.py
train
#
Trains the random forest on X and Y. Internally, calls the method _train.
| PARAMETER | DESCRIPTION |
|---|---|
X
|
Input data points.
TYPE:
|
Y
|
The corresponding target values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
self
|
TYPE:
|