getSurprisal_vector: Get surprisal per vector

View source: R/surprisal.R

getSurprisal_vectorR Documentation

Get surprisal per vector

Description

Internal soundgen function called by getSurprisal. Estimates the unexpectedness or "surprisal" of the last element of input vector.

Usage

getSurprisal_vector(x, method = c("acf", "np")[1])

Arguments

x

numeric vector representing the time sequence of interest, eg amplitudes in a frequency bin over multiple STFT frames

method

acf = change in maximum autocorrelation after adding the final point, np = nonlinear prediction (see nonlinPred)

Examples

x = c(rep(1, 3), rep(0, 4), rep(1, 3), rep(0, 4), rep(1, 3), 0, 0)
soundgen:::getSurprisal_vector(x)
soundgen:::getSurprisal_vector(c(x, 1))
soundgen:::getSurprisal_vector(c(x, 13))

soundgen:::getSurprisal_vector(x, method = 'np')
soundgen:::getSurprisal_vector(c(x, 1), method = 'np')
soundgen:::getSurprisal_vector(c(x, 13), method = 'np')

soundgen documentation built on Sept. 12, 2024, 6:29 a.m.