Example: Definition of Context, Fields, and Stanzas

Here's an example configuration of Fields, Segmentations and Stanzas for Smart Brandz Inc. (Note: we do not define segmentation for top_tagged_brand since it is a string field and therefore its segmentation is created implicitly. The same holds for boolean fields)

{
  "fields": {
    "company-id": {
      "type": "string"
    },
    "browser": {
      "type": "string"
    },
    "text_length": {
      "type": "numeric",
      "segmentations": {
        "example_segmentation_name": {
          "default": true,
          "discrete": true
        }
      }
    },
    "number_of_tagged_brands": {
      "function": "array_length",
      "source": [
        "classification_results"
      ],
      "type": "numeric"
    },
    "top_tagged_brand": {
      "source": "top_tagged_brand",
      "type": "string"
    },
    "sentiment_score": {
      "source": "sentiment.score",
      "type": "numeric",
      "segmentations": {
        "example_segmentation_name": {
          "default": true,
          "min_value": 0,
          "max_value": 300,
          "should_log": true
        }
      }
    }
  },
  "stanzas": {
    "general": {
      "segment_by": [
        "company-id",
        "browser"
      ],
      "metrics": [
        "sentiment_score",
        "number_of_tagged_brands",
        "text_length"
      ],
      "verses": [
        {
          "type": "AverageDrift",
          "min_anomaly_level": 0.25,
          "min_segment_size": 5000
        },
        {
          "type": "AverageOutlier",
          "trend_directions": [
            "desc"
          ],
          "min_anomaly_level": 0.9,
          "time_period": "4w",
          "min_segment_size": 4000
        }
      ]
    }
  }
}

Did this page help you?