Skip to contents

The last block's attention from [CLS] to each feature token, per row of newdata and head: where the model looked for each risk. Per row and head the weights over the feature tokens and [CLS] itself sum to 1. A diagnostic, not a decomposition of the prediction; averaged over a segment's rows it shows which rating factors the model leans on there.

Usage

attention_weights(model, newdata)

Arguments

model

An attention_cann_model with at least one block.

newdata

A data frame with the model's terms.

Value

An array [row, head, token] with the tokens as names of its third dimension.