From 378dd00791d34c190e3900d3fb7d8f202247455f Mon Sep 17 00:00:00 2001 From: Aline Ribeiro de Almeida Date: Sat, 26 Jun 2021 22:50:20 +0200 Subject: [PATCH 1/2] Remove RandomForestRegressor from DOCSTRING_IGNORE_LIST --- maint_tools/test_docstrings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index 5944020883ab5..bfbeb545d818d 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -163,7 +163,6 @@ "RadiusNeighborsRegressor", "RadiusNeighborsTransformer", "RandomForestClassifier", - "RandomForestRegressor", "RandomTreesEmbedding", "RandomizedSearchCV", "RegressorChain", From 8944c1d9c81872753eaaa1c304ac651d5e69245c Mon Sep 17 00:00:00 2001 From: Aline Ribeiro de Almeida Date: Sat, 26 Jun 2021 22:52:02 +0200 Subject: [PATCH 2/2] Fix numpydoc errors GL02, GL03, GL08, RT03, SA04, SS06 on RandomForestRegressor --- sklearn/base.py | 3 +-- sklearn/ensemble/_forest.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sklearn/base.py b/sklearn/base.py index 0eb84f69299de..99a3c0e884efa 100644 --- a/sklearn/base.py +++ b/sklearn/base.py @@ -558,8 +558,7 @@ class RegressorMixin: _estimator_type = "regressor" def score(self, X, y, sample_weight=None): - """Return the coefficient of determination :math:`R^2` of the - prediction. + """Return the coefficient of determination :math:`R^2` of the prediction. The coefficient :math:`R^2` is defined as :math:`(1 - \\frac{u}{v})`, where :math:`u` is the residual sum of squares ``((y_true - y_pred) diff --git a/sklearn/ensemble/_forest.py b/sklearn/ensemble/_forest.py index 1b880d142cad6..6b08c36d62b64 100644 --- a/sklearn/ensemble/_forest.py +++ b/sklearn/ensemble/_forest.py @@ -276,7 +276,6 @@ def decision_path(self, X): n_nodes_ptr : ndarray of shape (n_estimators + 1,) The columns from indicator[n_nodes_ptr[i]:n_nodes_ptr[i+1]] gives the indicator value for the i-th estimator. - """ X = self._validate_X_predict(X) indicators = Parallel( @@ -319,6 +318,7 @@ def fit(self, X, y, sample_weight=None): Returns ------- self : object + Fitted estimator. """ # Validate or convert input data if issparse(y): @@ -615,6 +615,13 @@ def feature_importances_(self): ) @property def n_features_(self): + """Number of features when fitting the estimator. + + Returns + ------- + n_features_in_ : int + The number of features when fitting the estimator. + """ return self.n_features_in_ @@ -1595,7 +1602,9 @@ class RandomForestRegressor(ForestRegressor): See Also -------- - DecisionTreeRegressor, ExtraTreesRegressor + sklearn.tree.DecisionTreeRegressor : A decision tree regressor. + sklearn.ensemble.ExtraTreesRegressor : Ensemble of extremely randomized + tree regressors. Notes -----