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_conversion.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file woe_conversion-0.0.4.tar.gz
.
File metadata
- Download URL: woe_conversion-0.0.4.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70da04711ffc94ed43b9f8a3e32c233b3d00ba852647ca1bd8dbd5d0c2b651a9 |
|
MD5 | dc68a18749c68be865ad55dceeaecd2d |
|
BLAKE2b-256 | b1ddd96dbccd2c2d47a67361f3aa07bd7b8b874c01111acdc2b1096403fbb84e |
File details
Details for the file woe_conversion-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: woe_conversion-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245f7317caf1e2d1bbb09b3e99b746b0b3bc732cf4f8fa86a7e2ca41e6754d0b |
|
MD5 | fd5ad4461168099cff46ea980bf397d4 |
|
BLAKE2b-256 | 55992c537c41039f6d25c3b6c909d9b734006af7c10b6a15d56337e32561501e |