ClassificationEMRefiner

class ClassificationEMRefiner(val tolerance: Double = defaultTolerance, val maxIterations: Int = defaultMaxIterations) : PartitionRefinerIfc(source)

Improves a partition by alternating exact reassignment with refitting, in the manner of classification expectation maximization.

One iteration refits each group's parameters, recomputes the mixing weights from the group sizes, and then reassigns every observation by maximizing the classification log-likelihood over contiguous partitions. The reassignment is exact rather than heuristic: the segmentation it uses solves the constrained problem in time proportional to the number of observations times the number of groups.

Two design decisions distinguish this from a naive alternation, and both were arrived at the hard way.

The component families are fixed for the duration of the run. Choosing a family inside the loop, by any criterion that penalizes parameter count, can lower the very objective the loop is supposed to raise: a one-parameter family may win on a penalized score while fitting the group worse. Family search belongs outside, where each proposal starts a fresh run.

Reassignment is over contiguous partitions, not over all labelings. Assigning each observation to whichever component gives it the largest weighted density can produce a labeling no set of cuts can express, at which point the procedure has left the space it claims to search. Two equal-variance normals of different means do not exhibit this; a narrow and a broad normal sharing a mean do, since the broad one wins in both tails.

Monotonicity is a theorem only when every refit returns an exact maximum likelihood estimate and reassignment is exact. The second holds here; the first does not hold for the estimator catalog, several members of which are unbiased or moment-based rather than likelihood maximizing. Rather than assume a property the library does not provide, the iteration accepts a step only when the objective strictly improves, so monotonicity holds by construction and termination follows from the iteration cap regardless.

Parameters

tolerance

the least improvement in the objective that will be accepted, relative to the current magnitude

maxIterations

the iteration cap; reaching it is reported rather than treated as success

Constructors

Link copied to clipboard
constructor(tolerance: Double = defaultTolerance, maxIterations: Int = defaultMaxIterations)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The number of times the guard rejected a proposed step across the most recent run.

Link copied to clipboard
Link copied to clipboard
open override val name: String

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

Link copied to clipboard

Functions

Link copied to clipboard
open override fun refine(sortedData: DoubleArray, initial: DataPartition, certificate: AdmissibilityCertificate, fitter: ComponentFitterIfc): RefinementResult

Refines the supplied partition.

Link copied to clipboard
open override fun toString(): String