check_penalty#

check_penalty(penalty: float | ArrayLike, *, ensure_non_decreasing: bool = True, copy: bool = True, caller_name: str | None = None, arg_name: str = 'penalty') float | ndarray[source][source]#

Check if the given penalty is valid.

Parameters:
penaltyfloat | ArrayLike

The penalty to check.

ensure_non_decreasingbool, default=True

If True, the penalty must be non-decreasing.

copybool, default=True

Whether to copy the penalty array. Ignored if penalty is a scalar.

caller_namestr | None, default=None

The name of the caller. Used for error messages.

arg_namestr, default=”penalty”

The name of the argument. Used for error messages.