HistogramValleyPartitionGenerator

Places cuts at the deepest valleys of a histogram of the data.

A mixture of well separated components shows as modes separated by troughs, and the trough is close to where the component densities cross. This generator therefore encodes a different belief about where a good partition lies than the within-group sum of squares criterion does: it looks for gaps in the data rather than for compact groups. Comparing fits initialized both ways is how the experiment measures whether that belief pays.

Bin boundaries are mapped to admissible cut positions, valleys are ranked by depth relative to the larger neighbouring peak, and the deepest are taken subject to leaving every group valid. When too few usable valleys are found, null is returned; the caller is expected to fall back to another generator rather than receive a partition that means nothing.

The bin count is set explicitly rather than left to automatic selection. KSL's automatic binning is tuned for display and can return as few as two bins for a widely gapped sample, which leaves no interior bin in which a valley could be found. Since the whole purpose here is to locate a gap, the resolution must be fine enough to contain one; the default rule is the square root of the sample size, bounded to a sensible range.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override 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
open override 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 override fun toString(): String