LessThan#

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

Bases: ArithmeticOperationFeature

Determine whether input is less than 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 LessThan:

>>> from deeptrack.features import LessThan, Value
>>> pipeline = Value([1, 2, 3]) >> LessThan(value=2)
>>> pipeline.resolve()
[ True False 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])
>>> lt_feature = LessThan(value=2)
>>> pipeline = lt_feature(input_value)