artefactual.scoring.token_proba#
- artefactual.scoring.token_proba(steps, X)[source]#
Per-token probabilities of class 1 through fitted (name, estimator) steps.
Each step before the last runs transform_tokens if it implements TokenTransformer, else transform. The first token step defines the tokens: its rows are flattened to one per token and the padded ones are dropped, so later steps and the last step’s predict_proba see real tokens only. Without a token step, the last step’s own predict_token_proba answers when it is a TokenClassifier.
- Parameters:
- Returns:
Probability of class 1 per token, NaN at padded positions; (0, 0, 1) for an empty batch.
- Return type:
ndarray of shape (n_sequences, n_tokens, 1)
- Raises:
TypeError – If the last step is not a fitted classifier of two classes, or if no step is a TokenTransformer and the last is not a TokenClassifier.