def bernoulli_nll(x, y):
 assert isinstance(x, variable.Variable)
 assert isinstance(y, variable.Variable)
 return (sum.sum(softplus.softplus(y)) - sum.sum((x * y)))

def bernoulli_nll ( x , y ) : assert isinstance ( x , variable . Variable ) assert isinstance ( y , variable . Variable ) return ( sum . sum ( softplus . softplus ( y ) ) - sum . sum ( ( x * y ) ) )
computes the negative log-likelihood of a bernoulli distribution .