MixtureModelingResults

class MixtureModelingResults(val results: List<RankedMixture>, val certificate: AdmissibilityCertificate, val groupFitsByGroupCount: Map<Int, List<GroupFitResult>>, val rejectedGroupCounts: Map<Int, String>, val cacheHitRate: Double, val truncatedGroupCounts: Map<Int, String> = emptyMap(), val refinementsByGroupCount: Map<Int, RefinementResult> = emptyMap(), sortedData: DoubleArray = DoubleArray(0), val criterion: MixtureCriterionIfc = MixtureBICCriterion(), val specifiedComponentCounts: Set<Int>? = null)(source)

Everything produced by one modeling run.

Parameters

results

the evaluated candidates, best first

certificate

the structural facts of the sample

groupFitsByGroupCount

the fit results per group, keyed by number of components

rejectedGroupCounts

the requested numbers of components that were not attempted, with the reason

cacheHitRate

the fraction of group fits answered from the cache

truncatedGroupCounts

the numbers of components whose family search was cut short, with what was cut. These were attempted and produced an answer; that answer may simply not be the best available, which is a different fact from the count being unusable and is reported separately for that reason.

refinementsByGroupCount

what the refiner did at each number of components

sortedData

the observations the mixtures were fitted to, in order. Carried so that the diagnostics can be asked for without handing the data back in, which is how the library's single-distribution results behave.

criterion

the criterion that ranked the candidates. Needed to orient a comparison: whether a smaller value is an improvement is a property of the criterion, not of the number.

specifiedComponentCounts

the numbers of components the caller asked for, when they asked rather than letting the criterion choose. Null after an ordinary search. It changes what the results mean: the recommendation comes from the caller's counts, and the criterion values are evidence about that choice rather than a selection over a searched range.

Constructors

Link copied to clipboard
constructor(results: List<RankedMixture>, certificate: AdmissibilityCertificate, groupFitsByGroupCount: Map<Int, List<GroupFitResult>>, rejectedGroupCounts: Map<Int, String>, cacheHitRate: Double, truncatedGroupCounts: Map<Int, String> = emptyMap(), refinementsByGroupCount: Map<Int, RefinementResult> = emptyMap(), sortedData: DoubleArray = DoubleArray(0), criterion: MixtureCriterionIfc = MixtureBICCriterion(), specifiedComponentCounts: Set<Int>? = null)

Properties

Link copied to clipboard

The recommended candidate, or null when nothing could be fitted.

Link copied to clipboard

Whether a fitted mixture shows the signature of having been over-fitted.

Link copied to clipboard
Link copied to clipboard

How many families the fitter offered, inferred from what a group actually attempted: the candidates that succeeded plus the ones that were rejected. Needed by the extended criterion, which charges for the size of the model space being searched.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Whether the recommendation has more than one component.

Link copied to clipboard

How much better the recommended mixture is than the best single distribution, in the criterion's own units, oriented so that a positive number always means the mixture is better. Null when either is unavailable.

Link copied to clipboard

Whether the criterion prefers the recommended mixture to the best single distribution.

Link copied to clipboard

Whether the number of components was supplied by the caller rather than selected.

Link copied to clipboard

The observations the mixtures were fitted to, in order.

Link copied to clipboard

The recommendation as an ordinary continuous distribution, ready to be sampled from, plotted, or handed to a simulation model. Null when nothing could be fitted.

Link copied to clipboard

The recommended number of components, or null when nothing could be fitted.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The best single distribution, which is simply the best candidate at one component.

Link copied to clipboard
Link copied to clipboard

The single count the caller asked for, or null when they asked for several or none.

Link copied to clipboard

Functions

Link copied to clipboard
fun MixtureModelingResults.asHTML(heldOut: DoubleArray? = null, title: String = "Mixture Modeling Results", bootstrap: MixtureBootstrapResults? = null, includePlots: Boolean = true, description: MixtureDataDescription? = null, hasMechanism: Boolean = false, stability: PartitionStability? = null, adequacy: FitAdequacy? = null, variableName: String = "observed value"): String

The standard report as a self-contained HTML page.

