code: def test_compute_class_weights(self):
      # regression test for issue #181
      np.random.seed(0)
      y = np.random.choice(a=[0, 1, 2], size=1000, p=[0.3, 0.6, 0.1])
      class_counts = Counter(y)
      weights = compute_class_weights("log", class_counts=class_counts)
      self.assertEqual(weights[1], 1.0)
  
imports: import unittest
  from collections import Counter
  import pytest
  import numpy
  import tensorflow
  import unicodedata
  from finetune.encoding.sequence_encoder import finetune_to_indico_sequence
  from finetune.optimizers.gradient_accumulation import get_grad_accumulation_optimizer
  from finetune.util.imbalance import compute_class_weights
  from finetune.util.optimize_loss import OPTIMIZERS
  from finetune.util.timing import ProgressBar
  from finetune.errors import FinetuneError
  from finetune import Classifier, SequenceLabeler
  from finetune.base_models.gpt.encoder import GPTEncoder
  from finetune.base_models.gpt2.encoder import GPT2Encoder
  from finetune.base_models.bert.roberta_encoder import RoBERTaEncoderV2, RoBERTaEncoder, RoBERTaEncoderSlow
  from finetune.base_models.bert.encoder import BERTEncoderMultuilingal, BERTEncoder
  from finetune.base_models.oscar.encoder import GPCEncoder
  from finetune.scheduler import Scheduler
label_desc: Use image node_id 8 for calling the TestFinetuneIndicoConverters obj's underlying member method code with example usage: obj.test_compute_class_weights() without return types