code: def test_fbeta_multilabel_with_weighted_average(self, device: str):
      self.predictions = self.predictions.to(device)
      self.targets = self.targets.to(device)
  
      labels = [0, 1]
      fbeta = FBetaMultiLabelMeasure(average="weighted", labels=labels)
      fbeta(self.predictions, self.targets)
      metric = fbeta.get_metric()
      precisions = metric["precision"]
      recalls = metric["recall"]
      fscores = metric["fscore"]
  
      (
          weighted_precision,
          weighted_recall,
          weighted_fscore,
          _,
      ) = precision_recall_fscore_support(
          self.targets.cpu().numpy(),
          torch.where(
              self.predictions >= fbeta._threshold,
              torch.ones_like(self.predictions),
              torch.zeros_like(self.predictions),
          )
          .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 Dict, List, Tuple, Union, Any
  import pytest
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase, global_distributed_metric, multi_device, run_distributed_test
  from sklearn.metrics import precision_recall_fscore_support
  from torch.testing import assert_allclose
  from allennlp.training.metrics import FBetaMultiLabelMeasure
label_desc: Use image node_id 13 for calling the FBetaMultiLabelMeasureTest obj's underlying member method code with example usage: obj.test_fbeta_multilabel_with_weighted_average(device) without return types