On 01/23/2015 07:35 PM, Aardvark Zebra wrote:
> Thanks! It seems very counter-intuitive. If I'm calling fit(), it 
> should return the
> best model after grid search (especially if I'm giving refit=True as a 
> parameter).
> Unfortunately, printing the return value doesn't show the best 
> estimator; even
> the get_params() call doesn't reveal it. One has to access the 
> "hidden" _best_estimator
> parameter.
>
Maybe more of an explanation for the behavior:
All calls to ``fit`` will return ``self``, which is useful for chaining 
operations.
If you call anything on the GridSearchCV object that is returned, it 
will behave as the best estimator.
So in a way it does return the model that you are looking for, and you 
can use it without accessing ``best_estimator_``
just by using the GridSearchCV object that is returned.
The only thing that might be somewhat surprising is the repr, but if you 
look at it, you see it is the GridSearchCV object,
with exactly the parameters you gave for constructing it.

I'm not sure if it makes much difference for the usage whether 
GridSearchCV.fit returns self or best_estimator_,
but it is much more consistent with the behavior of the rest of the library.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to