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.
It is not hidden (best_estimator_, not _best_estimator) and well documented.
you can also look at best_score_ (also not hidden and well documented).
I am not sure why you would expect get_params to provide it, as this give you the parameters you set on the model in construction,
which is the same that __repr__ shows.
The __repr__ never shows any thing that is learned, just the parameters it was constructed with.



On Thu, Jan 22, 2015 at 5:33 PM, Joel Nothman <joel.noth...@gmail.com <mailto:joel.noth...@gmail.com>> wrote:

    That's not the learnt estimator. You're looking at the initial
    input (i.e. the parameters that are or are not changed during the
    search). The learnt estimators are cloned from that one, and the
    best is stored at clf.best_estimator_ (if refit=True)

    Cheers, Joel

    On 23 January 2015 at 12:20, Aardvark Zebra <exma...@gmail.com
    <mailto:exma...@gmail.com>> wrote:

        I just started with s-l, and was playing around with it in
        iPython using the Iris set.

        I created an SVM classifier thusly:

        clf = grid_search.GridSearchCV(svm.SVC(),
        param_grid={'kernel':('linear', 'rbf'), 'C':arange(10,20)})

        (Basically, I want to grid-search for different parameters of
        "C", and 2 kernel functions).

        However, when I train it (fit) like this:
        clf.fit(iris.data, iris.target)

        I get the following back:

        GridSearchCV(cv=None,
           estimator=SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, 
degree=3, gamma=0.0, kernel='rbf', max_iter=-1, probability=False, 
random_state=None,
           shrinking=True, tol=0.001, verbose=False),
           fit_params={}, iid=True, loss_func=None, n_jobs=1,
           param_grid={'kernel': ('linear', 'rbf'), 'C': array([10, 11, 12, 13, 
14, 15, 16, 17, 18, 19])},
           pre_dispatch='2*n_jobs', refit=True, score_func=None, scoring=None, 
verbose=1)

        The learned estimator has "C" = 1.0 ; when the grid-search was for the 
range 10 .. 19 (it's just an example...).

        Shouldn't the value of C be in this range?


        Thanks.



        
------------------------------------------------------------------------------
        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
        <mailto:Scikit-learn-general@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/scikit-learn-general



    
------------------------------------------------------------------------------
    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
    <mailto:Scikit-learn-general@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/scikit-learn-general




------------------------------------------------------------------------------
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

------------------------------------------------------------------------------
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