Package-level declarations

Types

Link copied to clipboard
@Serializable
data class BatchFailure(val name: String, val message: String)

One failed entry in a batch: the entry's name and a human-readable message. Captured so a batch completes even when some datasets fail (bad import, non-integer discrete data, numerical failure).

Link copied to clipboard
@Serializable
data class BatchFitResultData(val results: List<FitResultData>, val failures: List<BatchFailure> = emptyList())

Wire-safe aggregate result for a FitSpec.Batch: the successful per-dataset results in submission order, plus any per-dataset failures. Each FitResultData.datasetName identifies its entry.

Link copied to clipboard
@Serializable
data class BootstrapEstimateDTO(val parameterName: String, val originalEstimate: Double, val bootstrapAverage: Double, val bias: Double, val mse: Double, val stdError: Double, val numBootstraps: Int, val ciLevel: Double, val normalCILower: Double, val normalCIUpper: Double, val basicCILower: Double, val basicCIUpper: Double, val percentileCILower: Double, val percentileCIUpper: Double)

Wire-safe bootstrap summary for one estimated parameter. The engine performs the resampling and returns only these summaries — never the raw replicate arrays. Three confidence intervals are reported (normal, basic, percentile), each as an explicit lower/upper pair.

Link copied to clipboard
@Serializable
data class DataSummaryDTO(val statistics: StatisticDataDTO, val zeroCount: Int, val negativeCount: Int, val positiveCount: Int)

Wire-safe summary of the data series that was fit: the full StatisticIfc summary (statistics) plus the sign/zero counts the fitting EDA needs (which StatisticData does not carry). The dataset-level left shift is reported separately in ShiftAnalysisDTO (continuous) — it is not a statistic.

Link copied to clipboard
@Serializable
data class DispersionAnalysisDTO(val indexOfDispersion: Double, val poissonVarianceTestStatistic: Double, val degreesOfFreedom: Int, val upperPValue: Double, val lowerPValue: Double, val twoSidedPValue: Double)

Wire-safe, dataset-level dispersion analysis for a discrete data series — the content of the standard report's "Dispersion Analysis" section. The index of dispersion is Var/Mean and the test statistic is T = (n−1)·Var/Mean, referred to a chi-squared distribution with degreesOfFreedom = n−1. The three p-values let a data/AI client read the dispersion conclusion without the chi-squared math.

Link copied to clipboard
@Serializable
data class DistributionFitDTO(val rank: Int, val familyId: String, val estimatorId: String, val rvTypeName: String, val displayName: String, val parameters: Map<String, Double>, val numberOfParameters: Int, val success: Boolean, val message: String? = null, val shift: Double = 0.0, val weightedValue: Double? = null, val averageRanking: Double? = null, val firstRankCount: Int? = null, val chiSquaredPValue: Double? = null, val goodnessOfFit: GoodnessOfFitDTO? = null, val bootstrap: List<BootstrapEstimateDTO>? = null)

Wire-safe, asymmetry-aware result for one (estimator, distribution-family) outcome. family + parameters + shift is everything a distribution-capable client needs to reconstruct the fitted distribution and build any fit-quality plot from its own raw data.

Link copied to clipboard

Serializable mirror of the engine's empirical-probability plotting-position convention (ksl.utilities.statistic.EmpDistType). Carried on the result so a client can reproduce the engine's Q-Q / P-P plots exactly rather than choosing its own plotting-position formula.

Link copied to clipboard
@Serializable
data class FamilyFrequencyResult(val datasetName: String, val numSamples: Int, val frequency: IntegerFrequencyDTO)

Wire-safe result of the family-frequency bootstrap — a standalone (continuous) analysis that resamples a dataset numSamples times, re-runs the full fit + evaluation on each resample, and tallies how often each family is recommended.

Link copied to clipboard
@Serializable
data class FitResultData(val datasetName: String, val kind: DistributionKind, val empProbConvention: EmpProbConvention = EmpProbConvention.CONTINUITY1, val dataSummary: DataSummaryDTO, val fits: List<DistributionFitDTO>, val recommendedFamilyId: String?, val histogram: HistogramDTO? = null, val shiftAnalysis: ShiftAnalysisDTO? = null, val frequency: IntegerFrequencyDTO? = null, val dispersion: DispersionAnalysisDTO? = null, val scoring: ModaResultDTO? = null, val standardReportHtml: String? = null)

Wire-safe machine result for one distribution-fitting job over one dataset — the contract a CLI / REST / MCP client consumes, and the payload carried by a completed async fit. The payload is bounded and independent of sample size: it carries estimated parameters, goodness-of-fit, full MODA scoring, bootstrap summaries, and a data summary, but no plot-data series (a client reconstructs plots from its own raw data plus the returned fitted distribution — see the design plan).

