Skip to main content

Feature engineering package that follows sklearn functionality

Project description

Feature Engine

Feature Engine is a python library that contains several transformers to engineer features for use in machine learning models. The transformers follow scikit-learn like functionality. They first learn the imputing or encoding methods from the training set, and subsequently transform the dataset. Currently the transformers include functionality for:

  • Missing value imputation
  • Categorical variable encoding
  • Outlier removal
  • Discretisation
  • Numerical Variable Transformation

Important Links

Documentation: http://feature-engine.readthedocs.io

Imputing Methods

  • MeanMedianImputer
  • RandomSampleImputer
  • EndTailImputer
  • AddNaNBinaryImputer
  • CategoricalVariableImputer
  • FrequentCategoryImputer
  • ArbitraryNumberImputer

Encoding Methods

  • CountFrequencyCategoricalEncoder
  • OrdinalCategoricalEncoder
  • MeanCategoricalEncoder
  • WoERatioCategoricalEncoder
  • OneHotCategoricalEncoder
  • RareLabelCategoricalEncoder

Outlier Handling methods

  • Windsorizer
  • ArbitraryOutlierCapper

Discretisation methods

  • EqualFrequencyDiscretiser
  • EqualWidthDiscretiser
  • DecisionTreeDiscretiser

Variable Transformation methods

  • LogTransformer
  • ReciprocalTransformer
  • ExponentialTransformer
  • BoxCoxTransformer

Installing

pip install feature_engine

or

git clone https://github.com/solegalli/feature_engine.git

Usage

from feature_engine.categorical_encoders import RareLabelEncoder

rare_encoder = RareLabelEncoder(tol = 0.05, n_categories=5)
rare_encoder.fit(data, variables = ['Cabin', 'Age'])
data_encoded = rare_encoder.transform(data)

See more usage examples in the jupyter notebooks in the example section

Examples

You can find jupyter notebooks in the examples folder, with directions on how to use this package and its multiple transformers.

License

BSD 3-Clause

Authors

References

Most of the engineering and encoding functionality is inspired by this series of articles from the 2009 KDD competition

To learn more about the rationale, functionality, pros and cos of each imputer, encoder and transformer, refer to the Feature Engineering Online Course

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feature_engine-0.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

feature_engine-0.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file feature_engine-0.2.tar.gz.

File metadata

  • Download URL: feature_engine-0.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for feature_engine-0.2.tar.gz
Algorithm Hash digest
SHA256 55d5b05e76e7a9c522547fa6affa525678af54bba5b8dc13d8d520eb5d565e4b
MD5 e5cd9bb55dd858e6ff5360b7e170f561
BLAKE2b-256 e27de8d69e054425ef70782214bfff56501bbb929bc2e5fa2e3bdb4575636fee

See more details on using hashes here.

File details

Details for the file feature_engine-0.2-py3-none-any.whl.

File metadata

  • Download URL: feature_engine-0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for feature_engine-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f82ed94596b10e10ea2ce17774d6d4c1f158eba17788e9a31548461c6119e7d
MD5 2e019bbe722115e07fb3b55f747ba97d
BLAKE2b-256 90c8129d645beaf60d1b444d1af1d4aa2fd505e030159d8c7a6a12379284459b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page