docstr: Computes the first part (y-loss) of the loss function.
docstr_tok: ["Computes","the","first","part","(","y-loss",")","of","the","loss","function","."]
code: def compute_yloss(self):
      """Computes the first part (y-loss) of the loss function."""
      yloss = 0.0
      for i in range(self.total_CFs):
          if self.yloss_type == "l2_loss":
              temp_loss = tf.pow(
                  (
                      self.model.get_output(self.cfs[i])
                      - self.target_cf_class
                  ),
                  2,
              )
              temp_loss = temp_loss[:, (self.num_output_nodes - 1) :][
                  0
              ][0]
          elif self.yloss_type == "log_loss":
              temp_logits = tf.compat.v1.log(
                  (
                      tf.abs(
                          self.model.get_output(self.cfs[i]) - 0.000001
                      )
                  )
                  / (
                      1
                      - tf.abs(
                          self.model.get_output(self.cfs[i]) - 0.000001
                      )
                  )
              )
              temp_logits = temp_logits[
                  :, (self.num_output_nodes - 1) :
              ]
              temp_loss = tf.nn.sigmoid_cross_entropy_with_logits(
                  logits=temp_logits, labels=self.target_cf_class
              )[0][0]
          elif self.yloss_type == "hinge_loss":
              temp_logits = tf.compat.v1.log(
                  (
                      tf.abs(
                          self.model.get_output(self.cfs[i]) - 0.000001
                      )
                  )
                  / (
                      1
                      - tf.abs(
                          self.model.get_output(self.cfs[i]) - 0.000001
                      )
                  )
              )
              temp_logits = temp_logits[
                  :, (self.num_output_nodes - 1) :
              ]
              temp_loss = tf.compat.v1.losses.hinge_loss(
                  logits=temp_logits, labels=self.target_cf_class
              )
  
          yloss += temp_loss
  
      return yloss / self.total_CFs
  
imports: import copy
  import random
  import timeit
  import numpy
  import tensorflow
  from dice_ml import diverse_counterfactuals
  from dice_ml.counterfactual_explanations import CounterfactualExplanations
  from dice_ml.explainer_interfaces.explainer_base import ExplainerBase
label_desc: Use image node_id 9 for calling the DiceTensorFlow2 obj's underlying member method code with example usage: obj.compute_yloss() and returns: unknown