mt_metadata.features.weights.feature_weight_spec

Attributes

feature_classes

weight_classes

Classes

FeatureNameEnum

str(object='') -> str

FeatureWeightSpec

Base class for all metadata objects with Pydantic validation.

Module Contents

mt_metadata.features.weights.feature_weight_spec.feature_classes
mt_metadata.features.weights.feature_weight_spec.weight_classes
class mt_metadata.features.weights.feature_weight_spec.FeatureNameEnum

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.

coherence = 'coherence'
multiple_coherence = 'multiple coherence'
class mt_metadata.features.weights.feature_weight_spec.FeatureWeightSpec(**data)

Bases: mt_metadata.base.MetadataBase

Base class for all metadata objects with Pydantic validation.

MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.

_skip_equals

Private attribute listing fields to skip in equality comparisons

Type:

list[str]

_fields

Private attribute caching field information

Type:

dict[str, Any]

Notes

  • All field assignments are validated automatically via Pydantic

  • None values are converted to appropriate defaults (empty string or 0.0)

  • Supports nested attribute access via dot notation

  • Thread-safe for read operations after initialization

feature_name: Annotated[FeatureNameEnum, Field(default='', description='The name of the feature to evaluate (e.g., coherence, impedance_ratio).', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['coherence']})]
feature: Annotated[dict | mt_metadata.features.feature.Feature | mt_metadata.features.coherence.Coherence | mt_metadata.features.fc_coherence.FCCoherence | mt_metadata.features.striding_window_coherence.StridingWindowCoherence, Field(default_factory=Feature, description='The feature specification.', json_schema_extra={'units': None, 'required': True, 'examples': [{'type': 'coherence'}]})]
weight_kernels: Annotated[list[mt_metadata.features.weights.monotonic_weight_kernel.MonotonicWeightKernel | mt_metadata.features.weights.taper_monotonic_weight_kernel.TaperMonotonicWeightKernel | mt_metadata.features.weights.activation_monotonic_weight_kernel.ActivationMonotonicWeightKernel], Field(default_factory=list, description='List of weight kernel specification.', json_schema_extra={'units': None, 'required': True, 'examples': [{'type': 'monotonic'}]})]
classmethod pre_process_feature(data)

Pre-process the feature dict to ensure correct class is instantiated.

classmethod validate_feature(value, info)

Validate the feature field to ensure it matches the feature_name.

classmethod validate_weight_kernels(value, info)

Validate the weight_kernels field to ensure proper initialization.

evaluate(feature_values)

Evaluate this feature’s weighting based on the list of kernels.

Parameters:

feature_values (np.ndarray or float) – The computed values for this feature.

Returns:

combined_weight – The combined weight from all kernels (e.g., multiplied together).

Return type:

np.ndarray or float