def log_loss(y_true, y_prob):
 y_prob = np.clip(y_prob, 1e-10, (1 - 1e-10))
 if (y_prob.shape[1] == 1):
  y_prob = np.append((1 - y_prob), y_prob, axis=1)
 if (y_true.shape[1] == 1):
  y_true = np.append((1 - y_true), y_true, axis=1)
 return ((- np.sum((y_true * np.log(y_prob)))) / y_prob.shape[0])

def log_loss ( y_true , y_prob ) : y_prob = np . clip ( y_prob , 1e-10 , ( 1 - 1e-10 ) ) if ( y_prob . shape [ 1 ] == 1 ) : y_prob = np . append ( ( 1 - y_prob ) , y_prob , axis = 1 ) if ( y_true . shape [ 1 ] == 1 ) : y_true = np . append ( ( 1 - y_true ) , y_true , axis = 1 ) return ( ( - np . sum ( ( y_true * np . log ( y_prob ) ) ) ) / y_prob . shape [ 0 ] )
compute logistic loss for classification .