_validate_max_iter

Signature

_validate_max_iter(max_iter: int) -> int

What problem it solves

Prevents the fit iteration from starting with an invalid maximum iteration count.

Input contract

  • max_iter must be a real integer, not a boolean.

  • The integer value must be strictly positive.

Where it is used

  • in lin_fit before the optional iterative loop on sigma_x

Failure modes

  • ValueError if max_iter is not an integer

  • ValueError if max_iter is a boolean

  • ValueError if max_iter <= 0

Why it stays private

It expresses a validation rule that is very specific to the iterative linear-fit algorithm.