Untruncation Actions
LegUntruncation
Bases: RmAction
Leg-level demand untruncation action.
This action will untruncate demand on legs using the specified algorithm. It is called only once at the beginning of each sample.
algorithm
instance-attribute
algorithm: Literal[
"em",
"em_py",
"none",
"naive1",
"naive2",
"naive3",
"pd",
"mfem",
] = algorithm
Untruncation algorithm.
There are several available algorithms:
none
applies no untruncation, and assumes that demand was the same as sales.
Applying this algorithm is still important even if no detruncation is
desired, as PassengerSim tracks historical demand separately from sales
and without "none" the historical demand used in forecasting would be
zero.
em
is an expectation-maximization model.
em_py
is an expectation-maximization model implemented in Python. It is slow
but useful for educational purposes.
naive1
is not recommended for use.
naive2
is not recommended for use.
naive3
is not recommended for use.
pd
is a projection-detruncation model, based on the method developed by
Hopperstad and described by Weatherford & Polt.
mfem
Multi-Flight Expectation Maximization. Takes into account spill and recapture across multiple departures
maxiter
instance-attribute
Maximum number of iterations for the EM and PD algorithms.
initialization_method
instance-attribute
Method for initializing the EM algorithm.
The default method is to use all available data on the first EM iteration. The pods method is to use only the data from unclosed observations on the first EM iteration.
minimum_mu
instance-attribute
Minimum value for the mean of the demand distribution.
If the computed mean is less than this value, untruncation will result in zero demand. Setting this to a very small but non-zero value can help avoid thin-path problems, where untruncation results in some non-zero demand on every path-class, even though many path-classes have zero historical sales and probably will stay that way.
minimum_sigma
instance-attribute
Minimum value for the standard deviation of the demand distribution.
If the computed sigma is less than this value, this value is used instead.
__init__
__init__(
*,
carrier: str = "",
minimum_sample: int = 10,
dcps: Collection[int] = (),
algorithm: Literal[
"em",
"em_py",
"none",
"naive1",
"naive2",
"naive3",
"pd",
"mfem",
] = "em",
which_data: Literal[
"total", "yieldable", "priceable"
] = "total",
maxiter: int = 20,
tolerance: float = 0.01,
initialization_method: Literal[
"default", "pods"
] = "default",
minimum_mu: float = 0.01,
minimum_sigma: float = 0.1,
)
PathUntruncation
Bases: RmAction
Path-level demand untruncation tool.
algorithm
instance-attribute
Untruncation algorithm.
There are several available algorithms:
none
applies no untruncation, and assumes that demand was the same as sales.
Applying this algorithm is still important even if no detruncation is
desired, as PassengerSim tracks historical demand separately from sales
and without "none" the historical demand used in forecasting would be
zero.
em
is an expectation-maximization model.
em_py
is an expectation-maximization model implemented in Python. It is slow
but useful for educational purposes.
naive1
is not recommended for use.
naive2
is not recommended for use.
naive3
is not recommended for use.
pd
is a projection-detruncation model, based on the method developed by
Hopperstad and described by Weatherford & Polt.
mfem
Multi-Flight Expectation Maximization. Takes into account spill and recapture across multiple departures
maxiter
instance-attribute
Maximum number of iterations for the EM and PD algorithms.
initialization_method
instance-attribute
Method for initializing the EM algorithm.
The default method is to use all available data on the first EM iteration. The pods method is to use only the data from unclosed observations on the first EM iteration.
minimum_mu
instance-attribute
Minimum value for the mean of the demand distribution.
If the computed mean is less than this value, untruncation will result in zero demand. Setting this to a very small but non-zero value can help avoid thin-path problems, where untruncation results in some non-zero demand on every path-class, even though many path-classes have zero historical sales and probably will stay that way.
minimum_sigma
instance-attribute
Minimum value for the standard deviation of the demand distribution.
If the computed sigma is less than this value, this value is used instead.
__init__
__init__(
*,
carrier: str = "",
minimum_sample: int = 10,
dcps: Collection[int] = (),
algorithm: Literal[
"em",
"em_py",
"none",
"naive1",
"naive2",
"naive3",
"pd",
"mfem",
] = "em",
which_data: Literal[
"total", "yieldable", "priceable"
] = "total",
maxiter: int = 20,
tolerance: float = 0.01,
initialization_method: Literal[
"default", "pods"
] = "default",
minimum_mu: float = 0.01,
minimum_sigma: float = 0.1,
)