Skip to content
/ PyEDCR Public

PyEDCR is a package providing error detecting and corrective rules into Python. Given a model, PyEDCR's goal is to recognize when it is incorrect based on a set of conditions and then correct the incorrect prediction.

License

Notifications You must be signed in to change notification settings

lab-v2/PyEDCR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

License: MIT

What is this?

PyEDCR is a Python implementation of the f-EDR (Focused Error Detection Rules) paradigm. The goal of EDR is to use a set of conditions to learn when a machine learning model makes an incorrect prediction, as first introduced in:

The package was tested for Python >= 3.9.

Example

To demonstrate the use of the package, consider the following running example using the 'simulate_for_values' function from NeuralPyEDCR.py

import os
from NeuralPyEDCR import simulate_for_values

data_str = 'imagenet'
main_model_name = binary_model_name = 'dinov2_vits14'
secondary_model_name = 'dinov2_vitl14'
main_lr = secondary_lr = binary_lr = 0.000001
original_num_epochs = 8
secondary_num_epochs = 2
binary_num_epochs = 5
number_of_fine_classes = 42

binary_l_strs = list({f.split(f'e{binary_num_epochs - 1}_')[-1].replace('.npy', '')
                          for f in os.listdir('binary_results')
                          if f.startswith(f'{data_str}_{binary_model_name}')})

simulate_for_values(total_number_of_points=1,
                    min_value=0.1,
                    max_value=0.1,
                    binary_l_strs=binary_l_strs,
                    binary_lr=binary_lr,
                    binary_num_epochs=binary_num_epochs,
                    multi_processing=True,
                    secondary_model_name=secondary_model_name,
                    secondary_model_loss='BCE',
                    secondary_num_epochs=secondary_num_epochs,
                    secondary_lr=secondary_lr,
                    maximize_ratio=True,
                    lists_of_fine_labels_to_take_out=[[]],
                    negated_conditions=False)