Fields Configuration Examples
Simple field, which takes the same named ("customer-id") raw input and uses it as a string.
{
"customer_id": {
"type": "string"
}
}
Exactly the same as the above, only without using default parameter values.
{
"customer_id": {
"type": "string",
"function": "identity",
"source": "customer_id"
}
}
Exactly the same as the above, only allowing a prioritized list of source fields to use. So if you sometimes send the customer id in the raw data as "customer_id", and sometimes as "customerID" - both will be mapped to the same field on Mona
{
"customer_id": {
"type": "string",
"source": [
"customer_id",
"customerId"
]
}
}
Use default value in case field is missing
{
"customer_id": {
"type": "string",
"source": {
"names": [
"customer_id"
],
"default_value": "DEFAULT_CUSTOMER_ID"
}
}
}
Assuming you send out a list of customers in the source log under "customers", this field will hold the amount of customers
{
"customers_amount": {
"type": "numeric",
"function": "array_length",
"source": "customers"
}
}
Perhaps you’d like to follow the rate in which the amount of customers is above 5. You can do this as seen below. Note that we’re using a previously defined field ("customers-amount") as the source for this field.
{
"is_over_5_customers": {
"type": "boolean",
"function": "range_check",
"source": "customers_amount",
"args": [
[
{
"left": 5,
"inclusive": false
}
]
]
}
}
Mona also allows more complex logic. Say that you have a multi-class classification model for category classification, and you’d like to track several performance metrics for it. You can export to Mona the raw classification vector (which contains an array of objects, each with a class name and a score). You’d like, for example, to track the delta between top class probability and the second place. This is a metric that shows how much the classification model is sure of a specific class compared to the rest. You can use the "field_delta" function to calculate this metric. Read about how to use this function, along with any other field-building function here.
{
"category_prob_delta": {
"type": "numeric",
"function": "field_delta",
"source": "category_classification_array",
"args": [
"score",
true,
true
]
}
}
Updated about 3 years ago