DegenerateDataException

Thrown when the input data is mathematically degenerate for the requested operation.

This differs from InsufficientDataException in that the data has enough elements but lacks the variation needed for a meaningful result. For example, computing a linear regression when all x-values are identical makes the slope undefined.

Example:

try {
val x = doubleArrayOf(5.0, 5.0, 5.0)
val y = doubleArrayOf(1.0, 2.0, 3.0)
simpleLinearRegression(x, y) // all x-values are identical
} catch (e: DegenerateDataException) {
println(e.message) // "All x values are identical"
}

Parameters

message

a description of why the data is degenerate.

Constructors

Link copied to clipboard
constructor(message: String)