960a2d6c5d484db569571a620ca38fb7218ebd7c,ludwig/modules/metric_modules.py,BWCEWLMetric,__init__,#BWCEWLMetric#Any#Any#Any#Any#,120

Before Change


            confidence_penalty=confidence_penalty
        )

        self._reset_states()

    def _reset_states(self):
        self.sum_loss = 0.0
        self.N = 0

After Change


    //   https://www.tensorflow.org/api_docs/python/tf/keras/metrics/Metric

    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
        )

    def update_state(self, y, y_hat):
        loss = self.bwcew_loss_function(y, y_hat)
        self.sum_loss.assign_add(loss)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: uber/ludwig
Commit Name: 960a2d6c5d484db569571a620ca38fb7218ebd7c
Time: 2020-08-18
Author: jimthompson5802@gmail.com
File Name: ludwig/modules/metric_modules.py
Class Name: BWCEWLMetric
Method Name: __init__


Project Name: uber/ludwig
Commit Name: b6f83ab5a36233c57b19aa38f28d58a80b19c3ba
Time: 2020-08-14
Author: jimthompson5802@gmail.com
File Name: ludwig/modules/metric_modules.py
Class Name: ErrorScore
Method Name: __init__


Project Name: uber/ludwig
Commit Name: b6f83ab5a36233c57b19aa38f28d58a80b19c3ba
Time: 2020-08-14
Author: jimthompson5802@gmail.com
File Name: ludwig/modules/metric_modules.py
Class Name: R2Score
Method Name: __init__