Skip to main content

RandomForestClassifier

#include <Skigen/Ensemble>

template <typename Scalar = double>
class Skigen::RandomForestClassifier(n_estimators=100, criterion=CriterionClf::Gini, max_depth=std::nullopt, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0, max_features_mode=MaxFeaturesMode::Sqrt, 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 classifier.

A meta-estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting. Each tree is trained on a bootstrap sample of the training data and considers only a random subset of features at each split.

Mirrors sklearn.ensemble.RandomForestClassifier.



Attributes:

  • n_estimators : int

  • bootstrap : bool

  • n_jobs : int

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

  • classes : const Eigen::VectorXi

  • n_classes : int

  • feature_importances : RowVectorType

  • oob_decision_function : MatrixType

  • oob_score : Scalar


Methods

SKIGEN_PARAMS()


predict(X)


predict_proba(X)

Average of per-tree class probabilities.