(y, y_prob)
return loss_sum / sample_num
The cross-entropy loss class for binary classification
            Formula : -sum(log(prob(category_i))) / N

        Parameters
        ----------
        y : Table
            The input data's labels

        y_prob : Table, value of Table is ndarray
            The predict probability of each category.

        Returns
        -------
        softmax_loss : float, the softmax cross entropy loss
The cross-entropy loss class for binary classification
            Formula : -sum(log(prob(category_i))) / N
The cross - entropy loss class for binary classification Formula : - sum ( log ( prob ( category_i ))) / N
def compute_loss(y, y_prob):
        """
        The cross-entropy loss class for binary classification
            Formula : -sum(log(prob(category_i))) / N

        Parameters
        ----------
        y : Table
            The input data's labels

        y_prob : Table, value of Table is ndarray
            The predict probability of each category.

        Returns
        -------
        softmax_loss : float, the softmax cross entropy loss

        """
        # np.sum(np.nan_to_num(y_i * np.log(y_pred)), axis=1)
        loss = y.join(y_prob, lambda y, yp_array: (-np.nan_to_num(np.log(yp_array[y])), 1))
        loss_sum, sample_num = loss.reduce(lambda tuple1, tuple2: (tuple1[0] + tuple2[0], tuple1[1] + tuple2[1]))
        return loss_sum / sample_num
def compute_loss ( y , y_prob ) : # np.sum(np.nan_to_num(y_i * np.log(y_pred)), axis=1) loss = y . join ( y_prob , lambda y , yp_array : ( - np . nan_to_num ( np . log ( yp_array [ y ] ) ) , 1 ) ) loss_sum , sample_num = loss . reduce ( lambda tuple1 , tuple2 : ( tuple1 [ 0 ] + tuple2 [ 0 ] , tuple1 [ 1 ] + tuple2 [ 1 ] ) ) return loss_sum / sample_num