It's very likely that you'd disagree with my use-case for overloading
clone. It is required at
https://github.com/jnothman/scikit-learn/commit/de0f86d1efd4b477bd662e15d2b2e78292ad3107.
The most clear use there is in freeze_model which allows any model
(provided as a parameter some other estimator) unaffected by a call to fit.
Otherwise, overloading clone allows these estimator wrappers (e.g.
automatic memoization with remember_model) transparent, i.e. they don't add
a path component to deep parameter names, nor are their parameters
accessible by set_params.
On 18 February 2015 at 22:47, Gael Varoquaux <gael.varoqu...@normalesup.org>
wrote:
> Overloading of clone! That sounds like a really bad idea to me. It pretty
> much means that we cannot enforce our api and our logic on these cases.
> That sounds a very slippery slope to me.
>
> Gaƫl
>
> Sent from my phone. Please forgive brevity and mis spelling
> On Feb 18, 2015, at 12:33, Joel Nothman <joel.noth...@gmail.com> wrote:
>
>> The overloading of get_params and set_params becomes more complex in
>> #1769. I have also found cases (of helper meta-estimators / wrappers) that
>> require the overloading of clone behaviour, though this is not yet
>> supported.
>>
>> On 18 February 2015 at 18:14, Gael Varoquaux <
>> gael.varoqu...@normalesup.org> wrote:
>>
>>> > This might be a very silly question, but I am wondering why set_params
>>> > and get_params are methods and not functions.
>>> > They are not overloaded anywhere in sklearn, and the ability to
>>> overload
>>> > them seems likely to cause trouble.
>>>
>>> They are overloaded. get_params is overloaded in the pipeline. set_params
>>> is overloaded in the SGG (but that does not seem a worth while use, and I
>>> wouldn't mind removing it).
>>>
>>> > We could even go one step further, and instead of using set_params,
>>> > directly build the subestimator behavior into "clone".
>>> > The only application for get_params that we currently have afaik is
>>> > est_with_params = clone(est).set_params(**params)
>>> > If we instead did
>>> > est_with_params = clone_with_params(est, **params)
>>>
>>> I have been using set_params in my own interactive work, to modify params
>>> on the fly. It wouldn't be the end of the world if the method goes away,
>>> as long as we can still assign values to attributes.
>>>
>>> If we can get rid of the overrides of set_params and get_params in our
>>> codebase, I am not opposed to the plan.
>>>
>>> That said, I think that the OP was really careless, and get_params /
>>> set_params are not that tricky. We've had issues like this previously was
>>> people not implementing proper __init__. The most important thing is to
>>> capture these API errors and give a good error message.
>>>
>>> > we could use __init__ to set the parameters directly, which would allow
>>> > us to do input validation in __init__.
>>>
>>> The logic for not putting input validation in __init__ is that it is
>>> legit to do:
>>>
>>> clf = Blah(param1=1)
>>> clf.param1 = 2
>>> clf.fit(...)
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>>> Get technology previously reserved for billion-dollar corporations, FREE
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Scikit-learn-general mailing list
>>> Scikit-learn-general@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>
>>
>> ------------------------------
>>
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
>>
>> ------------------------------
>>
>> Scikit-learn-general mailing list
>> Scikit-learn-general@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general