* FIX enforce deterministic behaviour in BaseBagging
* DOC add entry in whats new for model changes
* add comments
* revert space
* revert space right place
* Typo
* FIX change estimators_samples_
* TST check size training set and hash during bootstrapping
* DOC/TST API entry in doc and style correction
* DOC move entry in the right section
* DOC add missing author and issue
* DOC add details in whats new entry
* FIX add hash from joblib in utils
* iter
In order to fix#11408, this swaps `joblib` and `_joblib`. It however, allows users to access joblib's `Memory` or `Parallel` functionality without accessing `sklearn.externals._joblib` by importing `Memory`, `Parallel`, etc. into `sklearn.utils`.
Closes https://github.com/scikit-learn/scikit-learn/issues/11121
This PR removes the deprecation warning about ABC being moved from `collections` to `collections.abc` when importing scikit-learn in Python 3.7.
In the end, I put `collections.abc.{Sequence, Iterable, Mapping, Sized}` in the namespace of `sklearn.utils.fixes`. This was the simplest way I could find, and while it has the drawback of obfuscating the real module name, other approached appeared more problematic and a similar approach is currently used e.g. for `utils.fixes.signature` which is an alias for `inspect.signature`.
We can't just patch six with https://github.com/benjaminp/six/pull/241, because sklearn uses six from 5 years ago, which would need updating and I'm not sure if it could have side effects (e.g. for pickling backward compatibility etc).
**Edit**: This adds a test checking that generally no warnings are raised when importing scikit-learn top-level modules.
* Change named_steps to Bunch object
* Update named_steps attribute documentation
* Add test for named steps bunch object
* Delete whitespace in test_pipeline
* Update test_pipeline.py
* Add comment for named_steps usage
* Move dataset/Bunch to utils
* Fix to PEP8 format
* Add __getattribute method to Bunch class, Fix pep8 bug
* Remove __getattribute__, update test_pipeline
* Update test with conflict and non-conflict named_steps
* Add reference to class Pipeline
* remove stuff to be removed 0.19
* more changes
* remove classes from 0.19 whatsnew
* remove _LearntSelectorMixin
* remove ProjectedGradientNMF, load_lwf_*
* minor fixes
* remove more copy from logistic regression path
* remove lda, qda from __init__.__all__
* remove pg solver in nmf from tests etc
* remove class_weight="auto" from tests
* doctest change for decision_function_shape="ovr"
* remove transfrom from tree test, minor fixes to tree tests
* some fixes in the tests
* undo changes in functions which still allow 1d input...
* also allow 1d in scale
* more test fixes...
* last test fixes in forest and tree
* svm default value change doctest failures
* pep8
* remove more class_weight="auto" stuff
* minor cosmetics in docstrings deprecated / removed behavior.
* say that store_covariance has been moved to __init__ in discriminant_analysis
* Remove heavy memory footprint for OOB scoring from bagging.
- Remove `estimators_samples` attribute from `BaseBagging`
- Add method `_get_estimators_samples` to `BaseBagging` that
returns a generator producing sample indices on demand.
- Slight refactor of `_parallel_build_estimators()` to
isolate and group lines accessing random state.
* Replaced `BaseBagging.estimators_samples_` attribute with property.
- Accessing `BaseBagging.estimators_samples_` now triggers call to
`BaseBagging._get_estimators_samples` as well as deprecation
warning for release 0.20.
- This should make the fix for the OOB memory issue fully backwards
compatible.
* Remove print statement.
* Added test, made new method more general.
- Added test to `test_bagging.py` to ensure that indices generated
on the fly are identical to indices generated at fit time.
- Refactored `_get_estimators_samples()` to `_get_estimators_indices()`,
now both feature and samples indices are returned.
- Refactored `estimators_samples_()` to deal with above.
* Rename index generating functions and arguments.
* `estimators_samples_()` returns list instead of generator
* Removed `estimators_samples_` deprection warning.
* Actually removed `estimators_samples_` deprecation warning.
* New mask generation function, new bagging test, new BaseBagging attributes.
- Added new private function in bagging.py that converts indices to
a boolean mask.
- Added new bagging test to make sure identical OOB scores are generated
when the same estimator if fit with fixed random state and identical
training data.
- Added new private attributes `BaseBagging._max_features` and
`BaseBagging._max_samples` to store validated input values.
* Streamlined code, improved `estimators_samples_()` documentation.
- Removed `max_samples` argument from `_parallel_build_estimators()`,
this value is now accessed via `ensemble._max_samples`.
- Removed validation of `ensemble.max_features` and `max_samples`,
instead use `ensemble._max_features` and `ensemble._max_samples`
which are assumed to be already validated.
- Removed unnecessary `samples` variable from `_parallel_build_estimators()`.
- Changed the way `random_state` is generated in `_parallel_build_estimators()`
and `BaseBagging._get_estimators_data_draws()` to direct numpy method to
reflect that seeds created in `BaseBagging._fit()` are trustworthy.
- Due to above removed generation of new seed for each estimator in
`_parallel_build_estimators()` and `BaseBagging._get_estimators_data_draws()`.
- Added documentation to `BaseBagging.estimators_samples_()` property
indicating the reason it's generated dynamically and the associated performance
penalty.
- Returned `BaggingClassifier._set_oob_score()` and `BaggingRegressor._set_oob_score()`
to directly accessing `self.estimators_samples_`.
* Streamlined code, improved `estimators_samples_()` documentation.
- Removed `max_samples` argument from `_parallel_build_estimators()`,
this value is now accessed via `ensemble._max_samples`.
- Removed validation of `ensemble.max_features` and `max_samples`,
instead use `ensemble._max_features` and `ensemble._max_samples`
which are assumed to be already validated.
- Removed unnecessary `samples` variable from `_parallel_build_estimators()`.
- Changed the way `random_state` is generated in `_parallel_build_estimators()`
and `BaseBagging._get_estimators_data_draws()` to direct numpy method to
reflect that seeds created in `BaseBagging._fit()` are trustworthy.
- Due to above removed generation of new seed for each estimator in
`_parallel_build_estimators()` and `BaseBagging._get_estimators_data_draws()`.
- Added documentation to `BaseBagging.estimators_samples_()` property
indicating the reason it's generated dynamically and the associated performance
penalty.
- Returned `BaggingClassifier._set_oob_score()` and `BaggingRegressor._set_oob_score()`
to directly accessing `self.estimators_samples_`.
* PEP8, remove optional arguments, add public function to utils.
- Update indentation and line length to conform to PEP8.
- Update `estimators_samples_()` docstring to conform to PEP8 and
PEP257.
- Remove optional arguments to `BaseBagging._get_estimators_data_draws()`,
rename to `BaseBagging._get_estimators_indices()`.
- Remove optional arguments from `_generate_mask_from_indices()`,
move to `utils.metaestimators`, rename to `indices_to_mask()`.
* Add indices_to_mask to __all__ in utils.metaestimators
* Move utils function, new test for `estimators_samples` correctness.
- Moved `indices_to_mask` from `utils.metaestimators` to `utils.validation`
- Added new test to `ensemble.test_bagging` to make sure refitting
an individual estimator from the bagging ensemble using the corresponding
samples identified in `BaseBagging.estimators_samples` returns the same model.
* Adjust/remove tests, move `indices_to_mask` to `utils.__init__`.
- Remove test_bagging.test_consistent_index_sampling
- Update formatting checks in test_bagging.test_estimators_samples
to make sure each mask is numpy boolean array
- Move indices_to_mask from utils.validation to utils.__init__
* update class docstring for `estimators_samples_`
- Updated class docstring of `estimators_samples_` attribute for `BaggingClassifier` and `BaggingRegressor` to indicate that samples are identified with boolean masks.
* PEP8, made `max_samples` arg optional in _fit()
- Fixed PEP8 issues.
- Gave `max_samples` argument of `BaseBagging._fit()` a default
value of `None` as indicated in the docstring. Added code to
check for and process `None` value.
- Added a few more comments to `_fit()`.
* 2 new `max_samples` consistency tests, update whats_new.rst
* Minor change
* Update whats_new.rst
Add gradient calculation in _huber_loss_and_gradient
Add tests to check the correctness of the loss and gradient
Fix for old scipy
Add parameter sigma for robust linear regression
Add gradient formula to robust _huber_loss_and_gradient
Add fit_intercept option and fix tests
Add docs to HuberRegressor and the helper functions
Add example demonstrating ridge_regression vs huber_regression
Add sample_weight implementation
Add scaling invariant huber test
Remove exp and add bounds to fmin_l_bfgs_b
Add sparse data support
Add more tests and refactoring of code
Add narrative docs
review huber regressor
Minor additions to docs and tests
Minor fixes that deals with dealing with NaN values in targets
and old verions of SciPy and NumPy
Add HuberRegressor to robust estimator
Refactored computation of gradient and make docs render properly
Temp
Remove float64 dtype conversion
trivial optimizations and add a note about R
Remove sample_weights special_casing
address @amueller comments
in other modules where warnings are deprecated.
Prefix warnings imported from sklearn.exceptions instead of
suffixing to prevent showing both the suffixed warning
and the deprecated warning during tab completion.
ENH NonBLASDotWarning -> EfficiencyWarning; Improve error message
DOC Add exceptions module to modules/classes.rst
MAINT Move ConvergenceWarning, UndefinedMetricWarning et al into exceptions
MAINT Remove ChangedBehaviorWarning from base
DOC/FIX Improve DataConversionWarning's docstring
Passing 1D arrays to check_array, without setting `ensure_2d` to false now
raises a deprecation warning before reshaping it. This will later throw an
error.
All Scaler classes also throw warnings when 1D arrays are passed.
All unit tests/doctests are modified to ensure that no 1D arrays are passed,
except in explicit 1D array tests where the warnings have been silenced.
Additional tests are also included which check for different 1D array cases.
2D array tests with one samples and one features are also added and where
they failed, `check_array` call has been modified to give a more useful error
message
ENH improve check_array to warn on dtype conversions
ENH make check_array accept several dtypes
ENH change validation with improved check_array
ENH change astype to avoid copy if possible
ENH remove warn_if_not_float
DOC max_iterations -> max_iter. Make it consistent with kmeans
MAINT Replace the deprecated dx parameter with d in the docstrings
MAINT Deprecation warning for max_iterations parameter.
- Typo fixed in linear_model documenation
- Usage of matplotlib.pyplot instead of matplotlib.pylab
- Removed trailing backslash in import statements
- Renamed _modweiszfeld_step to _modified_weiszfeld_step
- Renamed variable fst to first_elem in _lstq
- Made get_n_jobs private in utils/__init__.py