File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -647,9 +647,11 @@ To summarize, a `__init__` should look like::
647647 self.param1 = param1
648648 self.param2 = param2
649649
650- There should be no logic, and the parameters should not be changed.
651- The corresponding logic should be put where the parameters are used. The
652- following is wrong::
650+ There should be no logic, not even input validation,
651+ and the parameters should not be changed.
652+ The corresponding logic should be put where the parameters are used,
653+ typically in ``fit ``.
654+ The following is wrong::
653655
654656 def __init__(self, param1=1, param2=2, param3=3):
655657 # WRONG: parameters should not be modified
@@ -660,8 +662,9 @@ following is wrong::
660662 # the argument in the constructor
661663 self.param3 = param2
662664
663- Scikit-learn relies on this mechanism to introspect objects to set
664- their parameters by cross-validation.
665+ The reason for postponing the validation is that the same validation
666+ would have to be performed in ``set_params ``,
667+ which is used in algorithms like ``GridSearchCV ``.
665668
666669Fitting
667670^^^^^^^
You can’t perform that action at this time.
0 commit comments