Statistic Of Expression

Prev Next

Find The: Statistic Of Expression Image

statistic_of_expression

Calculates one or more statistics on the result of a mathematic expression evaluated against past events. The expression can include Subject attributes that are numeric or integer. Each statistic is output to a Feature with its own name.

For example:

  • The average string length of an auction listing description.
  • The average and minimum string length of a payment reference.

Configuration

  • Feature Name: The "dictionary" name under which the feature value will be stored and referenced by in rules.
  • Expression: A Query-Language expression evaluated against past events. It must result in a numeric value.
  • For Events:
    • With The Same: Provides a way of filtering past events based on the attribute values. There must be at least one Identifier and only Identifier and Subject attributes can be used.
  • Into Features: Statistic Of Expression can calculate multiple statistics from a single configuration and output them to the Feature Names given. Fill in the Feature Name for each statistic required and leave the rest blank. Every statistic you want needs its own Feature Name.

Optional Configuration

  • Default Value: A value that can be assigned to the feature if the attributes to calculate the features are not present.
  • Scope: Can be used to extend the event search from the local node, to all nodes within the same organization all the way to all across customers (global).
  • For Events:
    • All event types: Default, no filter
    • Same as current: Filter by event_type of event being processed
    • Specific event type: List out the event_type to restrict to, as a list. Example: only consider account_login_success.
  • Condition: A Query-Language filter that can be used to refine Features for specific use cases.
  • Time Window: Can be used to limit the Feature calculation to a specific time period/window. e.g 1 week. Default is all ; no time window
  • Starting: Can be used to remove recent events from Feature calculation. Default is immediately ; no lag.

Use Case 1

The average string length of an auction listing title. New listings can then be checked against half the average length for that user over the last 3 months, to detect titles too short.

len(auction_listing.title) < (feature('avg_title_len_3mths') * 0.5)

Implementing In The Feature Editor

image.png

image.png

image.png

image.png

  - name: title_len_3months
    default_value: 0
    time_window:
      months: 3
    starting: immediately
    with_scope: same_node_instance
    find_the:
      statistic_of_expression:
        expression: len(auction_listing.title)
        for_events:
          event_type: all
          include_current_event: false
          with_the_same:
            - identity['ACCOUNT'].account_number.account_number
        into_features:
          average: avg_title_len_3mths