LessThanOrEquals#

class deeptrack.features.LessThanOrEquals(value: float | Callable[[...], float] = 0, **kwargs: Dict[str, Any])#

Bases: ArithmeticOperationFeature

Determine whether input is less than or equal to value.

This feature performs element-wise comparison (<=) of the input.

Parameters#

valuePropertyLike[int or float], optional

The value to compare (<=) with the input. Defaults to 0.

**kwargsAny

Additional keyword arguments passed to the parent constructor.

Example#

In this example, each element in the input array is compared (<=) with 2.

Start by creating a pipeline using LessThanOrEquals:

>>> from deeptrack.features import LessThanOrEquals, Value
>>> pipeline = Value([1, 2, 3]) >> LessThanOrEquals(value=2)
>>> pipeline.resolve()
[ True  True False]

Equivalently, this pipeline can be created using:

>>> pipeline = Value([1, 2, 3]) <= 2
>>> pipeline = 2 <= Value([1, 2, 3])  # Different result.

Or, most explicitly:

>>> input_value = Value([1, 2, 3])
>>> le_feature = LessThanOrEquals(value=2)
>>> pipeline = le_feature(input_value)