Link copied to clipboard
@Serializable
data class GoodnessOfFitDTO(val chiSquaredStatistic: Double, val chiSquaredDOF: Int, val chiSquaredPValue: Double, val binBreakPoints: List<Double>, val binProbabilities: List<Double>, val expectedCounts: List<Double>, val observedCounts: List<Double>, val ksStatistic: Double? = null, val ksPValue: Double? = null, val andersonDarlingStatistic: Double? = null, val andersonDarlingPValue: Double? = null, val cramerVonMisesStatistic: Double? = null, val cramerVonMisesPValue: Double? = null, val indexOfDispersion: Double? = null, val poissonVarianceTestStatistic: Double? = null)

Wire-safe goodness-of-fit results for one fitted distribution.

Link copied to clipboard
@Serializable
data class HistogramBinDTO(val binNum: Int, val binLabel: String, val lowerLimit: Double, val upperLimit: Double, val count: Double, val cumCount: Double, val proportion: Double, val cumProportion: Double)

Wire-safe mirror of one histogram bin, sourced from the engine's HistogramBinData. Lets a client render the same binning the engine used.

Link copied to clipboard
@Serializable
data class HistogramDTO(val bins: List<HistogramBinDTO>, val underFlowCount: Double, val overFlowCount: Double)

Wire-safe histogram: the ordered bins plus the under/overflow counts. Populated from HistogramIfc.histogramData() by the result extractor.

Link copied to clipboard
@Serializable
data class IntegerFrequencyCellDTO(val value: Int, val count: Double, val cumCount: Double, val proportion: Double, val cumProportion: Double, val cellLabel: String = "")

Wire-safe mirror of one integer-frequency cell, sourced from the engine's ksl.utilities.statistic.FrequencyData. Lets a client render the same frequency distribution the engine computed for the discrete data.

Link copied to clipboard
@Serializable
data class IntegerFrequencyDTO(val cells: List<IntegerFrequencyCellDTO>)

Wire-safe integer-frequency distribution for a discrete data series — the discrete-path counterpart to HistogramDTO. Populated from IntegerFrequency.frequencyData() by the result extractor; null on the continuous path.

Link copied to clipboard
@Serializable
data class MetricDTO(val metricName: String, val direction: String, val weight: Double, val domainLowerLimit: Double, val domainUpperLimit: Double, val unitsOfMeasure: String? = null, val description: String? = null)

Mirrors ksl.utilities.moda.MetricData (definition + swing weight of one metric).

Link copied to clipboard
@Serializable
data class ModaResultDTO(val modelName: String, val rankingMethod: String, val metrics: List<MetricDTO>, val scores: List<ModaScoreDTO>, val values: List<ModaValueDTO>, val rankFrequencies: List<RankFrequencyDTO>)

Wire-safe MODA scoring result for a continuous fit, capturing the FULL multi-objective decision analysis (metrics, raw scores, transformed values, ranks, rank frequencies).

Link copied to clipboard
@Serializable
data class ModaScoreDTO(val alternative: String, val scoreName: String, val scoreValue: Double)

Mirrors ksl.utilities.moda.ScoreData (one raw metric score for one alternative).

Link copied to clipboard
@Serializable
data class ModaValueDTO(val alternative: String, val metricName: String, val metricValue: Double, val rank: Double)

Mirrors ksl.utilities.moda.ValueData (transformed value + rank for one metric/alternative).

Link copied to clipboard
@Serializable
data class RankFrequencyDTO(val alternative: String, val rankValue: Int, val count: Double, val proportion: Double, val cumProportion: Double)

Mirrors ksl.utilities.moda.AlternativeRankFrequencyData (how often an alternative achieved a given rank). rankValue mirrors that class's value field, renamed for clarity.

Link copied to clipboard
@Serializable
data class ShiftAnalysisDTO(val leftShift: Double, val hasZeroes: Boolean, val hasNegatives: Boolean, val zeroTolerance: Double, val ciForMinimumLevel: Double, val ciForMinimumLower: Double, val ciForMinimumUpper: Double)

Wire-safe, complete left-shift analysis for a continuous fit — the full content of the standard report's "Shift Parameter Analysis" section. Carries the estimated left shift, whether the data has zeros/negatives, the zero tolerance used, and the bootstrap confidence interval for the data minimum that drives the shift recommendation.

Link copied to clipboard
@Serializable
data class StatisticDataDTO(val name: String, val count: Double, val average: Double, val standardDeviation: Double, val standardError: Double, val halfWidth: Double, val confidenceLevel: Double, val lowerLimit: Double, val upperLimit: Double, val min: Double, val max: Double, val sum: Double, val variance: Double, val deviationSumOfSquares: Double, val kurtosis: Double, val skewness: Double, val lag1Covariance: Double, val lag1Correlation: Double, val vonNeumannLag1TestStatistic: Double, val numberMissing: Double)

Wire-safe, field-for-field mirror of ksl.utilities.statistic.StatisticData — the full StatisticIfc summary at a chosen confidence level, exactly as produced by StatisticIfc.statisticData(level). Keeping the DTO consistent with StatisticData means a client receives the engine's complete statistical view (including the confidence interval, autocorrelation, and von Neumann lag-1 statistic) rather than an ad-hoc subset.

Functions