No project description provided
Project description
What is this?
PyEDCR
is a Python implementation of Error Detection and Correction Rules. The goal of PyEDCR is to use a set of conditions to learn when a machine learning model makes an incorrect prediction and to fix it to the correct prediction. The rules used in this package were constructed in this article:
Installation
To install this package run this from the command prompt:
pip install PyEDCR
The package was tested for Python >= 3.10, along with the listed packages versions in requirements.txt
Tutorial
To demonstrate the use of the package, we provide running examples. The main function of this package is run_EDCR_pipeline from the EDCR_pipeline module.
from PyEDCR.EDCR_pipeline import run_EDCR_pipeline
combined = False
conditions_from_main = True
print(utils.red_text(f'\nconditions_from_secondary={not conditions_from_main}, '
f'conditions_from_main={conditions_from_main}\n' +
f'combined={combined}\n' + '#' * 100 + '\n'))
run_EDCR_pipeline(main_lr=0.0001,
combined=combined,
loss='soft_marginal',
conditions_from_secondary=not conditions_from_main,
conditions_from_main=conditions_from_main,
consistency_constraints=True,
multiprocessing=True)
Here, 'main_lr' refers to the learning rate of the model in question. 'combined' is a flag for individual vs combined models. Combined models predict both fine and coarse grain while individual predicts one or the other. 'loss' refers to the specified loss. In our development, we used soft_marginal and BCE. 'conditions_from_main' specifies where the conditions for EDCR come from. If 'conditions_from_main' is true, a combined model will use it's own predictions as conditions for EDCR. If false, conditions will be from another model. 'consistency_constraints' is a flag to print the information for the recovered constraints and the mean constraints among all fine and coarse classes. 'multiprocessing' is used to enable multiprocessing.
To specify a model for EDCR, predictions from the model to be improved must be specified in the form of numpy arrays. Main and Secondary fine and coarse paths should be changed in the load_priors function under EDCR_pipeline to work with the user's paths. Below is the implementation of how our model predictions were loaded.
from PyEDCR.EDCR_pipeline import run_EDCR_pipeline
combined = False
conditions_from_main = True
print(utils.red_text(f'\nconditions_from_secondary={not conditions_from_main}, '
f'conditions_from_main={conditions_from_main}\n' +
f'combined={combined}\n' + '#' * 100 + '\n'))
run_EDCR_pipeline(main_lr=0.0001,
combined=combined,
loss='soft_marginal',
conditions_from_secondary=not conditions_from_main,
conditions_from_main=conditions_from_main,
consistency_constraints=True,
multiprocessing=True)
Acknowledgments
This research was supported in part by ...
This research was also supported by ...
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
File details
Details for the file PyEDCR-0.1.28.tar.gz
.
File metadata
- Download URL: PyEDCR-0.1.28.tar.gz
- Upload date:
- Size: 116.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc811d60a121e1d3f0973e6ee9f0aa46f926a12d0ca14cd5530cc98ecf61063e |
|
MD5 | b8cb6e0c9c2de47392a81616e18dcf59 |
|
BLAKE2b-256 | ea8894898a062fd38a79885d70b47e6b94383683fbb7743dd9641ca8de7482c4 |