PartitionGeneratorIfc

Produces an initial contiguous partition of sorted data into a requested number of groups.

Implementations supply a starting point for the refinement stage; they are not required to optimize the fitting objective, only to produce a structurally valid partition by whatever criterion they represent. Different generators exist so that the sensitivity of the fitted result to its initialization can be measured rather than assumed.

Implementations must return a partition all of whose groups satisfy the supplied certificate, or null when they cannot. Returning a structurally invalid partition is a defect: the caller is entitled to assume the result is usable.

Inheritors

Properties

Link copied to clipboard
abstract val name: String

A short name identifying the generator, suitable for use as a factor level when results are recorded.

Functions

Link copied to clipboard
abstract fun generate(sortedData: DoubleArray, numGroups: Int, certificate: AdmissibilityCertificate): DataPartition?

Generates a partition of the supplied sorted data into the requested number of groups, or returns null when no partition satisfying the certificate can be produced.

Link copied to clipboard
open fun satisfies(partition: DataPartition, certificate: AdmissibilityCertificate): Boolean

Verifies that every group of the supplied partition satisfies the certificate. Provided so that implementations can check their own output before returning it, and so that tests can state the contract once.