mt_metadata.features.weights.taper_monotonic_weight_kernel

Classes

HalfWindowStyleEnum

str(object='') -> str

ActivationStyleEnum

str(object='') -> str

TaperMonotonicWeightKernel

MonotonicWeightKernel

Module Contents

class mt_metadata.features.weights.taper_monotonic_weight_kernel.HalfWindowStyleEnum

Bases: mt_metadata.common.enumerations.StrEnumerationBase

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’.

hamming = 'hamming'
hann = 'hann'
rectangle = 'rectangle'
blackman = 'blackman'
class mt_metadata.features.weights.taper_monotonic_weight_kernel.ActivationStyleEnum

Bases: mt_metadata.common.enumerations.StrEnumerationBase

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’.

linear = 'linear'
sigmoid = 'sigmoid'
tanh = 'tanh'
relu = 'relu'
hard_tanh = 'hard_tanh'
hard_sigmoid = 'hard_sigmoid'
class mt_metadata.features.weights.taper_monotonic_weight_kernel.TaperMonotonicWeightKernel(**data)

Bases: mt_metadata.features.weights.monotonic_weight_kernel.MonotonicWeightKernel

MonotonicWeightKernel

Base class for monotonic weight kernels. Handles bounds, normalization, and direction.

A weighting kernel that applies a monotonic activation/taper function between defined lower and upper bounds, based on a given threshold direction.

There are two main types of monotonic kernels: taper and activation. The taper function is used to smoothly transition between the lower and upper bounds over some finite interval, while the activation style offers options that asymptote to 0 or 1, such as sigmoid or tanh. Thus the activation style supports +/- infinity bounds, while the taper style requires finite bounds.

half_window_style: Annotated[HalfWindowStyleEnum, Field(default=HalfWindowStyleEnum.rectangle, description='Tapering/activation function to use between transition bounds.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['hann']})]
evaluate(values)

Evaluate the kernel on the input feature values.

Parameters:

values (np.ndarray or float) – The feature values to apply the weight kernel to.

Returns:

weights – The resulting weight(s).

Return type:

np.ndarray or float