Subtract#

class deeptrack.features.Subtract(b: Any | list[Any] | Callable[[...], Any | list[Any]] = 0, **kwargs: Any)#

Bases: ArithmeticOperationFeature

Subtract a value from the input.

This feature performs element-wise subtraction (-) from the input.

Parameters#

b: PropertyLike[Any | list[Any]], optional

The value to subtract from the input. Defaults to 0.

**kwargs: Any

Additional keyword arguments passed to the parent constructor.

Examples#

>>> import deeptrack as dt

Create a pipeline using Subtract:

>>> pipeline = dt.Value([1, 2, 3]) >> dt.Subtract(b=2)
>>> pipeline.resolve()
[-1, 0, 1]

Alternatively, the pipeline can be created using operator overloading:

>>> pipeline = dt.Value([1, 2, 3]) - 2
>>> pipeline.resolve()
[-1, 0, 1]

Or:

>>> pipeline = -2 + dt.Value([1, 2, 3])
>>> pipeline.resolve()
[-1, 0, 1]

Or, more explicitly:

>>> input_value = dt.Value([1, 2, 3])
>>> sub_feature = dt.Subtract(b=2)
>>> pipeline = sub_feature(input_value)
>>> pipeline.resolve()
[-1, 0, 1]