rfho/utils.py
def binary_cross_entropy(labels, logits, linear_input=True, eps=1.e-5, name='binary_cross_entropy_loss'):
    """
    Same as cross_entropy_loss for the binary classification problem. the model should have a one dimensional output,
    the targets should be given in form of a matrix of dimensions batch_size x 1 with values in [0,1].

    :param labels:
    :param logits: sigmoid or linear output of the model
    :param linear_input: (default: True) is y is linear in which case tf.nn.sigmoid will be applied to y
    :param eps: (optional, default 1.e-5) clipping value for log.
    :param name: (optional, default binary_cross_entropy_loss) name scope for the defined operations.
    :return: tensor for the cross_entropy_loss (WITHOUT MEAN ON THE EXAMPLES)
    """
    with tf.name_scope(name):
        sigmoid_out = tf.nn.sigmoid(logits)[:, 0] if linear_input else logits
        # tgs = targets if len(targets.)
        return - (labels * tf.log(tf.clip_by_value(sigmoid_out, eps, 1. - eps)) +
                  (1. - labels) * tf.log(tf.clip_by_value(1. - sigmoid_out, eps, 1. - eps)))

    Same as cross_entropy_loss for the binary classification problem. the model should have a one dimensional output,
    the targets should be given in form of a matrix of dimensions batch_size x 1 with values in [0,1].

    :param labels:
    :param logits: sigmoid or linear output of the model
    :param linear_input: (default: True) is y is linear in which case tf.nn.sigmoid will be applied to y
    :param eps: (optional, default 1.e-5) clipping value for log.
    :param name: (optional, default binary_cross_entropy_loss) name scope for the defined operations.
    :return: tensor for the cross_entropy_loss (WITHOUT MEAN ON THE EXAMPLES)
    
Same as cross_entropy_loss for the binary classification problem. the model should have a one dimensional output,
the targets should be given in form of a matrix of dimensions batch_size x 1 with values in [0,1].
Same as cross_entropy_loss for the binary classification problem . the model should have a one dimensional output the targets should be given in form of a matrix of dimensions batch_size x 1 with values in [ 0 1 ] .
def binary_cross_entropy(labels, logits, linear_input=True, eps=1.e-5, name='binary_cross_entropy_loss'):
    with tf.name_scope(name):
        sigmoid_out = tf.nn.sigmoid(logits)[:, 0] if linear_input else logits
        return - (labels * tf.log(tf.clip_by_value(sigmoid_out, eps, 1. - eps)) +
                  (1. - labels) * tf.log(tf.clip_by_value(1. - sigmoid_out, eps, 1. - eps)))
def binary_cross_entropy ( labels , logits , linear_input = True , eps = 1.e-5 , name = 'binary_cross_entropy_loss' ) : with tf . name_scope ( name ) : sigmoid_out = tf . nn . sigmoid ( logits ) [ : , 0 ] if linear_input else logits return - ( labels * tf . log ( tf . clip_by_value ( sigmoid_out , eps , 1. - eps ) ) + ( 1. - labels ) * tf . log ( tf . clip_by_value ( 1. - sigmoid_out , eps , 1. - eps ) ) )
Same as cross_entropy_loss for the binary classification problem.
Same as cross_entropy_loss for the binary classification problem .
"""
    Same as cross_entropy_loss for the binary classification problem. the model should have a one dimensional output,
    the targets should be given in form of a matrix of dimensions batch_size x 1 with values in [0,1].

    :param labels:
    :param logits: sigmoid or linear output of the model
    :param linear_input: (default: True) is y is linear in which case tf.nn.sigmoid will be applied to y
    :param eps: (optional, default 1.e-5) clipping value for log.
    :param name: (optional, default binary_cross_entropy_loss) name scope for the defined operations.
    :return: tensor for the cross_entropy_loss (WITHOUT MEAN ON THE EXAMPLES)
    """ # tgs = targets if len(targets.)
tensor for the cross_entropy_loss (WITHOUT MEAN ON THE EXAMPLES)
tensor for the cross_entropy_loss ( WITHOUT MEAN ON THE EXAMPLES )
labels
None
logits
sigmoid or linear output of the model
sigmoid or linear output of the model
linear_input
True) is y is linear in which case tf.nn.sigmoid will be applied to y
True ) is y is linear in which case tf . nn . sigmoid will be applied to y
eps
(optional, default 1.e-5) clipping value for log.
( optional default 1 . e - 5 ) clipping value for log .
name
(optional, default binary_cross_entropy_loss) name scope for the defined operations.
( optional default binary_cross_entropy_loss ) name scope for the defined operations .