ModaSnapshot

data class ModaSnapshot(val name: String, val metrics: List<MetricRecord>, val alternatives: List<String>, val scores: Map<String, Map<String, Double>>, val values: Map<String, Map<String, Double>>, val overallValues: Map<String, Double>, val firstRankCounts: Map<String, Int>, val averageRankings: Map<String, Double>, val rankingMethod: String, val aggregationMethod: AggregationMethod, val primaryRecommendation: String, val warnings: List<ModaWarning>, val replicationAggregation: String? = null)(source)

The result of evaluating a MODA study, complete and standing on its own.

A model is live and mutable: defining more alternatives refits domains and changes every value it reports. A snapshot is taken once and does not change afterwards, so results can be held, compared, serialized, or read long after the model that produced them has been discarded.

Everything here is keyed by name rather than by metric, so nothing in a snapshot depends on object identity and it can be written out and read back without losing meaning. metrics and alternatives are in the order they were declared, so a report built from a snapshot presents them the way the study set them out rather than in whatever order a map happened to yield.

Constructors

Link copied to clipboard
constructor(name: String, metrics: List<MetricRecord>, alternatives: List<String>, scores: Map<String, Map<String, Double>>, values: Map<String, Map<String, Double>>, overallValues: Map<String, Double>, firstRankCounts: Map<String, Int>, averageRankings: Map<String, Double>, rankingMethod: String, aggregationMethod: AggregationMethod, primaryRecommendation: String, warnings: List<ModaWarning>, replicationAggregation: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

How primaryRecommendation was arrived at.

Link copied to clipboard

The alternatives, in the order the study declared them.

Link copied to clipboard

The average of each alternative's ranks across the metrics.

Link copied to clipboard

How many metrics ranked each alternative first.

Link copied to clipboard

Indicates whether any metric turned out not to separate the alternatives.

Link copied to clipboard

The metrics, in the order the study declared them.

Link copied to clipboard
Link copied to clipboard

The weighted overall value of each alternative.

Link copied to clipboard

The alternative this study points to, under aggregationMethod.

Link copied to clipboard

How ties were handled when ranking.

Link copied to clipboard

The alternatives ordered best first under aggregationMethod, with ties broken by name so the order is the same every time it is asked for.

Link copied to clipboard

How repeated observations of each score were reduced to the single score compared here, or null when the scores were not observed repeatedly.

Link copied to clipboard

Raw scores, by alternative name and then metric name.

Link copied to clipboard

Values after the value functions were applied, by alternative name and then metric name.

Link copied to clipboard

Anything worth reporting from evaluating the study, as ModaWarning rather than as text.

Functions

Link copied to clipboard
fun metric(metricName: String): MetricRecord?

The record for the named metric, or null when the study had no such metric.

Link copied to clipboard
fun metricData(modaName: String = name): List<MetricData>

The metric rows this result would write, in the order the study declared its metrics.

Link copied to clipboard

The overall rows this result would write.

Link copied to clipboard

The rank-frequency rows this result would write, ordered by average rank as a model orders them, so the best-placed alternative comes first.

Link copied to clipboard

How the alternatives placed on each metric, in the order of alternatives.

Link copied to clipboard
fun resultsAsDatabase(dbName: String, dir: Path = KSL.dbDir, deleteIfExists: Boolean = true, modaName: String = name): DatabaseIfc

Writes this result to a database holding the metric, score, value, overall and rank-frequency tables.

Link copied to clipboard
fun scoreData(modaName: String = name): List<ScoreData>

The score rows this result would write.

Link copied to clipboard
fun valueData(modaName: String = name): List<ValueData>

The value rows this result would write, each carrying where the alternative placed.