Skip to main content

Feature engineering package with Scikit-learn's fit transform functionality

Project description

Feature Engine

Python 3.6 Python 3.7 Python 3.8 License CircleCI Documentation Status

Feature-engine is a Python library with multiple transformers to engineer features for use in machine learning models. Feature-engine's transformers follow Scikit-learn functionality with fit() and transform() methods to first learn the transforming paramenters from data and then transform the data.

Feature-engine features in the following resources:

Feature Engineering for Machine Learning, Online Course. Python Feature Engineering Cookbook

Documentation

Current Feature-engine's transformers include functionality for:

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

Imputing Methods

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

Encoding Methods

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

Outlier Handling methods

  • Winsorizer
  • ArbitraryOutlierCapper
  • OutlierTrimmer

Discretisation methods

  • EqualFrequencyDiscretiser
  • EqualWidthDiscretiser
  • DecisionTreeDiscretiser

Variable Transformation methods

  • LogTransformer
  • ReciprocalTransformer
  • PowerTransformer
  • BoxCoxTransformer
  • YeoJohnsonTransformer

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 folder of this repository, or in the documentation: http://feature-engine.readthedocs.io

Contributing

Local Setup Steps

  • Clone the repo and cd into it
  • Run pip install tox
  • Run tox if the tests pass, your local setup is complete

Opening Pull Requests

PR's are welcome! Please make sure the CI tests pass on your branch.

License

BSD 3-Clause

Authors

References

Many 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 for Machine Learning, Online Course

For a summary of the methods check this presentation and this article

To stay alert of latest releases, sign up at trainindata

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.4.3.tar.gz (22.0 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.4.3-py2.py3-none-any.whl (27.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: feature_engine-0.4.3.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2

File hashes

Hashes for feature_engine-0.4.3.tar.gz
Algorithm Hash digest
SHA256 bba3e837d955446dc96fdc04126a5f0c8587c9250fff08d9f45ae4a818e14cbe
MD5 9a90b38bae7c7ae988c14ecc5b38aa09
BLAKE2b-256 1319cb4b6c07f2ea0be8109e916946411fc7888b6af600aab9e42c973c98c986

See more details on using hashes here.

File details

Details for the file feature_engine-0.4.3-py2.py3-none-any.whl.

File metadata

  • Download URL: feature_engine-0.4.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2

File hashes

Hashes for feature_engine-0.4.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b3a2a65ba7fc82aba3f0706ecb5bb7f883792bf6c3ada365cac69cb8edc8adf6
MD5 918288faca2eaf730b042bab15232f1f
BLAKE2b-256 46c9c6db258859c721ef48f8293bdbe38ad3e367111e499099f01f3be3ee7634

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