Hi Ronnie.
Please send any requests and questions to the main mailing list,
so that anyone can answer.
For you problem: I'm pretty sure you are not looking at the version of the documentation
that corresponds to the version you have installed.
Which version do you have installed?

Best,
Andy

On 01/04/2013 11:22 PM, Ronnie Ghose wrote:
Should i submit a bug for

http://scikit-learn.org/0.12/modules/generated/sklearn.grid_search.GridSearchCV.html

as there is no best_params_ or best_score_ as far as I can see.


dir( GridSearchCV)
=====

['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_fit', '_get_param_names', '_set_methods', 'best_estimator_', 'cv', 'estimator', 'fit', 'fit_params', 'get_params', 'iid', 'loss_func', 'n_jobs', 'param_grid', 'pre_dispatch', 'refit', 'score', 'score_func', 'set_params', 'verbose']
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/sghose/ADAPT/engine/engine.py", line 55, in <module>
    main()
  File "/home/sghose/ADAPT/engine/engine.py", line 50, in main
    iris_gs()
  File "/home/sghose/ADAPT/engine/engine.py", line 45, in iris_gs
    print m.getBest()
  File "ADAPT/genclf/model.py", line 197, in getBest
    print [(k,e.best_params_) for k,e in self._gridENGINES.items()]
AttributeError: 'GridSearchCV' object has no attribute 'best_params_'

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/sghose/ADAPT/engine/engine.py", line 55, in <module>
    main()
  File "/home/sghose/ADAPT/engine/engine.py", line 50, in main
    iris_gs()
  File "/home/sghose/ADAPT/engine/engine.py", line 45, in iris_gs
    print m.getBest()
  File "ADAPT/genclf/model.py", line 197, in getBest
print [(k,e.best_score_,e.best_score) for k,e in self._gridENGINES.items()]
AttributeError: 'GridSearchCV' object has no attribute 'best_score_'

this is sort of weird since there IS a best_score in GridSearch but it's local and part of the _fit() method

======

        # Note: we do not use max(out) to make ties deterministic even if
        # comparison on estimator instances is not deterministic
        best_score = -np.inf
        for score, params in scores:
            if score > best_score:
                best_score = score
                best_params = params

        if best_score is None:
            raise ValueError('Best score could not be found')
        self.best_score_ = best_score
        self.best_params_ = best_params

        if self.refit:
            # fit the best estimator using the entire dataset
            # clone first to work around broken estimators
            best_estimator = clone(base_clf).set_params(**best_params)
            best_estimator.fit(X, y, **self.fit_params)
            self._best_estimator_ = best_estimator
            self._set_methods()

======

(ignore the italics. my email client is acting up)



------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to