rise_timeseries

Module Contents

Classes

RISETimeseries

RISE implementation for timeseries adapted from the image version of RISE.

class rise_timeseries.RISETimeseries(n_masks: int = 1000, feature_res: int = 8, p_keep: float = 0.5, preprocess_function: callable | None = None, keep_masks: bool = False, keep_masked_data: bool = False, keep_predictions: bool = False)[source]

RISE implementation for timeseries adapted from the image version of RISE.

explain(model_or_function, input_timeseries, labels, batch_size=100, mask_type='mean')[source]

Runs the RISE explainer on images.

The model will be called with masked timeseries, with a shape defined by batch_size and the shape of input_data.

Parameters:
  • model_or_function (callable or str) – The function that runs the model to be explained _or_ the path to a ONNX model on disk.

  • input_timeseries (np.ndarray) – Input timeseries data to be explained

  • batch_size (int) – Batch size to use for running the model.

  • labels (Iterable(int)) – Labels to be explained

  • mask_type – Masking strategy for masked values. Choose from ‘mean’ or a callable(input_timeseries)

Returns:

Explanation heatmap for each class (np.ndarray).