mt_metadata.features.weights.activation_monotonic_weight_kernel

Classes

ThresholdEnum

str(object='') -> str

ActivationStyleEnum

str(object='') -> str

ActivationMonotonicWeightKernel

MonotonicWeightKernel

Module Contents

class mt_metadata.features.weights.activation_monotonic_weight_kernel.ThresholdEnum

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

low_cut = 'low cut'
high_cut = 'high cut'
class mt_metadata.features.weights.activation_monotonic_weight_kernel.ActivationStyleEnum

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

sigmoid = 'sigmoid'
hard_sigmoid = 'hard_sigmoid'
tanh = 'tanh'
hard_tanh = 'hard_tanh'
class mt_metadata.features.weights.activation_monotonic_weight_kernel.ActivationMonotonicWeightKernel(**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.

threshold: Annotated[ThresholdEnum, Field(default=ThresholdEnum.low_cut, description='Which side of a threshold should be downweighted.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['low cut']})]
activation_style: Annotated[ActivationStyleEnum, Field(default=ActivationStyleEnum.sigmoid, description='Tapering/activation function to use between transition bounds.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['tanh']})]
steepness: Annotated[float, Field(default=1.0, description='Controls the sharpness of the activation transition.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['10']})]
evaluate(values)

Evaluate the activation function for the given input values.

Parameters:

values (NDArray) – Input values to be evaluated.

Returns:

Evaluated activation values.

Return type:

NDArray

Raises:

ValueError – If the activation style is not recognized.