peal.explainers.no_generator_counterfactual_explainers.DiCEExplainerConfig

class peal.explainers.no_generator_counterfactual_explainers.DiCEExplainerConfig[source]

Bases: ExplainerConfig

Config of DiCEExplainer.

Parameters:
  • predictor_path (str, optional) – Path of the predictor to explain when run stand-alone.

  • distilled_predictor (str or dict, optional) – Optional student predictor spec (kept for API parity with CFKD).

  • y_target_goal_confidence (float) – Target-class confidence regarded as a successful flip.

  • num_attempts (int) – Number of counterfactuals DiCE is asked for per factual (total_CFs).

  • parallel_attempts (int) – Kept for API parity; DiCE explains samples one at a time.

  • method (str) – DiCE search method: "random", "genetic" or "kdtree".

  • features_to_vary (list or str) – Feature names DiCE may change, or "all".

  • proximity_weight (float) – DiCE loss weights. Stored on the config but not currently passed to generate_counterfactuals.

  • sparsity_weight (float) – DiCE loss weights. Stored on the config but not currently passed to generate_counterfactuals.

  • diversity_weight (float) – DiCE loss weights. Stored on the config but not currently passed to generate_counterfactuals.

Methods

Attributes

distilled_predictor

diversity_weight

explainer_type

The type of explanation that shall be used.

features_to_vary

method

num_attempts

The number of counterfactuals created for the same sample.

parallel_attempts

How many counterfactuals are created for the same factual in parallel.

predictor_path

proximity_weight

sparsity_weight

y_target_goal_confidence

explainer_type: str = 'DiCEExplainer'

The type of explanation that shall be used. This is necessary to know which pydantic class to use when loading from yaml.

predictor_path: str | None = None
distilled_predictor: None | str | dict = None
y_target_goal_confidence: float = 0.51
num_attempts: int = 1

The number of counterfactuals created for the same sample.

parallel_attempts: int = 1

How many counterfactuals are created for the same factual in parallel.

method: str = 'random'
features_to_vary: list | str = 'all'
proximity_weight: float = 0.5
sparsity_weight: float = 0.5
diversity_weight: float = 0.5