[ENH] should `set_params` also reset the class if `None` is passed?
Currently there is an inconsistency in set_params with respect to its behaviour of resetting self.
If called with None (no parameters), it does not reset, for any other parameter setting, it does.
This feels inconsistent, and it turns out to an unclear contract in composition, as is seen in the discussion in https://github.com/sktime/skbase/pull/467#pullrequestreview-3467016649.
So, should we remove the clause if params is None: return self in set_params?
FYI @SimonBlanke
So, should we remove the clause if params is None: return self in set_params?
No. I think we should keep it as it is.
I intentionally implemented it this way. It is semantically correct: "set nothing" should do nothing. A reset would be unnecessary, otherwise there is a bug.
It is semantically correct: "set nothing" should do nothing.
That is debatable, since it depends on intention.
What I do not like about it that the behaviour is not mathematically "closed", that is, the None case is not the special case where the parameters are the empty set.
Namely, you could write down the algorithm in pseudocode:
- reset
self - for all parameters
{param: value}inparams, setself.paramtovalue