def __init__()

in clearbox/formula.py [0:0]


  def __init__(self, weights: npt.NDArray[float], features: list[F.Node]):
    """Ranking formula constructor.

    Args:
      weights: Array of floating point weights of the features. Shape: (F,).
      features: List of feature nodes, should be of the same size as `weights`.
    """
    if len(weights) != len(features):
      raise ValueError(
          "`weights` and `features` should be of the same length,"
          f" currently `len(weights)` = {len(weights)}, `len(features)` ="
          f" {len(features)}."
      )

    self._weights = weights
    self._features = features
    self._node = F.Add([f * w for f, w in zip(features, weights)])