docstr: Intializes variables related to main loss function
docstr_tok: ["Intializes","variables","related","to","main","loss","function"]
code: def do_loss_initializations(
      self,
      yloss_type,
      diversity_loss_type,
      feature_weights,
      encoding="one-hot",
  ):
      """Intializes variables related to main loss function"""
  
      self.loss_weights = [
          yloss_type,
          diversity_loss_type,
          feature_weights,
      ]
      # define the loss parts
      self.yloss_type = yloss_type
      self.diversity_loss_type = diversity_loss_type
      # define feature weights
      if feature_weights != self.feature_weights_input:
          self.feature_weights_input = feature_weights
          if feature_weights == "inverse_mad":
              normalized_mads = self.data_interface.get_valid_mads(
                  normalized=False
              )
              feature_weights = {}
              for feature in normalized_mads:
                  feature_weights[feature] = round(
                      1 / normalized_mads[feature], 2
                  )
  
          feature_weights_list = []
          if encoding == "one-hot":
              for feature in self.data_interface.encoded_feature_names:
                  if feature in feature_weights:
                      feature_weights_list.append(
                          feature_weights[feature]
                      )
                  else:
                      feature_weights_list.append(1.0)
          elif encoding == "label":
              for feature in self.data_interface.feature_names:
                  if feature in feature_weights:
                      feature_weights_list.append(
                          feature_weights[feature]
                      )
                  else:
                      # the weight is inversely proportional to max value
                      feature_weights_list.append(
                          round(
                              1 / self.feature_range[feature].max(), 2
                          )
                      )
          self.feature_weights_list = [feature_weights_list]
  
imports: import copy
  import random
  import timeit
  import numpy
  import pandas
  from raiutils.exceptions import UserConfigValidationException
  from dice_ml import diverse_counterfactuals
  from dice_ml.constants import ModelTypes
  from dice_ml.explainer_interfaces.explainer_base import ExplainerBase
label_desc: Use image node_id 3 for calling the DiceGenetic obj's underlying member method code with example usage: obj.do_loss_initializations(yloss_type, diversity_loss_type, feature_weights, encoding) without return types