Subtract#
- class deeptrack.features.Subtract(value: float | Callable[[...], float] = 0, **kwargs: Dict[str, Any])#
Bases:
ArithmeticOperationFeature
Subtract a value from the input.
This feature performs element-wise subtraction (-) from the input.
Parameters#
- valuePropertyLike[int or float], optional
The value to subtract from 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 decreased by 2.
Start by creating a pipeline using Subtract:
>>> from deeptrack.features import Subtract, Value
>>> pipeline = Value([1, 2, 3]) >> Subtract(value=2) >>> pipeline.resolve() [-1, 0, 1]
Equivalently, this pipeline can be created using:
>>> pipeline = Value([1, 2, 3]) - 2
>>> pipeline = - 2 + Value([1, 2, 3])
Or, most explicitly:
>>> input_value = Value([1, 2, 3]) >>> sub_feature = Subtract(value=2) >>> pipeline = sub_feature(input_value)