Stan Math Library  2.20.0
reverse mode automatic differentiation
binary_log_loss.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_BINARY_LOG_LOSS_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_BINARY_LOG_LOSS_HPP
3 
6 
7 namespace stan {
8 namespace math {
9 
26 template <typename T>
27 inline T binary_log_loss(int y, const T& y_hat) {
28  using std::log;
29  return y ? -log(y_hat) : -log1m(y_hat);
30 }
31 
32 } // namespace math
33 } // namespace stan
34 
35 #endif
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:12
fvar< T > binary_log_loss(int y, const fvar< T > &y_hat)
fvar< T > log1m(const fvar< T > &x)
Definition: log1m.hpp:12

     [ Stan Home Page ] © 2011–2018, Stan Development Team.