Commit Graph

88 Commits

Author SHA1 Message Date
sakinaOuisrani f9d74236e2
fix docstring of dict_learning.sparse_encode and multiclass.check_classification_targets #21350 #pariswimlds (#22793)
* fix docstring

* fixed linting in multiclass

* fixed linting in dict learning

* fixed linting in dict learning

* fixed linting in dict learning

* fixed linting in dict learning

* fixed linting in dict learning

Co-authored-by: Sakina <s.ouisrani@sesamm.com>
2022-03-12 18:41:19 +01:00
Eric Larson d63405f1bb
MNT Use non-deprecated SciPy imports (#21603) 2021-11-09 21:00:27 +01:00
Olivier Grisel 2571cb2989
Improve validation messages with infinite data (#21219)
* Improve validation messages with infinite data

* Extend and fix validation tests

* Test and fix extended error message

* data_name => input_name

* Mention estimators that natively support missing values

* More informative error message

* cosmetic

* typo

* Fix broken tests

* Fix test_knn

* Add changelog entry

* Fix broken test for param search models

* Missing input names

* Allow Y and y in estimator checks

* Add missing input names

* Fix input_name for FunctionTransformer

* More missing input names

* Update test

* More test fixes on scores

* Simplify message to avoid to make generic fallback meaningful

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* More informative estimator checks failure messages

* Make sure the estimator name is passed correctly in _validate_data

* Simplify calls to _validate_data

* Handle estimator name in private _check_y helper

* More specific error message

* Add estimator to check_X_params and check_y_params

* Add .. versionadded flags in public docstrings

* Update changelog

* Improve _validate_data's docstring

* Typo in doc/whats_new/v1.1.rst

* Make _check_estimator_name return None if estimator == None

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>

* check_params dict updates with style

* Increase test coverage

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-10-29 15:59:57 +02:00
Thomas J. Fan d1285a9232
DOC Adds missing imports into examples and test them (#21186) 2021-09-29 13:51:33 +02:00
Thomas J. Fan 3ae7c76153
STY Enables black with experimental_string_processing=true (#20412) 2021-06-29 09:47:04 +02:00
Thomas J. Fan 82df48934e
MNT Applies black formatting to most of the code base (#18948) 2021-06-17 14:21:09 -04:00
Oleh Kozynets 4c547b6def
FIX handle VisibleDeprecationWarning in type_of_target and is_multilabel (#18423)
Co-authored-by: Oleh Kozynets <olehkss@github.com>
2020-10-29 10:44:13 -04:00
Frans Larsson 9c7ec1b857
DOC Fix doc of defaults in sklearn.utils.multiclass.py (#18021) 2020-07-28 14:46:06 -04:00
Juan Carlos Alfaro Jiménez cd3dfa02a1
MNT Remove unnecessary try and except for numpy 1.3 (#17957) 2020-07-21 09:19:40 +10:00
Nicolas Hug 76ef8b0ef0
API kwonly for utils (#17046)
* kwonly for utils

* More

* fixed some

* some more

* iwannagohomepls

* accept_sparse not kwonly anymore
2020-04-27 15:42:01 +02:00
Roman Yurchak f621d8a392
Revert "API kwonly for utils (#17007)" (#17045) 2020-04-26 18:30:09 +02:00
Nicolas Hug 81c1e9d1f2
API kwonly for utils (#17007) 2020-04-26 18:05:16 +02:00
Léonard Binet 846e6a38b0 ENH Support for list of lists or list of arrays multilabel indicator (continuation) (#14865) 2019-10-25 11:37:18 +11:00
Andreas Mueller a91bae74aa MNT Add estimator check for not calling __array_function__ (#14702) 2019-10-24 16:42:10 -04:00
Adrin Jalali 0eebade264 DOC docstring (shape= -> of shape) (#14640) 2019-10-02 20:54:32 -04:00
Thomas J Fan cc64397d0c FIX Errors for pandas sparse arrays as target (#14125) 2019-07-19 09:58:00 +02:00
Jonathan Ohayon d045c1abc8 [MRG+2] Change ovr_decision_function scale (#10440)
* unit test for _ovr_decision_function

* sigmoid scale

* error on subset test

* clearer comment on test

* new scaling function forget sigmoid

* remove exception in subset check for SVC decision_function

* add comment and update whats_new

* update comment

* change test for float imprecision

* use 1/3 instead of 1/2

* merge conflict error

* flake8 correction and assert_true replacement

* better comment

* refer to public functions

* remove reference to private function

* rst dots

* change fix comments
2019-02-28 15:04:50 +01:00
Andreas Mueller ab2f539a32 API: Estimator tags (#8022) 2019-02-23 22:54:41 +01:00
Peter Cock f4060cbac0 MNT Clearer exception on legacy multi-label data representation (#13184) 2019-02-19 19:55:46 +08:00
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
Roman Yurchak 684d8a221d MAINT Use set litterals when possible (#12667) 2019-01-06 19:21:45 +08:00
Andreas Mueller 952ef6637a MRG Drop legacy python / remove six dependencies (#12639) 2019-01-03 15:50:05 +02: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
Joel Nothman c3bdc0a89a
DOC clean up assorted type specifications (#10441) 2018-01-11 09:11:17 +11:00
Joel Nothman bb4cddecae DOC clarify input to _ovr_decision_function 2018-01-08 21:48:37 +11:00
nielsenmarkus11 3a48f0ab7c [MRG+1] Raise error when SparseSeries is passed into classification metrics (#7373)
* Raise error when SparseSeries is passed into roc_curve

* Changed "y_true" in second if block to "y_score"

* Remove code to import pandas and add sparseseries check to 'type_of_target' function. Finally, add 'type_of_target' call to _binary_clf_curve

* Remove pandas import and old comparison in roc_curve.

* Add test for 'type_of_target' function

* Add white space after commas

* Correct other white space issues

* Move type_of_target test into try clause, remove test_precision_recall_curve_pos_label since as multiclass it doesn't make sense

* Add test_precision_recall_curve_pos_label back in and also add test_binary_clf_curve to test new logic in _binary_clf_curve function

* Correct syntax and formatting.

* Remove trailing white space

* Correct validation logic

* Update test_multiclass.py per @jnothman 's request.

* Import SkipTest function.

* Remove extra white space from line 303
2017-10-06 17:00:39 +02:00
Joel Nothman e31c4f1e9e DOC List more utils in API ref (#8827) 2017-06-08 15:31:26 +02:00
Naoya Kanai 6579220588 [MRG+1] Drop NumPy < 1.8 (#8874) 2017-06-07 17:06:06 +02:00
Andreas Mueller 1c41368bac [MRG+1] Uncontroversial fixes from estimator tags branch (#8086)
* some bug fixes.

* minor fixes to whatsnew

* typo in whatsnew

* add test for n_components = 1 transform in dict learning

* feature extraction doc fix

* fix broken test

* revert aggressive input validation changes

* in SelectFromModel, don't store threshold_ in transform. If we called "fit", use estimates from last "fit".

* move score from EllipticEnvelope to OutlierDetectionMixin

* revert changes to Tfidf documentation

* remove dummy input validation from whatsnew

* fix text feature tests

* rewrite from_model threshold again...

* remove stray condition

* fix self.estimator -> estimator, slightly more interesting test

* typo in comment

* Fix issues in SparseEncoder, add tests.
more explicit explanation of SparseEncoder change, add issue numbers to whatsnew

* minor fixes in whats_new.rst

* slightly more consistency with tuples for shapes

* not longer typo
2017-06-06 16:34:47 +02:00
Russell Smith 54b0e4bf62 Add OneVs{One,All}Classifier._pairwise: fix for #7306 (#7350) 2016-09-20 13:46:45 +02:00
seales 0485ada58b General spelling fixes 2015-12-16 09:46:42 -08:00
Varun 299c2751ca BUG :#5782 check_classification_targets returns y instead of y_type 2015-11-10 16:02:07 -05:00
Jiali Mei 85223b9bcc a common test to check if classifiers fail when fed regression targets 2015-10-14 14:46:13 -04:00
TomDLT fecd35567e FIX array_equal for numpy < 1.8.1 2015-09-16 19:15:48 +02:00
TomDLT 628ed2c867 ENH remove some warnings in test suit 2015-09-16 18:27:58 +02:00
Raghav R V 18221db9fd FIX type_of_target will now raise ValueError on ml-seq; [[1, 2]] is mc-mo; 2015-08-11 22:27:15 +05:30
Raghav R V c031b39787 MAINT is_label_indicator_matrix --> is_multilabel 2015-08-11 22:27:15 +05:30
Raghav R V 7def0a75cd TST/MAINT reintroduce mixed types test sans seq. of seq. 2015-08-11 22:27:15 +05:30
Raghav R V 8f1ad4437f FIX 2D binary array-like must be considered as unknown 2015-08-11 22:27:14 +05:30
Raghav R V 3bd6132f25 FIX make sure empty target vectors are returned as binary 2015-08-11 22:27:14 +05:30
Raghav R V 72f6225f7b MAINT/ENH inline the logic for _is_sequence_of_sequences 2015-08-11 22:27:14 +05:30
Raghav R V b0e44c31d9 MAINT return 'unknown' for seq. of seqs in type_of_target 2015-08-11 22:26:44 +05:30
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
Raghav R V b3fbccca38 FIX various mismatch between docstring and signature params
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.
2015-01-16 11:54:57 -05:00
Hamzeh Alsalhi 2198a84388 Manage explicit zeros manualy in class_distribution, test with explicit zeros 2014-08-09 10:33:35 -04:00
Hamzeh Alsalhi 1873ef867c Test explicit sample wieghts in the sparse case of class_distribution 2014-08-07 17:20:07 -04:00
Hamzeh Alsalhi 7b7784e0aa Make cosmetic changes
Break list comprehenesions differently in dummy precit

Drop uncesseray float() in multiclass class_distrribtuion

Combine two lines in random_choice_csc
2014-08-06 23:01:42 -04:00
Hamzeh Alsalhi 5ba7df8b6c Include dense case support in class_distribution, pep8 revisions
Make The function previoulsy sparse_class_distribution support both the sparse and
dense case, and make some cosmetic updates for imporved readability
2014-08-05 09:45:20 -04:00
Hamzeh Alsalhi 478f9adc23 Comment .eliminate_zeros() in sparse class distribution 2014-08-04 18:45:31 -04:00
Hamzeh Alsalhi 81f82682d6 Move test_sparse_class_distribution to utils/multiclass from utils/sparsefuncs 2014-08-04 18:24:07 -04:00