code: def test_fbeta_multiclass_with_explicit_labels_weighted(
      self, device: str
  ):
      self.predictions = self.predictions.to(device)
      self.targets = self.targets.to(device)
  
      labels = [0, 1]
      fbeta = FBetaVerboseMeasure(labels=labels)
      fbeta(self.predictions, self.targets)
      metric = fbeta.get_metric()
      precisions = metric["weighted-precision"]
      recalls = metric["weighted-recall"]
      fscores = metric["weighted-fscore"]
  
      # compute desired values with sklearn
      (
          weighted_precision,
          weighted_recall,
          weighted_fscore,
          _,
      ) = precision_recall_fscore_support(
          self.targets.cpu().numpy(),
          self.predictions.argmax(dim=1).cpu().numpy(),
          labels=labels,
          average="weighted",
      )
  
      # check value
      assert_allclose(precisions, weighted_precision)
      assert_allclose(recalls, weighted_recall)
      assert_allclose(fscores, weighted_fscore)
  
imports: from typing import Any, Dict, List, Tuple, Union
  import torch
  import numpy
  from sklearn.metrics import precision_recall_fscore_support
  from torch.testing import assert_allclose
  import pytest
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase, multi_device, run_distributed_test, global_distributed_metric
  from allennlp.training.metrics import FBetaVerboseMeasure
label_desc: Use image node_id 13 for calling the FBetaVerboseMeasureTest obj's underlying member method code with example usage: obj.test_fbeta_multiclass_with_explicit_labels_weighted(device) without return types