class_docstr: TopologicalViT model for classification task.
class_docstr_tok: ["TopologicalViT","model","for","classification","task","."]
docstr: Returns labels' weights to be used for computing weighted loss.
  
  This can be used for weighting the loss terms based on the amount of
  available data for each class, when we have unbalanced data.
docstr_tok: ["Returns","labels","'","weights","to","be","used","for","computing","weighted","loss",".","This","can","be","used","for","weighting","the","loss","terms","based","on","the","amount","of","available","data","for","each","class",",","when","we","have","unbalanced","data","."]
code: def get_label_weights(self) -> jnp.ndarray:
      """Returns labels' weights to be used for computing weighted loss.
  
      This can be used for weighting the loss terms based on the amount of
      available data for each class, when we have unbalanced data.
      """
      if not self.config.dataset_configs.get("num_normal"):
          raise ValueError(
              "When `class_balancing` is True, `num_normal` must"
              " be provided."
          )
      if not self.config.dataset_configs.get("num_normal"):
          raise ValueError(
              "When `class_balancing` is True, `num_abnormal` must"
              " be provided."
          )
      bincount = np.array(
          [
              self.config.dataset_configs.get("num_normal"),
              self.config.dataset_configs.get("num_abnormal"),
          ]
      )
      n_samples = self.config.dataset_configs.get(
          "num_normal"
      ) + self.config.dataset_configs.get("num_abnormal")
      n_classes = 2  # For binary classification.
      return n_samples / (n_classes * bincount)
  
file_path: scenic/scenic/projects/tasseo/vit.py
imports: from typing import Optional
  from flax.training import common_utils
  import jax.numpy
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import model_utils
  from scenic.model_lib.base_models.classification_model import ClassificationModel
  from scenic.projects.baselines import vit
  from topological_transformer.images import topvit
label_desc: Use image node_id 4 for calling the TopologicalViTClassificationModel obj's underlying member method code with example usage: obj.get_label_weights() and returns: unknown