Skip to main content

Package for error detecting and correcting code

Project description

Logo

License: MIT

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 import run_EDCR_pipeline

main_lr = 0.0001
combined = False
conditions_from_main = True
consistency_constraint = False
loss = "CE"

main_coarse_path = "path/to/main_coarse_data_prediction"
main_fine_path = "path/to/main_fine_data_prediction"
secondary_coarse_path = "path/to/secondary_coarse_data_prediction"
secondary_fine_path = "path/to/secondary_fine_data_prediction"

run_EDCR_pipeline(main_lr=main_lr,
                  combined=combined,
                  loss=loss,
                  conditions_from_secondary=not conditions_from_main,
                  conditions_from_main=conditions_from_main,
                  consistency_constraints=consistency_constraint,
                  main_coarse_path=main_coarse_path,
                  main_fine_path=main_fine_path,
                  secondary_coarse_path=secondary_coarse_path,
                  secondary_fine_path=secondary_fine_path,
                  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.

Acknowledgments

This research was supported in part by ...

This research was also supported by ...

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

PyEDCR-0.1.31.tar.gz (116.7 kB view details)

Uploaded Source

File details

Details for the file PyEDCR-0.1.31.tar.gz.

File metadata

  • Download URL: PyEDCR-0.1.31.tar.gz
  • Upload date:
  • Size: 116.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for PyEDCR-0.1.31.tar.gz
Algorithm Hash digest
SHA256 0c36e1ba23cb44c3200450c1b7e250d40a9e8a3ba8d2e4d1dfb9079eb74cbcc5
MD5 aab0a50ad5803dc36a1452d52293075d
BLAKE2b-256 24819307665b77a124f1554b5075582a0f09d00b1fc8ca74b94364bcd9c1497f

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