COMTE
COMTECF(model, data, backend, mode, method='opt', number_distractors=2, max_attempts=1000, max_iter=1000, silent=False)
Bases: CF
Calculates and Visualizes Counterfactuals for Multivariate Time Series in accordance to the paper [1].
References
[1] Ates, Emre, et al. "Counterfactual Explanations for Multivariate Time Series." 2021 International Conference on Applied Artificial Intelligence (ICAPAI). IEEE, 2021.
PARAMETER | DESCRIPTION |
---|---|
model |
Model to be interpreted.
TYPE:
|
ref |
Reference Dataset as Tuple (x,y).
TYPE:
|
backend |
desired Model Backend ('PYT', 'TF', 'SK').
TYPE:
|
mode |
Name of second dimension:
TYPE:
|
method |
'opt' if optimized calculation, 'brute' for Brute Force
TYPE:
|
number_distractors |
number of distractore to be used
TYPE:
|
silent |
logging.
TYPE:
|
explain(x, orig_class=None, target=None)
Calculates the Counterfactual according to Ates.
Arguments:
x (np.array): The instance to explain. Shape : mode = time
-> (1,time, feat)
or mode = time
-> (1,feat, time)
target int: target class. If no target class is given, the class with the secon heighest classification probability is selected.
RETURNS | DESCRIPTION |
---|---|
([array], int)
|
Tuple of Counterfactual and Label. Shape of CF : |