TariffFit class

The result of fitting a tariff to observed prices.

Always read rSquared and distanceTimeCorrelation before using the coefficients. A fit can reproduce the prices very well and still have a completely made-up split between kilometer and minute.

Annotations

Constructors

TariffFit({required int baseFare, required int perKilometer, required int perMinute, required double rSquared, required double meanAbsoluteError, required double maxAbsoluteError, required int sampleCount, required double distanceTimeCorrelation})
Creates a fit.
const

Properties

baseFare → int
The fitted flagfall, in minor units.
final
distanceTimeCorrelation → double
How closely distance and duration track each other, from −1 to 1.
final
hashCode → int
The hash code for this object.
no setterinherited
isUsable → bool
Does the fit reproduce the observed prices?
no setter
maxAbsoluteError → double
The worst error across all samples, in minor units.
final
meanAbsoluteError → double
Mean error in minor units.
final
perKilometer → int
The fitted price per kilometer.
final
perMinute → int
The fitted price per minute.
final
rSquared → double
How much of the variation in prices the model explains, from 0 to 1.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sampleCount → int
How many samples the fit was based on.
final
splitIsReliable → bool
Can the split between kilometer and minute be trusted?
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
predict({required double distanceMeters, required Duration duration}) → int
What the model predicts for a trip, in minor units.
report(List<FareSample> samples) → String
A report with one line per sample, to see where it fails.
toString() → String
A string representation of this object.
override
toTariff({required String currency, int minorUnitDigits = 2, int minimumFare = 0, int waitingPerMinute = 0, Duration waitingGrace = Duration.zero, FareRounding rounding = FareRounding.none, List<TariffBand> bands = const <TariffBand>[], List<Surcharge> surcharges = const <Surcharge>[]}) → Tariff
Builds the fitted tariff.

Operators

operator ==(Object other) → bool
The equality operator.
inherited