hyped.core.ops.common module

This module defines a collection of data processors for common feature operations.

class hyped.core.ops.common.Eq(*args: Any, **kwargs: Any)[source]

Bases: BaseDataProcessor[EqConfig]

Data processor for checking equality between two feature values.

process(ctx: ~hyped.core.nodes.base.RunContext, a: ~hyped.core.ops.common.Annotated[~hyped.core.ops.common.T, ~hyped.core.features.validators.MatchFeatures(func=~hyped.core.features.validators.FeatureValidator.__init__.<locals>.wrapped_validator)], b: ~hyped.core.ops.common.Annotated[~hyped.core.ops.common.T, ~hyped.core.features.validators.MatchFeatures(func=~hyped.core.features.validators.FeatureValidator.__init__.<locals>.wrapped_validator)]) BoolFeature | bool | list[bool] | BooleanScalar | BooleanArray[source]

Computes whether two feature values are equal.

Parameters:
  • ctx (RunContext) – The execution context.

  • a (T) – The first feature value.

  • b (T) – The second feature value.

Returns:

True if the feature values are equal, otherwise False.

Return type:

Bool

class hyped.core.ops.common.EqConfig[source]

Bases: BaseDataProcessorConfig

Configuration for the Eq processor.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class hyped.core.ops.common.GlobalFilter(*args: Any, **kwargs: Any)[source]

Bases: BaseDataAugmentor[GlobalFilterConfig]

Data augmentor for filtering values based on a condition.

This processor filters input values using a specified boolean condition, returning the filtered values along with their trace indices.

process(ctx: RunContext, value: T, condition: BoolFeature | bool | list[bool] | BooleanScalar | BooleanArray) tuple[T, list[int]][source]

Filters input values based on a boolean condition.

Parameters:
  • ctx (RunContext) – The execution context.

  • value (T) – The input values to filter.

  • condition (Bool) – A boolean array indicating which elements to retain.

Returns:

  • The filtered values that satisfy the condition.

  • The indices of the filtered values in the original array.

Return type:

tuple[T, TraceIndexList]

class hyped.core.ops.common.GlobalFilterConfig[source]

Bases: BaseDataAugmentorConfig

Configuration for the GlobalFilter augmentor.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class hyped.core.ops.common.NotEq(*args: Any, **kwargs: Any)[source]

Bases: BaseDataProcessor[NotEqConfig]

Data processor for checking inverse equality between two feature values.

process(ctx: ~hyped.core.nodes.base.RunContext, a: ~hyped.core.ops.common.Annotated[~hyped.core.ops.common.T, ~hyped.core.features.validators.MatchFeatures(func=~hyped.core.features.validators.FeatureValidator.__init__.<locals>.wrapped_validator)], b: ~hyped.core.ops.common.Annotated[~hyped.core.ops.common.T, ~hyped.core.features.validators.MatchFeatures(func=~hyped.core.features.validators.FeatureValidator.__init__.<locals>.wrapped_validator)]) BoolFeature | bool | list[bool] | BooleanScalar | BooleanArray[source]

Computes whether two feature values are not equal.

Parameters:
  • ctx (RunContext) – The execution context.

  • a (T) – The first feature value.

  • b (T) – The second feature value.

Returns:

False if the feature values are equal, otherwise True.

Return type:

Bool

class hyped.core.ops.common.NotEqConfig[source]

Bases: BaseDataProcessorConfig

Configuration for the NotEq processor.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

hyped.core.ops.common.filter_(value: T, condition: BoolFeature | bool | list[bool] | BooleanScalar | BooleanArray) T[source]

Filters input values based on a boolean condition using the GlobalFilter augmentor.

Parameters:
  • value (T) – The input values to filter.

  • condition (Bool) – A boolean array indicating which elements to retain.

Returns:

The filtered values that satisfy the given condition.

Return type:

T