Initial Configuration

To help with the initial “fields” configuration, once you have exported data, Mona will automatically build a basic config file for you, but this file might require your review and additions to create a full schema with all the metrics you’d like to track.

Let’s take a look at the automatic configuration Mona created.

In the "Getting Started" page, click on “download suggested configuration”

Now a JSON file will be downloaded to your computer with the initial configuration.

{
  "21234f0c-asf32-4239-b456-3t4e4345319g": {
    "LOAN_APPLICATION_TUTORIAL": {
      "fields": {
        "occupation": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        },
        "credit_score": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 0.02
            }
          }
        },
        "loan_taken": {
          "type": "boolean"
        },
        "return_until": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 1000000
            }
          }
        },
        "offered_amount": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 700
            }
          }
        },
        "approved_amount": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 700
            }
          }
        },
        "feature_0": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 60000
            }
          }
        },
        "feature_1": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 0.4
            }
          }
        },
        "feature_2": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 30
            }
          }
        },
        "feature_3": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 6000
            }
          }
        },
        "feature_4": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 0.01
            }
          }
        },
        "feature_5": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 0.2
            }
          }
        },
        "feature_6": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 20
            }
          }
        },
        "feature_7": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 1
            }
          }
        },
        "feature_8": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 50
            }
          }
        },
        "feature_9": {
          "type": "numeric",
          "segmentations": {
            "original": {
              "default": true,
              "bucket_size": 20
            }
          }
        },
        "stage": {
          "type": "string"
        },
        "model_version": {
          "type": "string"
        },
        "loan_paid_back": {
          "type": "boolean"
        }
      }
    }
  }
}

As you can see, the top level of the JSON file is your Mona user id. One level beneath this is where you define your context classes, and in each class, you define a “fields” key. We’ll discuss other possible configuration features in the next chapters but for now let’s focus on the fields, which describe the monitoring schema.

Mona also has a complete GUI (Graphical User Interface) for handling the configuration, and you don’t have to use the JSON file directly after uploading the initial config.

Check initial configuration

Let’s review the fields Mona automatically created, to find out if any changes are necessary. We can see that Mona automatically generated fields for all the keys found in the exported JSON. Considering each of the fields, we first look at the field’s type. Mona supports several field types, the 3 main ones being "string", "numeric" and "boolean".

{
  "purpose": {
    "type": "string"
  }
}

Mona uses best-effort methods to recognize the types for the exported fields, so we recommend making sure no mistakes were made.

If a field is numeric we should now check the segmentation section.
While segmenting the data according to values of string or boolean fields is trivial, numeric field values can be bucketed in infinite ways. By using “segmentation” objects within numeric field configurations, Mona can be configured to segment the numeric field’s values in several ways, as described in our documentation. If not configured correctly, Mona might separate the field into irrelevant bucket sizes.
In the initial config, you will see that Mona already suggested a segmentation option but you might have different preferences for this.

For example, you might want to segment some fields according to a logarithmic scale. If you choose to do that by using the "should_log" key, Mona will bucket the values based on a base 2 logarithmic scale where the smaller values will be in smaller buckets and larger values will be in larger buckets. The "min_value" and "max_value" params are used to set the limits of the segmentation. Values below the "min_value" will all be bucketed in an "UNDER_BOUNDS" bucket, and similarly values over "max_value" will be bucketed in an "OVER_BOUNDS" bucket.

{
  "feature_9": {
    "type": "numeric",
    "segmentations": {
      "original": {
        "default": true,
        "min_value": 0,
        "max_value": 15000,
        "should_log": true
      }
    }
  }
}

Knowing a rough estimate of the values you are sending for each field, what is the proper size of buckets you wish to create? For example, the credit score field which has values between 0-1 can be divided into buckets of 0.1 each or even 0.05 to get more granularity.

{
  "credit_score": {
    "type": "numeric",
    "segmentations": {
      "original": {
        "default": true,
        "bucket_size": 0.05
      }
    }
  }
}

📘

Segmentation configurations can easily be changed at a later point.

Are all fields now defined correctly? Great! Now let’s upload the initial config to Mona.

In the configuration page, click on “Upload as JSON” and choose your config file

Now in config comparison, you can check the config again or compare it to a previous version if one exists. In the validation window, you can validate your fields and see example values for them. After you submit the config Mona will start to process your data according to the config file. Once it is done, the investigations page will become available.


Did this page help you?