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}")
}

Parameters

message

a description of the convergence failure.

Constructors

Link copied to clipboard
constructor(message: String, iterations: Int, lastEstimate: Double)

Properties

Link copied to clipboard

the number of iterations performed before the algorithm was stopped.

Link copied to clipboard

the most recent approximation computed before the algorithm was stopped.