Base class for RandomForest. Parameters ---------- n_estimators : int The number of decision tree. max_features : int The number of features to consider when looking for the best split. min_samples_split : int The minimum n
(
self,
n_estimators=10,
max_features=None,
min_samples_split=10,
max_depth=None,
criterion=None,
)
| 8 | |
| 9 | class RandomForest(BaseEstimator): |
| 10 | def __init__( |
| 11 | self, |
| 12 | n_estimators=10, |
| 13 | max_features=None, |
| 14 | min_samples_split=10, |
| 15 | max_depth=None, |
| 16 | criterion=None, |
| 17 | ): |
| 18 | """Base class for RandomForest. |
| 19 | |
| 20 | Parameters |
| 21 | ---------- |
| 22 | n_estimators : int |
| 23 | The number of decision tree. |
| 24 | max_features : int |
| 25 | The number of features to consider when looking for the best split. |
| 26 | min_samples_split : int |
| 27 | The minimum number of samples required to split an internal node. |
| 28 | max_depth : int |
| 29 | Maximum depth of the tree. |
| 30 | criterion : str |
| 31 | The function to measure the quality of a split. |
| 32 | """ |
| 33 | self.max_depth = max_depth |
| 34 | self.min_samples_split = min_samples_split |
| 35 | self.max_features = max_features |
| 36 | self.n_estimators = n_estimators |
| 37 | self.trees = [] |
| 38 | |
| 39 | def fit(self, X, y): |
| 40 | self._setup_input(X, y) |