Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ binary_log_loss() [2/6]

template<typename T , require_arithmetic_t< T > * = nullptr>
T stan::math::binary_log_loss ( int  y,
const T &  y_hat 
)
inline

Returns the log loss function for binary classification with specified reference and response values.

The log loss function for prediction \(\hat{y} \in [0, 1]\) given outcome \(y \in \{ 0, 1 \}\) is

\(\mbox{logloss}(1, \hat{y}) = -\log \hat{y} \), and

\(\mbox{logloss}(0, \hat{y}) = -\log (1 - \hat{y}) \).

Template Parameters
Tvalue type
Parameters
[in]yreference value, either 0 or 1
[in]y_hatresponse value in [0, 1]
Returns
Log loss for response given reference value

Definition at line 30 of file binary_log_loss.hpp.