Skip to main content

RandomForestRegressor

#include <Skigen/Ensemble>

template <typename Scalar = double>
class Skigen::RandomForestRegressor(n_estimators=100, criterion=CriterionReg::SquaredError, max_depth=std::nullopt, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0, max_features_mode=MaxFeaturesMode::OneThird, max_features_value=std::nullopt, max_leaf_nodes=std::nullopt, min_impurity_decrease=0, bootstrap=true, oob_score=false, n_jobs=1, random_state=std::nullopt, verbose=0, warm_start=false, ccp_alpha=std::nullopt, max_samples=std::nullopt)

A random forest regressor.

A meta-estimator that fits a number of decision tree regressors on bootstrap samples of the training set and averages their predictions to improve accuracy and control over-fitting.

Mirrors sklearn.ensemble.RandomForestRegressor.



Attributes:

  • n_estimators : int

  • bootstrap : bool

  • n_jobs : int

  • estimators : const std::vector< DecisionTreeRegressor< Scalar > > &

  • feature_importances : RowVectorType

  • oob_prediction : VectorType

  • oob_score : Scalar

  • n_targets : int


Methods

SKIGEN_PARAMS()


predict(X)


score(X, y)


fit_multi(X, Y)

Fit on a multi-target response matrix Y (n_samples × n_targets).

Each forest member is a shared joint multi-output tree (DecisionTreeRegressor::fit_with_indices_multi). Bootstrap sampling, feature subsampling, and seeding match the single-target path.


predict_multi(X)

Multi-target predict (n_samples × n_targets).