Skip to main content

woe is a Python library designed to convert categorical and continuous variables into weight of evidence. Weight of evidence is a statistical technique used in information theory to measure the strength of a relationship between a binary target variable and a predictor variable. The library can be used for data preprocessing in predictive modeling or machine learning projects.

Project description

woe

woe is a Python library designed to convert categorical and continuous variables into weight of evidence. Weight of evidence is a statistical technique used in information theory to measure the "strength" of a relationship between a binary target variable and a predictor variable. The library can be used for data preprocessing in predictive modeling or machine learning projects.

from woe import *

# create an instance of the WoeConversion class
woemodel = WoeConversion(binarytarget='survived', features=['categorical_variable_1','categorical_variable_2','continuous_variable_3'])

# fit the model using training data
woemodel.fit(train)

# transform the training and test data using the fitted model
transformedtrain = woemodel.transform(train)
transformedtest = woemodel.transform(test)

In the above code, WoeConversion is the class that is used to perform the conversion of variables to weight of evidence. The binarytarget parameter is the name of the binary target column in your dataset, and features is a list of the columns that you want to convert to weight of evidence.

Once the model has been created, it is fit to the training data using the fit method. This method calculates the weight of evidence for each category in the specified columns, and stores the results in the model object.

The transform method is then used to transform the training and test data using the fitted model. This method replaces the original columns with their weight of evidence equivalents.

Note on Missing Values

The weight of evidence is also calculated for missing values. Therefore, missing values should not be imputed before calling the woe model.

Author

woe was created by Bertrand Brelier. If you have any questions or issues, please feel free to contact the author.

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

woe_conversion-0.0.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

woe_conversion-0.0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file woe_conversion-0.0.3.tar.gz.

File metadata

  • Download URL: woe_conversion-0.0.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for woe_conversion-0.0.3.tar.gz
Algorithm Hash digest
SHA256 11b731f742e76eef4c8e7293c5c548bb318008c5ec04bb7e95b7a6e75908768e
MD5 df460653169959f905e32bbec66c8d7b
BLAKE2b-256 e9da38ba420e78f275f4590b8864111608384e52825c91193d9f46ce6fc8b720

See more details on using hashes here.

File details

Details for the file woe_conversion-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for woe_conversion-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f0af52780dfe6d5cf89a45d94bd2fe0eb88420ebbdde1247cd58aa69838b2007
MD5 212ffddfd4acd72e8b7ff0e67863e931
BLAKE2b-256 07f0797f6a9dfbde3a5d790aa5cc322a265c3f52b44b9c36370fbaec1eaad0a0

See more details on using hashes here.

Supported by

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