Model Metric Data Aggregation

Model Metric Aggregation

The implementation of a model metric defines how a metric aggregates data across a component hierarchy. For MathWorks model metrics, the model metric aggregation is defined using the slmetric.metric.Metric class, which includes two aggregation properties:

  • AggregationMode has the following options:

    • Sum: Returns the sum of the Value property and the Value properties of its children components across the component hierarchy.

    • Max: Returns the maximum of the Value property and the Value properties of its children components across the component hierarchy.

    • None: No aggregation of metric values.

  • AggregateComponentDetails is a Boolean value:

    • true: For metrics that return Detailed Results (more than one result per component), the results are aggregated to the component level. Values and measures of the detailed results belonging to a component are summed. A result is created that spans the complete component.

    • false: Returns the detailed results of the component. The detailed results are not aggregated.

You can find the descriptions of MathWorks model metrics and their aggregation property settings in Model Metrics.

Access Aggregated Metric Data

To collect metric data in the metric engine, you call slmetric.Engine.execute. You can then access the metric data from the metric engine by calling slmetric.Engine.getMetrics and specifying the input argument AggregationDepth. AggregationDepth values are:

  • AllgetMetrics aggregates the detailed results to the component level. Then, getMetrics uses the component level results are to calculate the aggregated values by traversing the component hierarchy. getMetrics returns only the component-level results.

  • None — Do not aggregate measures and values. If you specify this option, getMetrics returns metric values that the metric algorithm collects. For example, if the metric algorithm returns detailed results, the detailed results are returned without aggregation.

The aggregated metric data is available in these properties of a slmetric.metric.Result object:

  • AggregatedValue

  • AggregatedMeasures

For an example, see Collect Model Metrics Programmatically.

Detailed Results

Some model metrics collect detailed results for a component. This means that the metric algorithm can potentially return more than one result for a component. The MathWorks model metrics that return detailed results are:

Custom Model Metrics

You can create your own custom model metrics and include them in the metric repository. While creating your model metric, you can define how the metric data is aggregated. For more information, see Create a Custom Model Metric.

See Also

| | |

Related Topics

Was this topic helpful?