HomeDocsAPI Reference
Kumo.ai
Docs

AVG

AVG(<table>.<column>, <start>, <end>, <unit>)

Description

Calculates the average of the values in the specified <table>.<column> column over a time period starting from <start> to <end> in <unit>.

  • (Common) When used in PREDICT command (i.e. prediction target), the time period should be positive (in the future).
  • (Common) When used in WHERE command (i.e. a temporal filter), the time period should be negative (in the past).
  • (Common) When used in ASSUMING command (i.e. future assumption), the time period should be positive (in the future).

This operator is only be applicable to numerical columns.

Example

AVG(LOAN.AMOUNT, 0, 30, DAYS)

The above example calculates the average AMOUNT value in the LOAN table between 0 and 30 days.

Training Considerations

  • (Common) Kumo runs your pQuery over many historic slices of data and across all entities that meet your filter criteria to generate training examples.
  • (Common) If for a given entity and historic data slice there are no fact rows to aggregate over, this training example will be dropped. Thus, the operator makes the implicit assumption that for every entity a prediction is generated for, the user is assuming that the entity has at least one fact row in the prediction horizon.
  • (Common) For all aggregations, the start time is excluded from the calculation and the end time is included in the calculation.
  • (Common) The units for the start and end times is days by default but can be specified as months or hours. If you would like to predict periods with no interactions, you may use the IS NULL or IS NOT NULL operators.