Stanzas and Verses Overview

Verse objects are the atoms of the configuration of Mona’s anomaly detection engine (Mona’s “Insights Generator”).

Remember, an insight is an account of an anomaly in the data.

Each Verse contains instructions to detect a single anomaly type within the monitoring context. These instructions specify data segmentation configurations, the metrics to measure and compare, and other specifications regarding assessing whether the behavior is anomalous. The complete catalog of types of Verse objects and the various specifications available with each type, is available in the “Verse Types” chapter.

Stanza objects contain a list of Verse objects, typically ones who share some common parameters. The intent behind Stanza objects is to logically group verses with shared parameters under one name and enable you to define these shared parameters once. The top level key is the name of the Stanza object.

If you’d like to change the parameters’ defaults throughout your usage, you can define those defaults once in stanza_global_defaults in the Context class.

So when deciding on the value of a Verse parameter, Mona will look at the following possible sources, in this order:

  1. The verse object
  2. The encompassing stanza object
  3. The stanza_global_defaults object
  4. The default value (if exists, as stated below for each param)

Verse objects must contain:

  • type: A String. The only valid options are in the list of types below, each corresponding with anomalies that Mona’s signal detection engine can find.
  • segment_by: Names of Segmentation objects which Mona should use to create segments on which it will search for anomalies. Can be empty.
  • metrics: Names of metrics objects to include in anomaly detection -- unless they were previously defined in the Stanza level. This parameter can be empty in verses that do not involve metrics analysis (e.g., SegmentSizeDrift)
  • Additional parameters vary by Verse type. See below.

Verse objects may contain:

  • segment_baseline_by: Names of Segmentation objects on which Mona may segment the baseline data when looking for segments with anomalous behavior.
  • always_segment_baseline_by: Names of Segmentation objects on which Mona must segment the data when looking for segments with anomalous behavior.
    This is useful, for example, when you have different models for each customer, and comparison between data of different customers isn’t relevant. In that case you’d put the segmentation object "customer-id" in the "always_segment_baseline_by" param

Here’s an example simple configuration of a Stanza with one Verse for Smart Brandz Inc.

"stanzas": {

      "outlier_sentiment": {

        "segment_by": [

          "post_length",

          "number_of_tagged_brands",

          "top_tagged_brand"

        ],

        "min_segment_size": 50,

        "metrics": [

          "sentiment_score"

        ],

        "trend_directions": ["desc"],

        "verses": [

          {

            "type": "AverageOutlier",

            "multiplier": 0.75,

          }
         ]
        }
       }