Example #1
0
 def _setup_loss(self):
     self.train_loss_function = BWCEWLoss(
         positive_class_weight=self.loss["positive_class_weight"],
         robust_lambda=self.loss["robust_lambda"],
         confidence_penalty=self.loss["confidence_penalty"],
     )
     self.eval_loss_function = self.train_loss_function
Example #2
0
 def _setup_loss(self):
     self.train_loss_function = BWCEWLoss(
         positive_class_weight=self.loss['positive_class_weight'],
         robust_lambda=self.loss['robust_lambda'],
         confidence_penalty=self.loss['confidence_penalty']
     )
     self.eval_loss_function = self.train_loss_function
Example #3
0
    def __init__(self,
                 positive_class_weight=1,
                 robust_lambda=0,
                 confidence_penalty=0,
                 name='binary_cross_entropy_weighted_loss_metric'):
        super(BWCEWLMetric, self).__init__(name=name)

        self.bwcew_loss_function = BWCEWLoss(
            positive_class_weight=positive_class_weight,
            robust_lambda=robust_lambda,
            confidence_penalty=confidence_penalty)

        self._reset_states()
Example #4
0
    def __init__(
        self,
        positive_class_weight: Optional[Tensor] = None,
        robust_lambda: int = 0,
        confidence_penalty: int = 0,
        **kwargs,
    ):
        super().__init__()

        self.loss_function = BWCEWLoss(
            positive_class_weight=positive_class_weight,
            robust_lambda=robust_lambda,
            confidence_penalty=confidence_penalty,
        )
Example #5
0
    def __init__(self,
                 positive_class_weight=1,
                 robust_lambda=0,
                 confidence_penalty=0,
                 name='binary_cross_entropy_weighted_loss_metric'):
        super(BWCEWLMetric, self).__init__(name=name)

        self.bwcew_loss_function = BWCEWLoss(
            positive_class_weight=positive_class_weight,
            robust_lambda=robust_lambda,
            confidence_penalty=confidence_penalty)

        self.sum_loss = self.add_weight('sum_loss',
                                        initializer='zeros',
                                        dtype=tf.float32)
        self.N = self.add_weight('N', initializer='zeros', dtype=tf.float32)
Example #6
0
    def __init__(
        self,
        positive_class_weight=1,
        robust_lambda=0,
        confidence_penalty=0,
        name="binary_cross_entropy_weighted_loss_metric",
    ):
        super().__init__(name=name)

        self.bwcew_loss_function = BWCEWLoss(
            positive_class_weight=positive_class_weight,
            robust_lambda=robust_lambda,
            confidence_penalty=confidence_penalty,
        )

        self.sum_loss = self.add_weight("sum_loss",
                                        initializer="zeros",
                                        dtype=tf.float32)
        self.N = self.add_weight("N", initializer="zeros", dtype=tf.float32)