as_penalty#

as_penalty(x: BasePenalty | ndarray | tuple[float, float] | float | None, default: BasePenalty = None, require_penalty_type: str = None)[source]#

Convert an input object to a constant penalty.

Parameters:
xBasePenalty, np.ndarray, tuple[float, float], float, None

Object to convert to a penalty.

defaultBasePenalty, optional, default=BICPenalty

Default penalty to return if penalty is None.

require_penalty_type: str, optional, default=None

Required penalty type. If not None, the penalty must be of this type.

Returns:
penaltyBasePenalty

Penalty object.