specparam.metrics.metric.Metric

class specparam.metrics.metric.Metric(category, measure, description, func, kwargs=None)[source]

Define a metric to apply to a power spectrum model.

Parameters:
categorystr

The category of measure, e.g. ‘error’ or ‘gof’.

measurestr

The specific measure, e.g. ‘r_squared’.

descriptionstr

Description of the metric.

funccallable

The function that computes the metric.

kwargsdictionary

Additional keyword argument to compute the metric. Each key should be the name of the additional argument. Each value should be a lambda function that takes ‘data’ & ‘results’ and returns the desired parameter / computed value.

__init__(category, measure, description, func, kwargs=None)[source]

Initialize metric.

Methods

__init__(category, measure, description, func)

Initialize metric.

compute_metric(data, results)

Compute metric.

reset()

Reset metric result.

Attributes

flabel

Define formatted label property.

label

Define label property.

compute_metric(data, results)[source]

Compute metric.

Parameters:
dataData

Model data.

resultsResults

Model results.

property flabel

Define formatted label property.

property label

Define label property.

reset()[source]

Reset metric result.

Examples using specparam.metrics.metric.Metric

Custom Metrics

Custom Metrics