code: def _sklearn_binary_hinge_loss(preds, target, ignore_index):
      preds = preds.numpy().flatten()
      target = target.numpy().flatten()
      if not ((preds > 0) & (preds < 1)).all():
          preds = sigmoid(preds)
  
      target, preds = remove_ignore_index(target, preds, ignore_index)
      target = 2 * target - 1
      return sk_hinge(target, preds)
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from scipy.special import softmax
  from sklearn.metrics import hinge_loss
  from sklearn.preprocessing import OneHotEncoder
  from torchmetrics.classification.hinge import BinaryHingeLoss, HingeLoss, MulticlassHingeLoss
  from torchmetrics.functional.classification.hinge import binary_hinge_loss, multiclass_hinge_loss
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES
  from unittests.classification.inputs import _binary_cases, _multiclass_cases
  from unittests.helpers.testers import MetricTester, inject_ignore_index, remove_ignore_index
label_desc: Use image node_id 1 for calling a global function with example usage: _sklearn_binary_hinge_loss(preds, target, ignore_index) and returns: sk_hinge