Commit Graph

127 Commits

Author SHA1 Message Date
Xuefeng Xu b8229daafe
ENH improve the efficiency of Encoders in checking nan (#27760)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2023-11-29 08:21:30 -08:00
Guillaume Lemaitre dc2a2256ea
MAINT remove sparse parameter in OneHotEncoder (#27861) 2023-11-27 23:25:48 +01:00
Guillaume Lemaitre 0816e0012c
FIX raise NotFittedError in OrdinalEncoder when required (#27821)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2023-11-23 15:35:17 -05:00
Thomas J. Fan 831c49aca3
ENH Adds polars output support to `set_output` API (#27315) 2023-11-19 22:46:56 +01:00
Xuefeng Xu a55f1673d7
FIX raise an error if user defined categories contain duplicate values (#27328)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Tim Head <betatim@gmail.com>
2023-11-01 15:29:49 +00:00
Xuefeng Xu 0efad0029b
FIX raise an error if nan is not the last element in user provided categories (#27309)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2023-11-01 14:59:48 +01:00
Stefanie Senger 20dad5851e
DOC documentation and error message for mismatching output formats in transformers with a sparse output (#26919)
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2023-09-21 16:54:23 +02:00
Stefanie Senger 8ccaf0da1d
DOC Add links to preprocessing examples in docstrings and userguide (#26877)
Co-authored-by: Arturo Amor <86408019+ArturoAmorQ@users.noreply.github.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2023-08-24 15:15:41 +02:00
Loïc Estève f55da6220e
MNT Adjust code after NEP 51 numpy scalar formatting changes (#27042) 2023-08-22 11:26:55 +02:00
Xuefeng Xu 54925d8d0c
DOC fix default dtype in OneHotEncoder (#27054) 2023-08-12 13:04:02 +02:00
Xuefeng Xu 34c4741203
FIX missing_indices were calculated twice in OrdinalEncoder (#27017)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2023-08-08 12:36:33 +05:00
Thomas J. Fan dcf051038f
FIX Adds more informative error message for OHE (#26931) 2023-07-31 13:40:31 +02:00
Guillaume Lemaitre d991a196cb
MAINT make sure to test encoders in common tests (#26859) 2023-07-24 11:38:45 -04:00
Adrin Jalali 42173fdb34
MNT add isort to ruff's rules (#26649) 2023-06-21 17:50:07 +02:00
Jérémie du Boisberranger 9c266cf5d6
MAINT Param validation: decorate all estimators with _fit_context (#26473) 2023-06-14 16:52:35 +02:00
Dimitri Papadopoulos Orfanos 2fd022d972
MAINT Fix typos found by codespell (#26448) 2023-05-31 10:19:21 +02:00
Adrin Jalali 893d5accaf
MNT Update black to 23.3.0 (#26110) 2023-04-06 12:14:16 -04:00
Thomas J. Fan 7df7062a7a
ENH Adds infrequent categories support to OrdinalEncoder (#25677)
Co-authored-by: Tim Head <betatim@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Andreas Mueller <t3kcit@gmail.com>
2023-03-29 10:08:25 +02:00
Thomas J. Fan 392fdee003
ENH Adds TargetEncoder (#25334)
Co-authored-by: Andreas Mueller <t3kcit@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jovan Stojanovic <62058944+jovan-stojanovic@users.noreply.github.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2023-03-16 16:59:20 +01:00
Guillaume Lemaitre ab3c0605de
DOC fix docstring dtype parameter in OrdinalEncoder (#25877) 2023-03-16 15:20:44 +01:00
Jérémie du Boisberranger 9d55835574
MAINT Ensure disjoint interval constraints (#25797) 2023-03-15 14:44:09 -04:00
Thomas J. Fan 1380e3c09b
FIX Fixes bug OneHotEncoder's drop_idx_ when there are infrequent categories (#25589)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
2023-03-08 13:17:51 +01:00
Thomas J. Fan ae4a1b1a78
FIX Allow OrdinalEncoder's encoded_missing_value set to the cardinality (#25704) 2023-02-28 11:15:08 +01:00
Mario Kostelac 3bc36e000d
ENH Add feature_name_combiner to OneHotEncoder (#22506)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Chiara Marmo <cmarmo@users.noreply.github.com>
2023-01-12 11:20:26 +01:00
Tim Head ecb9a70e82
FIX Ensure dtype of categories is `object` for strings in `OneHotEncoder` (#25174)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-12-22 12:32:07 -05:00
Guillaume Lemaitre af16e5934a
MAINT test globally setting output via context manager (#24932)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
2022-11-24 14:14:06 +01:00
Ross Barnowski f702e97907
MAINT: Replace np.find_common_type with np.result_type. (#24858) 2022-11-18 11:31:01 +01:00
Guillaume Lemaitre 852f74d83c
DOC Add notes in OrdinalEncoder regardin Python version (#24959)
Co-authored-by: Tim Head <betatim@gmail.com>
closes https://github.com/scikit-learn/scikit-learn/issues/24840
2022-11-17 19:55:11 +01:00
Andreas Mueller f905c213d1
fix typo in sparse output warning (#24817) 2022-11-02 19:18:57 -07:00
Thomas J. Fan 1dc23d7a1a
ENH Makes OneToOneFeatureMixin and ClassNamePrefixFeaturesOutMixin public (#24688)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2022-10-18 23:20:17 +02:00
Jérémie du Boisberranger 2708aac034
MAINT Clean deprecation for 1.2: get_feature_names (#24395)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2022-10-03 09:46:10 +02:00
Rushil Desai 7134e4183c
API Rename OneHotEncoder option sparse to sparse_output (#24412)
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
2022-09-16 13:46:53 +02:00
Thomas J. Fan 02ebf9e68f
MNT Adds dict typing hint to _parameter_constraints for mypy (#24301) 2022-08-30 11:01:10 +02:00
Thomas J. Fan 6894a9be37
FIX Fixes OrdinalEncoder.inverse_tranform nan encoded values (#24087) 2022-08-05 09:11:39 +02:00
Diadochokinetic 8a8d0687ee
MAINT validate parameter in OneHotEncoder and OrdinalEncoder (#23579)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
2022-06-24 17:52:33 +02:00
Loïc Estève e3cd1799cd
DOC fix typo in OneHotEncoder docstring (#23455) 2022-05-25 10:47:34 +02:00
Thomas J. Fan 51fddb7fdc
ENH Adds encoded_missing_value to OrdinalEncoder (#21988) 2022-03-23 13:26:34 +01:00
Thomas J. Fan 7f0006c8aa
ENH Adds infrequent categories to OneHotEncoder (#16018)
* ENH Completely adds infrequent categories

* STY Linting

* STY Linting

* DOC Improves wording

* DOC Lint

* BUG Fixes

* CLN Address comments

* CLN Address comments

* DOC Uses math to description float min_frequency

* DOC Adds comment regarding drop

* BUG Fixes method name

* DOC Clearer docstring

* TST Adds more tests

* FIX Fixes mege

* CLN More pythonic

* CLN Address comments

* STY Flake8

* CLN Address comments

* DOC Fix

* MRG

* WIP

* ENH Address comments

* STY Fix

* ENH Use functiion call instead of property

* ENH Adds counts feature

* CLN Rename variables

* DOC More details

* CLN Remove unneeded line

* CLN Less lines is less complicated

* CLN Less diffs

* CLN Improves readiabilty

* BUG Fix

* CLN Address comments

* TST Fix

* CLN Address comments

* CLN Address comments

* CLN Move docstring to userguide

* DOC Better wrapping

* TST Adds test to handle_unknown='error'

* ENH Spelling error in docstring

* BUG Fixes counter with nan values

* BUG Removes unneeded test

* BUG Fixes issue

* ENH Sync with main

* DOC Correct settings

* DOC Adds docstring

* DOC Immprove user guide

* DOC Move to 1.0

* DOC Update docs

* TST Remove test

* DOC Update docstring

* STY Linting

* DOC Address comments

* ENH Neater code

* DOC Update explaination for auto

* Update sklearn/preprocessing/_encoders.py

Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>

* TST Uses docstring instead of comments

* TST Remove call to fit

* TST Spelling error

* ENH Adds support for drop + infrequent categories

* ENH Adds infrequent_if_exist option

* DOC Address comments for user guide

* DOC Address comments for whats_new

* DOC Update docstring based on comments

* CLN Update test with suggestions

* ENH Adds computed property infrequent_categories_

* DOC Adds where the infrequent column is located

* TST Adds more test for infrequent_categories_

* DOC Adds docstring for _compute_drop_idx

* CLN Moves _convert_to_infrequent_idx into its own method

* TST Increases test coverage

* TST Adds failing test

* CLN Careful consideration of dropped and inverse_transform

* STY Linting

* DOC Adds docstrinb about dropping infrequent

* DOC Uses only

* DOC Numpydoc

* TST Includes test for get_feature_names_out

* DOC Move whats new

* DOC Address docstring comments

* DOC Docstring changes

* TST Better comments

* TST Adds check for handle_unknown='ignore' for infrequent

* CLN Make _infrequent_indices private

* CLN Change min_frequency default to None

* DOC Adds comments

* ENH adds support for max_categories=1

* ENH Describe lexicon ordering for ties

* DOC Better docstring

* STY Fix

* CLN Error when explicity dropping an infrequent category

* STY Grammar

Co-authored-by: Joel Nothman <joel.nothman@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2022-03-14 15:48:18 +01:00
Olivier Grisel 279388d9ed
DOC Improve get_feature_names_out docstrings (#22718)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2022-03-07 13:02:12 -05:00
shaymerNaturalint 0a01f90b92
DOC Adjusts OneHotEncoder docstring on multicollinearity (#22507)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2022-02-19 07:16:35 -05:00
Thomas J. Fan d7feac0ccf
ENH Adds feature_names_out to preprocessing module (#21079)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: 赵丰 (Zhao Feng) <616545598@qq.com>
Co-authored-by: Niket Jain <51831161+nikJ13@users.noreply.github.com>
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
2022-02-07 12:09:57 +01:00
pelennor 5f0a69585b
Doc fix typos in sklearn.preprocessing._encoders (#21910) 2021-12-07 14:32:43 +01:00
Thomas J. Fan 60cf98bc89
FIX Ignore distutils warning in [scipy-dev] + fix numpy 1.22 support in OneHotEncoder (#21517)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2021-11-04 12:17:50 +01:00
Thomas J. Fan f3f04ed603
DOC Doc fix for one_hot_encoder (#21074) 2021-10-20 14:00:57 +02:00
Bharat Raghunathan 129a5d7e86
DOC Ensures that OrdinalEncoder passes numpydoc validation (#21030)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-09-14 12:08:58 +02:00
Thomas J. Fan 4abd9f2d9e
API Implements get_feature_names_out for transformers that support get_feature_names (#18444)
Co-authored-by: Andreas Mueller <andreas.mueller@columbia.edu>
Co-authored-by: Andreas Mueller <andreasmuellerml@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
2021-09-07 10:56:57 +02:00
Thomas J. Fan f500326a9a CLN Removes unneeded test 2021-09-01 18:13:04 -07:00
Thomas J. Fan 701538a7c8 ENH Adds n_features_in_ and feature_names_in_ to encoders 2021-09-01 18:13:04 -07:00
Thomas J. Fan 786c4e5e39
DOC Adds feature_names_in_ to docstrings (#20787) 2021-08-26 13:44:45 +02:00
Maxwell 9580530071
FIX OrdinalEncoder.fit should not raise an error `handle_unknown="use_encoded_value"` (#19906)
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-07-23 18:55:24 +02:00