SETS
SETSCF(model, data, backend, mode, min_shapelet_len, max_shapelet_len, num_candidates_to_sample_per_case=20, time_contract_in_mins_per_dim=10, predefined_ig_rejection_level=0.001, max_shapelets_to_store_per_class=30, random_state=42, remove_self_similar=True, silent=False, fit_shapelets=True)
Bases: CF
Calculates and Visualizes Counterfactuals for Multivariate Time Series in accordance to the paper [1]. The shapelet transofor adapted by [1] is based on prior work of [2].
References
[1] Bahri, Omar, et al. "Shapelet-based Temporal Association Rule Mining for Multivariate Time Series Classification". SIGKDD 2022 Workshop on Mining and Learning from Time Series (MiLeTS)" [2] ostrom, Aaron and Bagnall, Anthony}, "Binary shapelet transform for multiclass time series". Bostrom, Aaron and Bagnall, Anthony
PARAMETER | DESCRIPTION |
---|---|
model |
Model to be interpreted.
TYPE:
|
dataset |
Reference Dataset of training and test data.
|
backend |
desired Model Backend ('PYT', 'TF', 'SK').
TYPE:
|
mode |
Name of second dimension:
TYPE:
|
min_shapelet_len |
Value for min length of extracted shapelets / must be greater than 0
TYPE:
|
max_shapelet_len |
Value for max length of extracted shapelets < timeseries must be smaller or equal than timeseries length
TYPE:
|
num_candidates_to_sample_per_case |
number of assesed candiates per series
TYPE:
|
time_contract_in_mins_per_dim |
Max time for shapelet extraction per dimension
TYPE:
|
predefined_ig_rejection_levl |
Min Information Gain of candidate shapelet to keep
TYPE:
|
random_state |
RandomState used throughout the shapelet transform
TYPE:
|
remove_self_similar |
removes similar shapelets from a timeseries
TYPE:
|
initial_num_shapelets_per_case |
Initial number of shapelets per case.
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 : |
fit(occlusion_threshhold=0.1, remove_multiclass_shapelets=True)
Calculates the occurences of shapelets and removes shapelets belonging to more than one class. This process can be triggered with different parameter options without a new shapelet transform run.
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 : |