ConvergenceException
class ConvergenceException(message: String, val iterations: Int, val lastEstimate: Double) : KStatsException(source)
Thrown when an iterative numerical algorithm fails to converge within its iteration limit.
Some computations in kstats rely on iterative methods (e.g. quantile functions for certain distributions, regularized incomplete gamma/beta functions). If the algorithm does not reach the required precision within the allowed number of iterations, this exception is thrown with diagnostic information to help identify the problem.
Example:
try {
dist.quantile(0.999)
} catch (e: ConvergenceException) {
println("Failed after ${e.iterations} iterations, last estimate: ${e.lastEstimate}")
}Content copied to clipboard
Parameters
message
a description of the convergence failure.