def weights()

in clearbox/models/regression.py [0:0]


  def weights(self) -> npt.NDArray[float] | None:
    """Getter for the tuned weights of the model if they are available.

    In `weights` we ignore bias/intercept term as well as the mean part of
    standard scaling. While those components may be useful when optimizing
    towards some contiguous target, they are redundant for inference as they do
    not depend on the feature values.

    Returns:
      Array of weights as floats if they are available, otherwise `None`.
      Shape: (F,).
    """
    scale_by: float | npt.NDArray[float] = 1.0
    if self._scaler is not None and self._scaler.scale_ is not None:
      scale_by = self._scaler.scale_
    return self._linreg.coef_ / scale_by