diff --git a/sklearn/tree/_classes.py b/sklearn/tree/_classes.py index 7393ef23cc48d..abbb738042156 100644 --- a/sklearn/tree/_classes.py +++ b/sklearn/tree/_classes.py @@ -1016,8 +1016,8 @@ def predict_log_proba(self, X): return proba @deprecated( # type: ignore - "The attribute 'n_features_' is deprecated in 1.0 and will be removed " - "in 1.2. Use 'n_features_in_' instead." + "The attribute `n_features_` is deprecated in 1.0 and will be removed " + "in 1.2. Use `n_features_in_` instead." ) @property def n_features_(self): @@ -1336,8 +1336,8 @@ def _compute_partial_dependence_recursion(self, grid, target_features): return averaged_predictions @deprecated( # type: ignore - "The attribute 'n_features_' is deprecated in 1.0 and will be removed " - "in 1.2. Use 'n_features_in_' instead." + "The attribute `n_features_` is deprecated in 1.0 and will be removed " + "in 1.2. Use `n_features_in_` instead." ) @property def n_features_(self): diff --git a/sklearn/tree/tests/test_tree.py b/sklearn/tree/tests/test_tree.py index 2b5ec8359448d..adb4c0aa8aaec 100644 --- a/sklearn/tree/tests/test_tree.py +++ b/sklearn/tree/tests/test_tree.py @@ -2527,8 +2527,8 @@ def test_n_features_deprecated(Tree): # check that we raise a deprecation warning when accessing `n_features_`. # FIXME: remove in 1.2 depr_msg = ( - "The attribute 'n_features_' is deprecated in 1.0 and will be " - "removed in 1.2. Use 'n_features_in_' instead." + "The attribute `n_features_` is deprecated in 1.0 and will be " + "removed in 1.2. Use `n_features_in_` instead." ) with pytest.warns(FutureWarning, match=depr_msg):