class_docstr: Factorization Machine (aka FM).
  
  This class implements L2-regularized arbitrary order FM model with logistic
  loss and gradient-based optimization.
  
  Only binary classification with 0/1 labels supported.
  
  See TFFMBaseModel and TFFMCore docs for details about parameters.
code: def _preprocess_sample_weights(
      self, sample_weight, pos_class_weight, used_y
  ):
      assert (
          sample_weight is None or pos_class_weight is None
      ), "sample_weight and pos_class_weight are mutually exclusive parameters"
      used_w = np.ones_like(used_y)
      if sample_weight is None and pos_class_weight is None:
          return used_w
      if type(pos_class_weight) == float:
          used_w[used_y > 0] = pos_class_weight
      elif sample_weight == "balanced":
          pos_rate = np.mean(used_y > 0)
          neg_rate = 1 - pos_rate
          used_w[used_y > 0] = neg_rate / pos_rate
          used_w[used_y < 0] = 1.0
          return used_w
      elif (
          type(sample_weight) == np.ndarray
          and len(sample_weight.shape) == 1
      ):
          used_w = sample_weight
      else:
          raise ValueError(
              "Unexpected type for sample_weight or pos_class_weight parameters."
          )
  
      return used_w
  
file_path: tffm/tffm/models.py
imports: import numpy
  from .base import TFFMBaseModel
  from .utils import loss_logistic, loss_mse, sigmoid
label_desc: Use image node_id 2 for calling the TFFMClassifier obj's underlying member method code with example usage: obj._preprocess_sample_weights(sample_weight, pos_class_weight, used_y) and returns: used_w, used_w, used_w