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 = torch.pow(
                  (
                      self.get_model_output(self.cfs[i])
                      - self.target_cf_class
                  ),
                  2,
              )[0]
          elif self.yloss_type == "log_loss":
              temp_logits = torch.log(
                  (abs(self.get_model_output(self.cfs[i]) - 0.000001))
                  / (
                      1
                      - abs(
                          self.get_model_output(self.cfs[i]) - 0.000001
                      )
                  )
              )
              criterion = torch.nn.BCEWithLogitsLoss()
              temp_loss = criterion(
                  temp_logits, torch.tensor([self.target_cf_class])
              )
          elif self.yloss_type == "hinge_loss":
              temp_logits = torch.log(
                  (abs(self.get_model_output(self.cfs[i]) - 0.000001))
                  / (
                      1
                      - abs(
                          self.get_model_output(self.cfs[i]) - 0.000001
                      )
                  )
              )
              criterion = torch.nn.ReLU()
              all_ones = torch.ones_like(self.target_cf_class)
              labels = 2 * self.target_cf_class - all_ones
              temp_loss = all_ones - torch.mul(labels, temp_logits)
              temp_loss = torch.norm(criterion(temp_loss))
  
          yloss += temp_loss
  
      return yloss / self.total_CFs
  
imports: import copy
  import random
  import timeit
  import numpy
  import torch
  from dice_ml import diverse_counterfactuals
  from dice_ml.explainer_interfaces.explainer_base import ExplainerBase
label_desc: Use image node_id 10 for calling the DicePyTorch obj's underlying member method code with example usage: obj.compute_yloss() and returns: unknown