MachineLearning/random_forest library

🌲 Random Forest Classifier (bagging of decision trees)

Simple random forest implementation that bootstraps samples and trains multiple DecisionTreeClassifier instances, then predicts by majority voting. This is a compact, well-documented version fit for small to medium toy datasets and educational use.

Contract:

  • Input: feature matrix X and labels y (integers). Hyperparameters control number of trees and sample ratio.
  • Output: RandomForestClassifier instance with fit and predict.

Time Complexity: O(n_estimators * cost_of_tree_build) Space Complexity: O(n_estimators * model_size)