mt_metadata.features.weights.feature_weight_spec ================================================ .. py:module:: mt_metadata.features.weights.feature_weight_spec Attributes ---------- .. autoapisummary:: mt_metadata.features.weights.feature_weight_spec.feature_classes mt_metadata.features.weights.feature_weight_spec.weight_classes Classes ------- .. autoapisummary:: mt_metadata.features.weights.feature_weight_spec.FeatureNameEnum mt_metadata.features.weights.feature_weight_spec.FeatureWeightSpec Module Contents --------------- .. py:data:: feature_classes .. py:data:: weight_classes .. py:class:: FeatureNameEnum Bases: :py:obj:`str`, :py:obj:`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'. .. py:attribute:: coherence :value: 'coherence' .. py:attribute:: multiple_coherence :value: 'multiple coherence' .. py:class:: FeatureWeightSpec(**data) Bases: :py:obj:`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. .. attribute:: _skip_equals Private attribute listing fields to skip in equality comparisons :type: list[str] .. attribute:: _fields Private attribute caching field information :type: dict[str, Any] .. rubric:: 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 .. py:attribute:: feature_name :type: 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']})] .. py:attribute:: feature :type: 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'}]})] .. py:attribute:: weight_kernels :type: 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'}]})] .. py:method:: pre_process_feature(data) :classmethod: Pre-process the feature dict to ensure correct class is instantiated. .. py:method:: validate_feature(value, info) :classmethod: Validate the feature field to ensure it matches the feature_name. .. py:method:: validate_weight_kernels(value, info) :classmethod: Validate the weight_kernels field to ensure proper initialization. .. py:method:: evaluate(feature_values) Evaluate this feature's weighting based on the list of kernels. :param feature_values: The computed values for this feature. :type feature_values: np.ndarray or float :returns: **combined_weight** -- The combined weight from all kernels (e.g., multiplied together). :rtype: np.ndarray or float