Calculates the perplexity of a vector of (log-)probabilities.
Arguments
- x
A vector of log-probabilities.
- na.rm
Should missing values (including NaN) be removed?
- log.p
If TRUE (default), x are assumed to be log-transformed probabilities with base e, if FALSE x are assumed to be raw probabilities, alternatively log.p can be the base of other logarithmic transformations.
Details
If x are raw probabilities (NOT the default), then perplexity is calculated as follows:
$$\left(\prod_{n} x_n \right)^\frac{1}{N}$$
See also
Other general functions:
set_cache_folder()