8000 [MRG] Clarified indempotence of fit (#12305) · jnothman/scikit-learn@484712b · GitHub
[go: up one dir, main page]

Skip to content

Commit 484712b

Browse files
NicolasHugjnothman
authored andcommitted
[MRG] Clarified indempotence of fit (scikit-learn#12305)
<!-- Thanks for contributing a pull request! Please ensure you have taken a look at the contribution guidelines: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#pull-request-checklist --> #### Reference Issues/PRs <!-- Example: Fixes scikit-learn#1234. See also scikit-learn#3456. Please use keywords (e.g., Fixes) to create link to the issues or pull requests you resolved, so that they will automatically be closed when your pull request is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests --> #### What does this implement/fix? Explain your changes. As far as I understand it, the fact that `fit` is idempotent means that repeated calls to `fit` with the same data doesn't change the estimator. The contributing guide was a bit unclear about this. #### Any other comments? <!-- Please be aware that we are a loose team of volunteers so patience is necessary; assistance handling other issues is very welcome. We value all user contributions, no matter how minor they are. If we are slow to review, either the pull request needs some benchmarking, tinkering, convincing, etc. or more likely the reviewers are simply busy. In either case, we ask for your understanding during the review process. For more information, see our FAQ on this topic: http://scikit-learn.org/dev/faq.html#why-is-my-pull-request-not-getting-any-attention. Thanks for contributing! -->
1 parent 919fd0e commit 484712b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

doc/developers/contributing.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,16 @@ data dependent. A tolerance stopping criterion ``tol`` is not directly
11431143
data dependent (although the optimal value according to some scoring
11441144
function probably is).
11451145

1146+
When ``fit`` is called, any previous call to ``fit`` should be ignored. In
1147+
general, calling ``estimator.fit(X1)`` and then ``estimator.fit(X2)`` should
1148+
be the same as only calling ``estimator.fit(X2)``. However, this may not be
1149+
true in practice when ``fit`` depends on some random process, see
1150+
:term:`random_state`. Another exception to this rule is when the
1151+
hyper-parameter ``warm_start`` is set to ``True`` for estimators that
1152+
support it. ``warm_start=True`` means that the previous state of the
1153+
trainable parameters of the estimator are reused instead of using the
1154+
default initialization strategy.
1155+
11461156
Estimated Attributes
11471157
^^^^^^^^^^^^^^^^^^^^
11481158

@@ -1151,9 +1161,8 @@ ending with trailing underscore, for example the coefficients of
11511161
some regression estimator would be stored in a ``coef_`` attribute after
11521162
``fit`` has been called.
11531163

1154-
The last-mentioned attributes are expected to be overridden when
1155-
you call ``fit`` a second time without taking any previous value into
1156-
account: **fit should be idempotent**.
1164+
The estimated attributes are expected to be overridden when you call ``fit``
1165+
a second time.
11571166

11581167
Optional Arguments
11591168
^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)
0