Skip to content

GateMask

Input-specific sparse masks learned through counterfactual perturbation. See learned-mask methods for context and trade-offs.

tslens.attr.gate_mask.GateMask

GateMask(forward_func: Callable)

Bases: PerturbationAttribution

GateMask.

ContraLSP, a locally sparse model that introduces counterfactual samples to build uninformative perturbations but keeps distribution using contrastive learning. Furthermore, we incorporate sample-specific sparse gates to generate more binary-skewed and smooth masks, which easily integrate temporal trends and select the salient features parsimoniously.

Parameters:

Name Type Description Default
forward_func callable

The forward function of the model or any modification of it.

required
References

. Explaining Time Series via Contrastive and Locally Sparse Perturbations (ContraLSP) <https://arxiv.org/abs/2401.08552>