Link copied to clipboard
fun MixtureModelingResults.asMarkdown(heldOut: DoubleArray? = null, title: String = "Mixture Modeling Results", bootstrap: MixtureBootstrapResults? = null, includePlots: Boolean = false, description: MixtureDataDescription? = null, hasMechanism: Boolean = false, stability: PartitionStability? = null, adequacy: FitAdequacy? = null, variableName: String = "observed value"): String

The standard report as Markdown, for pasting into a document that is already text.

Link copied to clipboard

The best candidate for each number of components attempted, which is the profile a reader needs in order to judge how decisively the recommendation was made.

Link copied to clipboard
fun componentCountAgreement(criteria: List<MixtureCriterionIfc> = MixtureModeler.defaultReportedCriteria(catalogSize)): Map<String, Int>

How far the reported criteria agree about the number of components.

Link copied to clipboard
fun componentCountEvidence(criteria: List<MixtureCriterionIfc> = MixtureModeler.defaultReportedCriteria(catalogSize)): ComponentCountEvidence

Why the criterion chose what it chose, assembled from the per-count profile.

Link copied to clipboard
fun componentsAreSeparable(criteria: List<MixtureCriterionIfc> = MixtureModeler.defaultReportedCriteria(catalogSize)): Boolean?

Whether the recommended mixture's components are ones the data can actually tell apart, or null when the comparison could not be made.

Link copied to clipboard
fun componentsAsDataFrame(): AnyFrame

The recommended mixture's components, one row per component.

Link copied to clipboard

The recommended mixture as a table, one row per component.

Link copied to clipboard

Whether this sample is large enough for the recommended component count to be answerable at all, or null when the question does not arise.

Link copied to clipboard

How much of a fresh sample the recommended fit cannot account for at all.

Link copied to clipboard
fun criterionProfile(criteria: List<MixtureCriterionIfc> = MixtureModeler.defaultReportedCriteria(catalogSize)): Map<String, Map<Int, MixtureCriterionValue>>

Every reported criterion's value at every number of components that was fitted.

Link copied to clipboard
fun criterionProfileAsDataFrame(criteria: List<MixtureCriterionIfc> = MixtureModeler.defaultReportedCriteria(catalogSize)): AnyFrame

Every reported criterion's value at every number of components, in long form.

Link copied to clipboard
fun criterionSummary(criteria: List<MixtureCriterionIfc> = MixtureModeler.defaultReportedCriteria(catalogSize)): String

What each criterion would choose, and whether it actually chose.

Link copied to clipboard

The four diagnostic plots for the recommended mixture, or null when nothing was fitted.

Link copied to clipboard

Goodness-of-fit tests for the recommended mixture, or null when nothing was fitted.

Link copied to clipboard

Every family that failed to fit some group, with the estimator's explanation and how often it happened. Estimator failure rates are an experimental result, so they are surfaced rather than logged and forgotten.

Link copied to clipboard
fun showAllResultsInBrowser(heldOut: DoubleArray? = null)

Writes the summary and opens the diagnostic plots.

Link copied to clipboard
fun MixtureModelingResults.showHTMLInBrowser(heldOut: DoubleArray? = null, title: String = "Mixture Modeling Results", bootstrap: MixtureBootstrapResults? = null, includePlots: Boolean = true, description: MixtureDataDescription? = null, hasMechanism: Boolean = false, stability: PartitionStability? = null, adequacy: FitAdequacy? = null, variableName: String = "observed value"): File

Writes the HTML report to a file and opens it.

Link copied to clipboard
fun summary(heldOut: DoubleArray? = null): String

Everything a reader needs in order to judge the recommendation, in one place.

Link copied to clipboard
fun MixtureModelingResults.toReport(title: String = "Mixture Modeling Results", heldOut: DoubleArray? = null, level: Double = 0.95, bootstrap: MixtureBootstrapResults? = null, includePlots: Boolean = true, description: MixtureDataDescription? = null, hasMechanism: Boolean = false, stability: PartitionStability? = null, adequacy: FitAdequacy? = null, variableName: String = "observed value", content: ReportBuilder.() -> Unit = {}): ReportNode.Document

The standard mixture modeling report.

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

A direct answer to "was a mixture worth it?", comparing the recommendation against the best single distribution on the criterion and on the usual goodness-of-fit tests.