Table of Contents

Class CounterfactualExplanation<T>

Namespace
AiDotNet.Interpretability
Assembly
AiDotNet.dll

Represents a counterfactual explanation showing minimal changes needed for a different outcome.

public class CounterfactualExplanation<T>

Type Parameters

T

The numeric type for calculations.

Inheritance
CounterfactualExplanation<T>
Inherited Members

Constructors

CounterfactualExplanation()

Initializes a new instance of the CounterfactualExplanation class.

public CounterfactualExplanation()

Properties

CounterfactualInput

Gets or sets the counterfactual input (modified version).

public Tensor<T>? CounterfactualInput { get; set; }

Property Value

Tensor<T>

CounterfactualPrediction

Gets or sets the counterfactual prediction.

public Tensor<T>? CounterfactualPrediction { get; set; }

Property Value

Tensor<T>

Distance

Gets or sets the total distance between original and counterfactual.

public T Distance { get; set; }

Property Value

T

FeatureChanges

Gets or sets the feature changes made. Keys are feature indices, values are the change amounts.

public Dictionary<int, T> FeatureChanges { get; set; }

Property Value

Dictionary<int, T>

MaxChanges

Gets or sets the maximum number of changes allowed.

public int MaxChanges { get; set; }

Property Value

int

OriginalInput

Gets or sets the original input.

public Tensor<T>? OriginalInput { get; set; }

Property Value

Tensor<T>

OriginalPrediction

Gets or sets the original prediction.

public Tensor<T>? OriginalPrediction { get; set; }

Property Value

Tensor<T>