Internal soundgen function called by getSurprisal.
getSurprisal_matrix(
x,
win,
method = c("acf", "np")[1],
sameLagAllFreqs = TRUE,
weightByAmpl = TRUE,
weightByPrecision = TRUE,
onlyPeakAutocor = FALSE,
rescale = FALSE
)input matrix such as a spectrogram (columns = time, rows = frequency)
length of analysis window
(for $surprisal only, has no effect on $info and $kl)
acf = change in maximum autocorrelation after adding the final
point; np = nonlinear prediction (see nonlinPred -
works but is VERY slow); none = do not calculate $surprisal to save
time and only return $info and $kl
(only for method = 'acf') if TRUE, the bestLag is calculated by averaging the ACFs of all channels, and the same bestLag is used to calculate the surprisal in each frequency channel (we expect the same "rhythm" for all frequencies); if FALSE, the bestLag is calculated separately for each frequency channel (we can track different "rhythms" at different frequencies)
if TRUE, ACFs and surprisal are weighted by max amplitude per frequency channel
if TRUE, surprisal is weighted by the current autocorrelation, so deviations from a previous pattern are more surprising if this pattern is strong
if TRUE, only peaks of ACFs are considered (so bestLag can never be 1, and the first change after a string of static values results in surprisal = NA)
if TRUE, surprisal is normalized from (-Inf, Inf) to
[-1, 1]