Skip to content

TSEvo

TSEvo(model, data, transformer='authentic_opposing_information', epochs=500, mode='time', backend='PYT', verbose=0)

Bases: CF

Calculates and Visualizes Counterfactuals for Uni- and Multivariate Time Series in accordance to the paper [1].

References

[1] Höllig, Jacqueline , et al. "TSEvo: Evolutionary Counterfactual Explanations for Time Series Classification." 21st IEEE International Conference on Machine Learning and Applications (ICMLA). IEEE, 2022.


PARAMETER DESCRIPTION
model

Model to be interpreted.

TYPE: [Module, Callable, model]

data

Reference Dataset as Tuple (x,y).

TYPE: Tuple

transformer

['authentic_opposing_information','mutate_both','mutate_mean','frequency_band_mapping']

TYPE: str DEFAULT: 'authentic_opposing_information'

epochs

Maximal Number of Itertions

TYPE: int DEFAULT: 500

mode

Name of second dimension: time -> (-1, time, feature) or feat -> (-1, feature, time)

TYPE: str DEFAULT: 'time'

backend

desired Model Backend ('PYT', 'TF', 'SK').

TYPE: str DEFAULT: 'PYT'

verbose

Logging Level

TYPE: int DEFAULT: 0

explain(original_x, original_y, target_y=None)

Entry Point to explain a instance. Arguments: original_x (np.array): The instance to explain. Shape mode = time -> (1,time, feat) or mode = time -> (1,feat, time) original_y (np.array): Classification Probability of instance. target_y int: Class to be targeted

RETURNS DESCRIPTION

[np.array, int]: Returns the Counterfactual and the class. Shape of CF : mode = time -> (time, feat) or mode = time -> (feat, time)