> 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