MixtureOfExperts#
- class progpy.MixtureOfExpertsModel(models: list, **kwargs)#
Bases:
progpy.composite_model.CompositeModel
New in version 1.6.0.
Mixture of Experts (MoE) models combine multiple models of the same system, similar to Ensemble models. Unlike Ensemble Models, the aggregation is done by selecting the “best” model. That is the model that has performed the best over the past. Each model will have a ‘score’ that is tracked in the state, and this determines which model is best.
The MoE model’s inputs include the inputs and outputs of the individual models making up the model. If the output values are provided as an input to the model then the model will update the score during state transition. The outputs are required to update the score, since this allows for the calculation of how “good” the model is. If outputs are not provided, state transition will continue as normal, without updating model scores.
At a state transition when outputs are provided, the score for the best model will increase by max_score_step for the best fitting model (i.e., lowest error in output) and decrease by max_score_step for the worst. All other models will be scaled between these, based on the error.
Typically, outputs are provided in the MoE model input when performing a state estimation step (i.e. when there is measured data) but not when predicting forward (i.e. when the output is unknown).
When calling output, event_state, threshold_met, or performance_metrics, only the model with the best score will be called, and those results returned. In case of a tie, the first model (in the order provided by the constructor) of the tied models will be used. If not every outputs, event, or performance metric has been identified, the next best model will be used to fill in the blanks, and so on.
- Parameters
models (list[PrognosticsModel]) – List of at least 2 models that form the ensemble
- Keyword Arguments
process_noise – Optional, float or dict[str, float] Process noise (applied at dx/next_state). Can be number (e.g., .2) applied to every state, a dictionary of values for each state (e.g., {‘x1’: 0.2, ‘x2’: 0.3}), or a function (x) -> x
process_noise_dist – Optional, str distribution for process noise (e.g., normal, uniform, triangular)
measurement_noise – Optional, float or dict[str, float] Measurement noise (applied in output eqn). Can be number (e.g., .2) applied to every output, a dictionary of values for each output (e.g., {‘z1’: 0.2, ‘z2’: 0.3}), or a function (z) -> z
measurement_noise_dist – Optional, str distribution for measurement noise (e.g., normal, uniform, triangular)
max_score_step – Optional, float The maximum step in the score. This is the value by which the score of the best model increases, and the worst model decreases.
Example
>> m = MixtureOfExpertsModel([model1, model2])