fit
Fits a mixture with the number of components the caller has chosen.
For the analyst who has looked at a histogram and decided how many groups there are. That is a legitimate way to arrive at a component count and, on this project's own evidence, not obviously worse than the automatic one: the best criterion recovers the true count on well under half of attempts. So it is offered as its own entry point rather than left to be expressed as a one-element range.
One component is always fitted alongside the requested count, at the cost of the cheapest candidate there is, so that the comparison against a single distribution — which is the question the analyst still has, and arguably has more sharply having committed to a structure — remains available. The requested count is what gets recommended; the baseline cannot displace it.
Parameters
the number of components to fit. Must be feasible for this sample; the reason is reported if it is not, rather than an empty result being returned.
the partition generator supplying the initial partition
improves the generated partition
chooses one family per group
Throws
when the count cannot be fitted to this sample, naming the constraint that refuses it