robustx.generators.CE_methods package
Submodules
robustx.generators.CE_methods.BinaryLinearSearch module
- class robustx.generators.CE_methods.BinaryLinearSearch.BinaryLinearSearch(ct, custom_distance_func=None)[source]
Bases:
CEGenerator
A counterfactual explanation generator that uses binary linear search to find counterfactual explanations.
Inherits from the CEGenerator class and implements the _generation_method to perform binary linear search for generating counterfactuals.
- __customFunc
A custom distance function, inherited from CEGenerator.
- Type:
callable, optional
robustx.generators.CE_methods.GuidedBinaryLinearSearch module
- class robustx.generators.CE_methods.GuidedBinaryLinearSearch.GuidedBinaryLinearSearch(ct, custom_distance_func=None)[source]
Bases:
CEGenerator
robustx.generators.CE_methods.KDTreeNNCE module
- class robustx.generators.CE_methods.KDTreeNNCE.KDTreeNNCE(ct, custom_distance_func=None)[source]
Bases:
CEGenerator
A counterfactual explanation generator that uses KD-Tree for nearest neighbor counterfactual explanations.
Inherits from the CEGenerator class and implements the _generation_method to find counterfactual explanations using KD-Tree for nearest neighbors.
- __customFunc
A custom distance function, inherited from CEGenerator.
- Type:
callable, optional
robustx.generators.CE_methods.MCE module
- class robustx.generators.CE_methods.MCE.MCE(ct)[source]
Bases:
CEGenerator
A counterfactual explanation generator that uses Mixed-Integer Linear Programming (MILP) to find counterfactual explanations.
Inherits from the CEGenerator class and implements the _generation_method to find counterfactual explanations using MILP with the Gurobi optimizer.
- __customFunc
A custom distance function, inherited from CEGenerator.
- Type:
callable, optional
robustx.generators.CE_methods.NNCE module
- class robustx.generators.CE_methods.NNCE.NNCE(ct, custom_distance_func=None)[source]
Bases:
CEGenerator
A counterfactual explanation generator that uses a nearest-neighbor counterfactual explanation (NNCE) approach.
Inherits from CEGenerator and calculates counterfactual explanations based on the nearest neighbor in the training data with the desired prediction.
- __customFunc
A custom distance function, inherited from CEGenerator.
- Type:
callable, optional
robustx.generators.CE_methods.Wachter module
- class robustx.generators.CE_methods.Wachter.CostLoss[source]
Bases:
Module
Custom loss function to calculate the absolute difference between two tensors.
Inherits from nn.Module.
- class robustx.generators.CE_methods.Wachter.Wachter(ct, custom_distance_func=None)[source]
Bases:
CEGenerator
A counterfactual explanation generator that uses Wachter’s method for finding counterfactual explanations.
Inherits from CEGenerator and implements the _generation_method to find counterfactuals using gradient descent.