Commit Graph

91 Commits

Author SHA1 Message Date
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
Thomas J. Fan 3ae7c76153
STY Enables black with experimental_string_processing=true (#20412) 2021-06-29 09:47:04 +02:00
Gabriel S Vicente dbbb88d32a
DOC Ensures that OneHotEncoder passes numpydoc validation (#20406)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2021-06-27 08:54:19 +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
Tom Dupré la Tour f6e6ad2d9e
MNT clean futurewarning for 1.0 | _deprecate_positional_args (#20002)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
2021-05-14 11:30:27 -04:00
Andrew Delong a67b284f90
FIX Encoder should accept categories having dtype='S' (#19727)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-04-21 17:34:28 -04:00
Thomas J. Fan 004b44d007
FIX OneHotEncoder.fit no longer alters the drop parameter (#19924) 2021-04-20 23:29:02 +02:00
Thomas J. Fan 5d8796b91d
FIX Fixes unknown handling for str dtypes in OrdinalEncoder.transform (#19888)
* FIX Fixes unknown handling for str X in OrdinalEncoder.transform

* DOC Adds whats new

* DOC Move to 0.24.2

* DOC Adds reasoning in comment
2021-04-18 17:31:50 +02:00
Guillaume Lemaitre 8a3939aa69
FIX Error for sparse matrix in OrdinalEncoder.inverse_transform (#19879) 2021-04-13 07:59:30 -04:00
Guillaume Lemaitre 767fd63c9d
DOC make documentation consistent regarding types in _encoders.py (#19876) 2021-04-13 12:27:14 +02:00
Roman Yurchak a80b99ca04
DOC Fix versionchanged/versionadded in OneHotEncoder (#16562)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-04-09 10:31:53 +02:00
Thomas J. Fan c9c89cfc85
ENH Adds support for drop + handle_unknown=ignore in the OneHotEncoder (#19041)
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
2021-03-31 16:45:38 +02:00
Thomas J. Fan 638b7689bb
ENH Adds nan passthrough in OrdinalEncoder (#19069) 2021-02-24 17:23:44 +11:00
Guillaume Lemaitre 8ea176ae0c
FIX validate handle_unkown strategies in OrdinalEncoder (#19234) 2021-01-22 10:58:41 +01:00
Thomas J. Fan 53add71a54
FIX Fixes encoders for string dtypes (#15763)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
2020-10-27 12:08:56 +01:00
Kevin Winata 5d5329c473
FIX raise error in OneHotEncoder.inverse_transform (#14982) 2020-10-19 21:21:47 +02:00
Thomas J. Fan eeddc17a85
ENH Adds missing value support to OneHotEncoder (#17317)
OneHotEncoder supports categorical features with missing values by
considering the missing values as an additional category.
2020-10-09 08:38:33 +02:00
Albert Villanova del Moral 7e545e1724
DOC Fix versionadded for 0.23 (#18522) 2020-10-05 10:23:32 +11:00
Nicolas Hug 4aada4e5fd
ENH Support unknown_value=np.nan in OrdinalEncoder (#18406) 2020-09-23 12:57:31 +02:00
Albert Villanova del Moral 647fcb1ac1
DOC Fix A to uppercase in See Also docstring section (#18332) 2020-09-04 10:35:01 -04:00
Nicolas Hug c3effe4bea
DOC minor typo fix (#18119) 2020-08-07 10:01:00 -04:00
Felix Wick 8a213df98f
FEA allow unknowns in OrdinalEncoder transform (#17406) 2020-08-05 18:49:25 +10:00
Juan Carlos Alfaro Jiménez 547ead6c0c
MNT More replacements of numpy aliases with built-in types (#17707)
* MNT More replacements of numpy aliases with built-in types [scipy-dev]

* MNT More (manual) replacements of numpy aliases

* MNT More (manual) replacements of numpy aliases

* FIX Minor change

* MNT Trigger build [scipy-dev]

* FIX Minor change

* MNT Trigger build [scipy-dev]

* FIX More deprecations of numpy aliases [scipy-dev]

* MNT Silent numpy aliases warnings [scipy-dev]

* FIX Fix silent deprecations

* Trigger build [scipy-dev]

* FIX Add scape characters [scipy-dev]

* FIX Remove package specification from silent

* Trigger build [scipy-dev]

* Revert
2020-06-26 12:45:03 +02:00
Thomas J. Fan 7cc0177f8e
MNT Replaces numpy alias with builtin typse (#17687)
* MNT Replaces numpy alias with builtin typse

* STY Lint error
2020-06-24 16:51:51 +02:00
Saurabh Jain 00bc681e10
DOC shorten class links in docstring using tilde (#17470)
* added tilde to bunch of files

* Updated _kde.py

Changed array_like to array-like

* Updated _kde.py

Removed space

* updated _kde.py

Added full stop

* PEP8

Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2020-06-16 10:44:13 +02:00
Thomas J Fan d40d993199
CLN Refactors _encode into two functions (#17101) 2020-05-12 14:23:00 -04:00
Ekaterina Borovikova 4755ae76d2
DOC Add versionchanged and versionadded for v0.20 (#16199)
Co-Authored-By: Adrin Jalali <adrin.jalali@gmail.com>
Co-Authored-By: Chiara Marmo <cmarmo@users.noreply.github.com>
Co-Authored-By: Nicolas Hug <contact@nicolas-hug.com>
2020-04-26 09:29:36 -04:00
Thomas J Fan e54cd3c061
API Deprecate positional arguments in preprocessing (#16996)
* API Deprecate positional arguments in preprocessing

* CLN Address comments

* CLN Uses classes as a keyword only argument

* BUG Fix
2020-04-23 19:10:49 +02:00
Roman Yurchak 75d3f29e72
MAINT Remove outdated numpy and scipy backports (#16725)
* Remove unecessary numpy & scipy backports

* More fixes

* Remove unused imports
2020-03-20 13:57:18 +01:00
Olivier Grisel 6ee1597650
DOC Add note on bias induced by dropping categories in OneHotE… (#16679) 2020-03-13 10:25:09 -04:00
Chiara Marmo f763c614f4
ENH Add check for non binary variables in OneHotEncoder. (#16585)
Co-authored-by: Thomas J Fan <thomasjpfan@gmail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2020-03-10 09:58:55 +01:00
Guillaume Lemaitre db85b1264c
DOC improve the documentation of OneHotEncoder for if_binary (#16428) 2020-02-11 18:31:42 +01:00
Rushabh Vasani 7e7e115296
ENH Add 'if_binary' option to drop argument of OneHotEncoder (#16245) 2020-02-07 10:18:26 +01:00
Thomas J Fan 69884d5fd2 ENH: Improves speed of one hot encoding (#15762) 2019-12-04 15:53:15 +01:00
Paula ff878d60aa DOC add versionadded to OneHotEcoder, LabelEncoder (#15506)
and OrdinalEncoder
2019-11-15 22:01:55 +01:00
Soumirai 968a67e79f DOC numpydoc validation for OneHotEncoder and OrdinalEncoder (#15446) 2019-11-02 16:15:02 +01:00
Venkatachalam N 692c2f286e EXA Improving the example for get_feature_names in OneHotEncoder (#15369) 2019-10-28 11:48:07 +08:00