% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scores.R
\name{log_score}
\alias{log_score}
\title{Logarithmic score for binary and categorical forecasts}
\usage{
log_score(p, y, eps = 1e-15)
}
\arguments{
\item{p}{Numeric vector in \verb{[0, 1]} for binary forecasts, or a numeric
matrix whose rows are probability vectors for categorical forecasts.}

\item{y}{For binary vector input, numeric vector in \verb{\{0, 1\}}. For
categorical matrix input, integer vector in \verb{\{1, ..., K\}}, where
\code{K = ncol(p)}.}

\item{eps}{Numeric. Probability floor used before taking logarithms.
Default is \code{1e-15}. Set to \code{0} to disable clipping.}
}
\value{
Numeric vector of scores in \verb{(-Inf, 0]}. Higher is better.
}
\description{
Computes the positively oriented logarithmic score. Vector probability input
is treated as binary; matrix probability input is treated as categorical.
}
\details{
For binary forecasts, this computes
\deqn{S(p, y) = y\log(p) + (1-y)\log(1-p).}

For categorical forecasts, this computes
\deqn{S(\mathbf{p}, y) = \log(p_y),}
where \code{p_y} is the forecast probability assigned to the realised category.
}
\section{Use with seqcomp}{

The logarithmic score is unbounded below. It should not be used directly
with the finite-sample bounded-difference confidence sequences or
e-processes. For binary outcomes, use \code{winkler_score()} and \code{winkler_cs()}
when the Winkler construction is appropriate. For unbounded score
differences, use \code{cs_asymptotic()} or supply genuine predictable bounds
to \code{eprocess_predictable()}.
}

\examples{
p <- c(0.2, 0.7, 0.9)
y <- c(0, 1, 1)
log_score(p, y)

}
