Commit Graph

105 Commits

Author SHA1 Message Date
Roman Yurchak 701144559f MAINT Remove unused utils.fixes (#12928)
This continues the work done in https://github.com/scikit-learn/scikit-learn/pull/12639 on dropping the python 2 support by,
 - ~~removing unnecessary `from __future__` imports~~
 - removing unused `sklearn.utils.fixes` assuming we can agree in https://github.com/scikit-learn/scikit-learn/issues/12927 that `sklearn.utils.fixes` are private as was stated e.g. in https://github.com/scikit-learn/scikit-learn/issues/6616#issuecomment-245109979
2019-01-08 12:43:49 +11:00
Adrin Jalali 2bd87f6ed8 Remove python < 3.5 from CI (#12746) 2018-12-14 10:53:12 +01:00
jeremiedbb 4e8194909c FIX remove FutureWarning in _object_dtype_isnan and add test (#12567) 2018-11-12 21:28:05 +08:00
Joel Nothman 1128094271 BLD we should ensure continued support for joblib 0.11 (#12350) 2018-11-06 22:10:23 +01:00
Nicolas Hug 6d15840432 DOC Fixed doc issues for utils module (#11445) 2018-07-22 15:23:11 +10:00
Roman Yurchak c09352c241 [MRG] Fix DeprecationWarning due to collections.abc in Python 3.7 (#11431)
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.
2018-07-14 15:14:02 -05:00
Guillaume Lemaitre f8adfa27ae [MRG] Ignore and pass-through NaNs in RobustScaler and robust_scale (#11308) 2018-07-05 16:34:31 +02:00
Gael Varoquaux 106bb9e7f5 MAINT: option to unvendor joblib (#11166) 2018-06-29 16:35:45 +02:00
Guillaume Lemaitre c1bc665958 ENH ignore NaNs in PowerTransformer (#11306) 2018-06-22 08:22:24 +10:00
jeremiedbb 0d8a04bd17 [MRG+1] SimpleImputer(strategy="constant") (#11211) 2018-06-20 17:20:33 +02:00
Guillaume Lemaitre b9f3758dfd MAINT add function to ignore nan in min/max sparse functions (#11196) 2018-06-07 06:57:30 +10:00
Guillaume Lemaitre c3548a8e29 [MRG] EHN handle NaN value in QuantileTransformer (#10437) 2018-04-21 19:06:10 +02:00
Joel Nothman df3f7b3b50 PEP8 2018-02-28 15:24:05 +11:00
Loïc Estève e9e623156a MAINT: fix typo in scipy version comment 2018-02-27 14:58:59 +01:00
Joris Van den Bossche a2ebb8cfd2 ENH: new CategoricalEncoder class (#9151) 2017-11-21 20:03:41 +11:00
Naoya Kanai 95aa2952e1 Add logsumexp and comb to utils.fixes (#9046) 2017-06-10 15:01:02 +02:00
Naoya Kanai 6579220588 [MRG+1] Drop NumPy < 1.8 (#8874) 2017-06-07 17:06:06 +02:00
Naoya Kanai bd0fc236e0 [MRG+1] MAINT drop SciPy < 0.13 (#8854)
Remove sklearn.utils.fixes functions that are not needed for scipy >= 0.13 and keep deprecated wrappers in other modules.
2017-06-02 23:36:33 +02:00
Peter Wang 4ab99c75b4 [MRG+1] FIX Correct depth formula in iforest (#8576)
* Fixed depth formula in iforest

* Added non-regression test for issue #8549

* reverted some whitespace changes

* Made changes to what's new and whitespace changes

* Update whats_new.rst

* Update whats_new.rst

* fixed faulty whitespace

* faulty whitespace fix and change to whats new

* added constants to iforest average_path_length and the according non regression test

* COSMIT

* Update whats_new.rst

* Corrected IsolationForest average path formula and added integer array equiv test

* changed line to under 80 char

* Update whats_new.rst

* Update whats_new.rst

* reran tests

* redefine np.euler_gamma

* added import statement for euler_gammma in iforest and test_iforest

* changed np.euler_gamma to euler_gamma

* fix small formatting issue

* fix small formatting issue

* modified average_path_length tests

* formatting fix + removed redundant tests

* fix import error

* retry remote server error

* retry remote server error

* retry remote server error

* re-added some iforest tests

* re-added some iforest tests
2017-03-14 16:50:23 +01:00
willduan 1f278e1c23 Fix version comparison for the numpy 1.12 beta (#7902) 2016-12-05 10:22:26 +01:00
Loïc Estève e5bf61eee1 [MRG+1] Dropping python 2.6 support (#7890)
* Remove Python 2.6 support

Some details about some slightly orthogonal changes:
* Note about cheking safely for nan is likely not valid any more (commit
  introducing it is c80ca91b)
* scipy.linalg.qr econ parameter removed since scipy 0.9 in favour of
  mode='economic'
* Remove unnecessary libgfortran in conda create command

* Putative fix by setting the random seed

* Revert unintended change

* Reinstate previous logic for checking for NaNs

* Reinstate change in error message

Error messages from Python 2.7 assertRegexp does not contain the
function name, in contrast with Python 3 assertRegex
2016-11-23 17:11:04 -05:00
Antoine Wendlinger 74a9756fa7 [MRG+2] Norm inconsistency between RFE and SelectFromModel (was _LearntSelectorMixin) #2121 (#6181)
* Norm inconsistency between RFE and SelectFromModel (was _LearntSelectorMixin) #2121

* safe_pwr utility

* Norm fix

* Removed safe_pwr

* 1D arrays support for norm fix

* Test case for 2d coef in SelectFromModel

* Fix numpy version requirement for norm fix

* Implement fixes suggested by @jnothman

* Add numpy version requiring the fix.
2016-10-24 14:01:49 -04:00
Raghav RV 868a58b2e0 [MRG+1] FIX Make sure GridSearchCV and RandomizedSearchCV are pickle-able (#7594)
* FIX Subclass a new MaskedArray which allows pickling even when dype=object

* TST unpickling too

* FIX Use MaskedArray from utils.fixes rather than from numpy

* FIX imports

* Don't assign a variable

* FIX np --> numpy

* Use tostring instead of tobytes for old numpy

* COSMIT pickle-able --> picklable

* use #noqa comment to turn off flake8

* TST/ENH Check if the pickled est's predict matches with the original one's
2016-10-10 15:33:44 -04:00
Andreas Mueller 280c70bf4f add numpy versions for backports / fixes 2016-10-04 11:20:12 -04:00
jblackburne ba7cf38f99 Removed isclose from _binary_clf_curve. (#7353)
Added a bugfix report to whats_new.rst. Modified a unit test to check for the kind of problems caused by isclose.
2016-09-11 12:48:32 +10:00
Raghav R V afd5d18b0c [MRG] ENH Restructure grid_scores_ into a dict of 1D arrays
Also, DOC what's new section for model_selection changes
2016-06-16 12:23:04 +10:00
Vighnesh Birodkar f46033067d docstring elaboration and typo in fixes.py 2016-04-05 19:57:19 -04:00
Andreas Mueller 7efeb5ab60 ENH added elkan k_means algorithm
renamed elkan -> triangle_inequality, lloyd-> full

pep8, rename _kmeans_single -> _kmeans_single_lloyd

add a docstring to elkans k-means in cython.

fixed text for full

Fixed elkans kmeans so that predict is same as labels

Added test to ensure full and triangle_inequality give same results

changed triangle_inequality to elkan

Addressed review comments

removed rebase artifacts

correct whats_new

moved enhancement bullet to 0.18

removed extra newline

strong typing dor prototype

fixed random state

removed c file

removed merge artifacts

removed entry from 0.17

Add documentation and inline_comments to _k_means_elkan.pyx

Minor rearrngement of docstring sentences

removed call to np.sort to improve speed for large number of clusters

replced logic with call to np.partition

Fallback to sort if partition does not exist

use partition from fixes rather than numpy
2016-04-05 19:57:19 -04:00
Tim Head 07cede74ca Multitarget regression meta estimator
Register OneVsRestRegressor as meta estimator

Rename to a more sensible name

Parallel predict and sparse support

Started MultiOutput documentation

Move code to new file multioutput.py

Continuing the move to new multioutput module

Added sample weight support

Better test for sample weights and actually support weights

Added a new test using weighted vs repeated samples to
test sample weight support. Uncovered that weights
were not actually passed on to underlying estimator.

Comment on multiprocess overheads

Move parallel_helper to utils.fixes

This helper works around a python2 limitation on pickling
instance methods

Example of multi-output regression with gradient boosting

Switch to uniform weighted score and updated example

The example now uses a RF with and without the MultiOutput
meta estimator

Added note for removing `score` method

Addressing comments on MultiOutputRegressor

MultiOutputregressor better test for weighted samples

Fix ups

Use explicit keyword argument for passing sample weights and
fix random_state on train-test split in the example
2016-03-10 16:06:08 -05:00
Raghav R V a87011262a FIX precision to float64 across the codebase 2015-10-16 11:20:29 +02:00
Olivier Grisel 6966881328 MAINT use inspect.signature for introspection 2015-09-23 16:30:53 +02:00
TomDLT fecd35567e FIX array_equal for numpy < 1.8.1 2015-09-16 19:15:48 +02:00
TomDLT 792e529519 add fetch_rcv1 2015-07-16 12:29:00 +02:00
Olivier Grisel f9eb9cfbee STYLE whitespace around operator in sklearn.utils.fixes 2015-04-13 11:20:36 -04:00
Olivier Grisel 7ac6c9b3ac FIX respect astype(array, dtype, copy=True) on old numpy 2015-04-09 08:02:03 -04:00
Loïc Estève bd9d16b5ee Simplify the code by using len 2015-02-01 18:48:05 +01:00
Loïc Estève 67dcd99d82 TST fix tests with numpy 1.6.1
np.bincount raises an Exception with empty input arrays for numpy versions < 1.6.2
Add utils.fixes.bincount to tackle this issue and use it instead of np.bincount
2015-02-01 15:49:49 +01:00
Joel Nothman 0c9377ece9 ENH use parallelism for all metrics in pairwise_{kernels,distances} 2015-01-17 21:48:17 +11:00
Olivier Grisel 54f483aafa FIX #2986: ZeroDivisionError in LinearRegression on sparse data 2014-11-14 12:51:43 +01:00
Lars Buitinck a7a05120e2 MAINT: handle frombuffer with empty 1st arg in utils.fixes 2014-09-22 17:23:51 +02:00
Joel Nothman 69af355dc2 FIX only use testing.ignore_warnings in tests 2014-08-06 09:59:42 +10:00
Hamzeh Alsalhi cbcae0459c FIX Support unseen labels LabelBinarizer and test
This fix restores the default behavior of 0.14.1 for backward
compat.
2014-07-29 16:21:04 +02:00
Gael Varoquaux 4aac610dc3 TST: Fix warnings in np 1.9
These break our tests
2014-07-25 13:40:47 +02:00
Lars Buitinck 7d564b3c76 FIX expit bug with out != None 2014-07-14 22:30:02 +02:00
Jeffrey Blackburne 58c0a757f1 PEP8 fix 2014-06-13 22:11:53 -07:00
Jeffrey Blackburne 6ea9fbeddb Added a backport of numpy.isclose from numpy v1.8.1. This function was not available until numpy v1.7 2014-06-13 22:02:59 -07:00
Lars Buitinck f4251347af ENH/DOC fix poly features complexity
Fixes #3191, #3194.
2014-06-05 17:45:32 +02:00
CJ Carey 46aebf132b ENH: use partial sort for kneighbors selection 2014-05-30 21:11:50 +02:00
Thomas Unterthiner 325e998fcc Extend utils.sparsefuncs: inplace scale and axis min/max 2014-05-18 20:03:37 +10:00
Olivier Grisel 58577203e7 FIX: remove casting warning under Python 3 2014-03-29 00:43:35 +01:00