Find The: Result Of Expression 
result_of_expression
The result of a Query-Language expression, which may combine one or more other Features with arithmetic.
For example a total count Feature (velocity of device) combined with a filtered one (velocity of device where country = US) to produce the percentage of times the device has been seen in the US.
Configuration
- Feature Name: The "dictionary" name under which the feature value will be stored and referenced by in rules.
- Expression: The Query-Language expression to evaluate. It may reference other Features.
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).
Use Case 1
Compare what a customer has paid in against what they have moved on.
Two Statistic Of Numeric Features sum transaction.amount over the last week for the same customer token, one filtered to deposit events and one to transfer events, and this Feature divides the first by the second.
A ratio near 1 means money is leaving about as fast as it arrives, which is what a pass-through account looks like; a high ratio means it is accumulating.
The denominator is guarded, because a customer with deposits and no transfers would otherwise divide by zero:
if(outcome['CHAMPION'].features.general['sum_amn_for_customer_at_transfer_in7days'] > 0, outcome['CHAMPION'].features.general['sum_amn_for_customer_at_deposit_in7days'] / outcome['CHAMPION'].features.general['sum_amn_for_customer_at_transfer_in7days'], 0.0)
Using the Feature in Rules and Investigations
Find a week where nearly everything paid in has already been moved on. The lower bound keeps the guard's 0 out of the rule, since 0 means there were no transfers at all.
feature('deposit_to_transfer_ratio') > 0 and feature('deposit_to_transfer_ratio') < 1.1
Implementing In The Feature Editor
- name: amn_for_customer_at_deposit_in7days
default_value: -1
with_scope: same_node_instance
time_window:
weeks: 1
starting: immediately
find_the:
statistic_of_numeric:
attribute: transaction.amount
for_events:
event_type:
- deposit
include_current_event: true
with_the_same:
- identity['ACCOUNT'].customer_token.customer_token
into_features:
sum: sum_amn_for_customer_at_deposit_in7days
- name: amn_for_customer_at_transfer_in7days
default_value: -1
with_scope: same_node_instance
time_window:
weeks: 1
starting: immediately
find_the:
statistic_of_numeric:
attribute: transaction.amount
for_events:
event_type:
- transfer
include_current_event: true
with_the_same:
- identity['ACCOUNT'].customer_token.customer_token
into_features:
sum: sum_amn_for_customer_at_transfer_in7days
- name: deposit_to_transfer_ratio
default_value: -1
with_scope: same_node_instance
find_the:
result_of_expression: if(outcome['CHAMPION'].features.general['sum_amn_for_customer_at_transfer_in7days']
> 0, outcome['CHAMPION'].features.general['sum_amn_for_customer_at_deposit_in7days']
/ outcome['CHAMPION'].features.general['sum_amn_for_customer_at_transfer_in7days'],
0.0)
Note: The Features an Expression reads have to be defined in the same step, and are calculated before it runs. Default Value only catches a result that is not a number. 0 / 0 is not a number and falls back to it; a positive numerator over a zero denominator does not, which is why the denominator is tested rather than left to the Default Value.
Use Case 2
Turn a filtered count and a total count into a percentage. Both are Velocity Of Features on the same identifier, one of them narrowed by a Condition, and this Feature divides one by the other.
The Expression addresses each Feature by its stored name:
outcome['CHAMPION'].features.general['my_example_feature'] * ( 100.0 / outcome['CHAMPION'].features.general['my_total_count_feature'] )
Using the Feature in Rules and Investigations
Find events where the filtered count is less than a fifth of the total.
feature('result_of_expr') < 20.0
Implementing In The Feature Editor

- name: result_of_expr
default_value: 0
find_the:
result_of_expression: outcome['CHAMPION'].features.general['my_example_feature'] * ( 100.0 / outcome['CHAMPION'].features.general['my_total_count_feature'] )
with_scope: same_node_instance