Prediction Models

Implements a variety of prediction models.

ia.gaius.prediction_models.average_emotives(record: list) dict

Averages the emotives in a list (e.g. predictions ensemble or percepts). The emotives in the record are of type: [{‘e1’: 4, ‘e2’: 5}, {‘e2’: 6}, {‘e1’: 5 ‘e3’: -4}]

Parameters:

record (list) – List of emotive dictionaries to average emotives of

Returns:

Dictionary of Averaged Emotives

Return type:

dict

Example

from ia.gaius.prediction_models import average_emotives
record = [{'e1': 4, 'e2': 5}, {'e2': 6}, {'e1': 5 'e3': -4}]
averages = average_emotives(record=record)
ia.gaius.prediction_models.bucket_predictions(ensemble: list) list

Buckets predictions with identical potential values into a single prediction, merging emotives dicts and averaging as necessary.

This function is invoked before model_per_emotive() to ensure that there is only a single prediction corresponding to each potential level. This is because the model_per_emotive function computes a delta between predictions based on potential value. By flattening to a single prediction, we ensure that there are no collsions in the principal_value computed in model_per_emotive based on potential.

Parameters:

ensemble (list) – Prediction ensemble

Returns:

Resultant ensemble

Return type:

list

ia.gaius.prediction_models.hive_model_classification(ensembles: dict, strip_pipes: bool = True) Counter | None

Compute the “hive predicted model classification” based on the ensembles provided from each node

Parameters:
  • ensembles (dict) – should be dictionary of { node_name: prediction_ensemble }

  • strip_pipes (bool) – Strip pipes from classifications

Returns:

hive predicted classification

Return type:

str

ia.gaius.prediction_models.hive_model_emotives(ensembles: dict) dict

Compute average of emotives in model by calling average_emotives() on ensembles Internally calls prediction_ensemble_modeled_emotives() on each ensemble, then calls average_emotives() on the results :param ensembles: should be dictionary of { node_name: prediction_ensemble } :type ensembles: dict

Returns:

Dictionary of Averaged Emotives

Return type:

dict

ia.gaius.prediction_models.model_per_emotive(ensemble: list, emotive: str, potential_normalization_factor: float) float

Compute the modeled emotive value, using the prediction ensemble and potential_normalization_factor

Identifies the principal value for the emotive by utilizing the first prediction (e.g. highest potential prediction) containing that emotive. For the rest of predictions in the ensemble, the modeled value is updated using the delta between the current emotive value and the principal value * current potential / potential_normalization_factor.

The intent is to ensure that the resultant modeled emotive value is never greater than the individual value of an emotive, and that subsequent emotive values impact the modeled value less and less, based on their potential values.

Prior to updating this function, the delta to update the modeled value was computed by subtracting the current emotive value from the principal value, but this resulted in a case where the modeled emotive value was greater than any individual value seen in the prediction ensemble.

Parameters:
  • ensemble (list) – The prediction ensemble to use in computations

  • emotive (str) – The emotive to compute a moving average of

  • potential_normalization_factor (float) – Sum of potential from all predictions in ensemble

Returns:

modeled emotive value for specific emotive

Return type:

float

ia.gaius.prediction_models.most_common_ensemble_model_classification(ensemble: list, strip_pipes: bool = True) str | None
ia.gaius.prediction_models.prediction_ensemble_model_classification(ensemble: list, strip_pipes: bool = True) Counter | None

Compute classification rankings based on the symbols present in a prediction ensemble

Parameters:
  • ensemble (list) – Prediction Ensemble

  • strip_pipes (bool) – Strip pipes from classifications

Returns:

dictionary containing ranking of classification symbols

Return type:

Counter

ia.gaius.prediction_models.prediction_ensemble_modeled_emotives(ensemble: list) dict

The emotives in the ensemble are of type: ‘emotives’:[{‘e1’: 4, ‘e2’: 5}, {‘e2’: 6}, {‘e1’: 5 ‘e3’: -4}] First calls average_emotives() on each prediction in the ensemble, then calls bucket_predictions() on the ensemble. After bucketing predictions, the function model_per_emotives() is called for each emotive present in the ensemble. Dict returned contains { emotive: model_per_emotive() } for each emotive in the ensemble

The potential_normalization_factor is taken after bucketing predictions to ensure that all predictions with identical potential values are flattened into a single list (avoids collisions with principal_values in model_per_emotive()) :param ensemble: Prediction ensemble containing emotives to model :type ensemble: list

Returns:

Dictionary of modelled emotive values

Return type:

dict

ia.gaius.prediction_models.principal_delta(principal, other, potential)