diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-03-06 16:06:17 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-03-06 16:06:17 +0000 |
| commit | aee92cf879fbd11975cca4b9cfd2cc110b6cb229 (patch) | |
| tree | a1d14049cc7e2bc34362ab72a5748e37590db65e /gensvm/sklearn_util.py | |
| parent | Update Makefile to current workflow (diff) | |
| parent | Merge branch 'master' into packaging (diff) | |
| download | pygensvm-aee92cf879fbd11975cca4b9cfd2cc110b6cb229.tar.gz pygensvm-aee92cf879fbd11975cca4b9cfd2cc110b6cb229.zip | |
Merge branch 'packaging'
Diffstat (limited to 'gensvm/sklearn_util.py')
| -rw-r--r-- | gensvm/sklearn_util.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gensvm/sklearn_util.py b/gensvm/sklearn_util.py index 182f257..eb8ceb6 100644 --- a/gensvm/sklearn_util.py +++ b/gensvm/sklearn_util.py @@ -89,7 +89,9 @@ def _skl_format_cv_results( score_time, ) = zip(*out) else: - (test_score_dicts, test_sample_counts, fit_time, score_time) = zip(*out) + (test_score_dicts, test_sample_counts, fit_time, score_time) = zip( + *out + ) # test_score_dicts and train_score dicts are lists of dictionaries and # we make them into dict of lists @@ -160,7 +162,9 @@ def _skl_format_cv_results( ) if return_train_score: _store( - "train_%s" % scorer_name, train_scores[scorer_name], splits=True + "train_%s" % scorer_name, + train_scores[scorer_name], + splits=True, ) return results @@ -207,7 +211,12 @@ def _skl_check_is_fitted(estimator, method_name, refit): "attribute" % (type(estimator).__name__, method_name) ) else: - check_is_fitted(estimator, "best_estimator_") + if not hasattr(estimator, "best_estimator_"): + raise NotFittedError( + "This %s instance is not fitted yet. Call " + "'fit' with appropriate arguments before using this " + "estimator." % type(estimator).__name__ + ) def _skl_grid_score(X, y, scorer_, best_estimator_, refit, multimetric_): |
