\begin{algorithmic}[1]
\State preds = $f$.predict(\textit{samples})
\Comment{Applying the test data on f to get the prediction results}
\State targets= the opposite label of the preds
\Comment{Get the target labels based on the prediction results}
\For{$\textit{sample}$ $\leftarrow$ $\textit{samples}$}
    \If{target(sample) == 0}
        \State i, start\_idx, end\_idx = [i\_0, start\_idx\_0, end\_idx\_0]
        \Comment{extracted index information of the motif from class 0 }
    \Else
        \State i, start\_idx, end\_idx = [i\_1, start\_idx\_1, end\_idx\_1]
        \Comment{extracted index information of the motif from class 1 }
    \EndIf
    \State sample[start\_idx, end\_idx] = T[i][start\_idx, end\_idx]
    \State cf\_sample = sample
    \State CF.append(cf\_sample)
\EndFor
\State \Return $\textbf{CF}$
\end{algorithmic}

\begin{algorithmic}
[1]
\State preds = $f$.predict(\textit{samples})
\Comment{Applying the test data on f to get the prediction results}
\State targets= the opposite label of the preds
\Comment{Get the target labels based on the prediction results}
\For{$\textit{sample}$ $\leftarrow$ $\textit{samples}$}
\If{target(sample) == 0}
\State i, start\_idx, end\_idx = [i\_0, start\_idx\_0, end\_idx\_0]
\Comment{extracted index information of the motif from class 0 }
\Else
\State i, start\_idx, end\_idx = [i\_1, start\_idx\_1, end\_idx\_1]
\Comment{extracted index information of the motif from class 1 }
\EndIf
\State sample[start\_idx, end\_idx] = T[i][start\_idx, end\_idx]
\State cf\_sample = sample
\State CF.append(cf\_sample)
\EndFor
\State \Return $\textbf{CF}$
\end{algorithmic}
{
    "title": "motif-guided time series counterfactual explanations",
    "id": "2211.04411",
    "abstract": "with the rising need of interpretable machine learning methods, there is a necessity for a rise in human effort to provide diverse explanations of the influencing factors of the model decisions. to improve the trust and transparency of ai-based systems, the explainable artificial intelligence (xai) field has emerged. the xai paradigm is bifurcated into two main categories: feature attribution and counterfactual explanation methods. while feature attribution methods are based on explaining the reason behind a model decision, counterfactual explanation methods discover the smallest input changes that will result in a different decision. in this paper, we aim at building trust and transparency in time series models by using motifs to generate counterfactual explanations. we propose motif-guided counterfactual explanation (mg-cf), a novel model that generates intuitive post-hoc counterfactual explanations that make full use of important motifs to provide interpretive information in decision-making processes. to the best of our knowledge, this is the first effort that leverages motifs to guide the counterfactual explanation generation. we validated our model using five real-world time-series datasets from the ucr repository. our experimental results show the superiority of mg-cf in balancing all the desirable counterfactual explanations properties in comparison with other competing state-of-the-art baselines.",
    "categories": "cs.lg",
    "doi": "",
    "created": "2022-11-08",
    "updated": "2024-02-01",
    "authors": [
        "peiyu li",
        "soukaina filali boubrahimi",
        "shah muhammad hamdi"
    ],
    "affiliation": [],
    "url": "https://arxiv.org/abs/2211.04411"
}
{
    "ToxicityFilter": {
        "text_to_toxicity_attributes": {
            "mybib.bbl": {
                "toxicity_score": 0.011874928,
                "severe_toxicity_score": 0.0011348724,
                "identity_attack_score": 0.003866276,
                "insult_score": 0.0075508766,
                "profanity_score": 0.014532468,
                "threat_score": 0.007521313,
                "sexually_explicit_score": 0.010969753,
                "flirtation_score": 0.27629572
            },
            "mybib.bib": {
                "toxicity_score": 0.004869349,
                "severe_toxicity_score": 0.0008916855,
                "identity_attack_score": 0.0009943173,
                "insult_score": 0.006173368,
                "profanity_score": 0.012585391,
                "threat_score": 0.0057347976,
                "sexually_explicit_score": 0.00896453,
                "flirtation_score": 0.31566563
            },
            "mybib.tex": {
                "toxicity_score": 0.012880214,
                "severe_toxicity_score": 0.0010967255,
                "identity_attack_score": 0.0040512653,
                "insult_score": 0.007892879,
                "profanity_score": 0.014976538,
                "threat_score": 0.0076766624,
                "sexually_explicit_score": 0.012149297,
                "flirtation_score": 0.23857248
            },
            "llncs.cls": {
                "toxicity_score": 0.0025289198,
                "severe_toxicity_score": 0.00032424927,
                "identity_attack_score": 0.00068446033,
                "insult_score": 0.0057316152,
                "profanity_score": 0.009135309,
                "threat_score": 0.005618286,
                "sexually_explicit_score": 0.0040399362,
                "flirtation_score": 0.61743
            },
            "readme.txt": {
                "toxicity_score": 0.022964042,
                "severe_toxicity_score": 0.0014400482,
                "identity_attack_score": 0.005512681,
                "insult_score": 0.012338906,
                "profanity_score": 0.016616182,
                "threat_score": 0.007598988,
                "sexually_explicit_score": 0.00979021,
                "flirtation_score": 0.26585522
            },
            "splncs04.bst": {
                "toxicity_score": 0.0109324735,
                "severe_toxicity_score": 0.0010919571,
                "identity_attack_score": 0.0029598286,
                "insult_score": 0.007797878,
                "profanity_score": 0.015454767,
                "threat_score": 0.0067445673,
                "sexually_explicit_score": 0.012916001,
                "flirtation_score": 0.39611804
            }
        },
        "reason": null
    }
}
{
    "num_done": {
        "figure": 0,
        "algorithm": 3,
        "plot": 0
    }
}
{
    "NonTrivialRenderingFilter": {
        "white_pixels_ratio": 90.91747693841936,
        "hash": "033f3f8f87833f01",
        "most_frequent_color_ratio": 90.91747693841936
    }
}