scikit-learn/scikit-learn — pull request #4029 by ragv (2014-12-29 23:22:14+00:00)
Title: [WIP] Add NotFittedError class and fix all modules to raise uniform errors when not fitted

Fixes #3627

- [x] Add `util.validation.NotFittedError`
- [x] Add `_is_fitted` method to check and return boolean, if the passed estimator has `all_or_any` of the passed attributes.
- [x] Add `check_is_fitted` to raise `NotFittedError` when the given attribute(s) aren't available in the passed estimator instance.
- [x] Refactor existing modules to use `check_is_fitted`
- [x] Add tests to ensure all the unfitted estimators {regressors, classifiers, transformers} raise `NotFittedError` when predict ( or related methods are called ).
Thanks to @jnothman for [this](https://github.com/jnothman/scikit-learn/compare/scikit-learn:master...jnothman:unfitted-error)
- [x] Run smoke test and fix all modules which do not currently raise an error, when `predict` like methods are called before `fit`-ing
- [ ] Make travis happy

The `check_is_fitted` should behave more ideally after #3937 is merged...