MixtureComponent#
- class empulse.metrics.MixtureComponent(weight, metric, parameters)[source]#
One term of a
MixtureMetric.- Attributes:
- weightfloat | str | Callable[[dict], float]
The mixture weight for this component.
If
float, a constant weight.If
str, the name of a parameter supplied at call time (e.g.'success_rate'), looked up in the keyword arguments passed to theMixtureMetric.If callable, called with the full dict of keyword arguments passed to the
MixtureMetricand should return afloat. Useful for a weight that is derived from other parameters (e.g.lambda p: 1 - p['success_rate'] - p['default_rate']).
- metricBaseMetric
The metric to evaluate for this component. Usually a
Metric, but anyBaseMetricworks, including a nestedMixtureMetric.- parametersdict[str, Any]
Parameter overrides fixed for this component, merged on top of (and taking priority over) the keyword arguments passed to the
MixtureMetric(e.g.{'gamma': 0.0}to evaluate a deterministic metric at a specific point mass).
- count(value, /)#
Return number of occurrences of value.
- index(value, start=0, stop=sys.maxsize, /)#
Return first index of value.
Raises ValueError if the value is not present.
- metric#
Alias for field number 1
- parameters#
Alias for field number 2
- weight#
Alias for field number 0