MarkovChain.score_samples

MarkovChain.score_samples(sequences)[source]

Computes the average negative log-likelihood (NLL) of observing the provided sequences.

Parameters:

sequences (Union[ndarray[Any, dtype[float32]], Tensor, Dataset[Tensor]]) -- The sequences for which to compute the NLL.

Return type:

Tensor

Returns:

A tensor of shape [num_sequences] with the NLLs for each individual sequence.

Attention

When calling this function in a multi-process environment, each process receives only a subset of the predictions. If you want to aggregate predictions, make sure to gather the values returned from this method.