Subtract#
- class deeptrack.features.Subtract(value: float | Callable[[...], float] = 0, **kwargs: dict[str, Any])#
Bases:
ArithmeticOperationFeatureSubtract a value from the input.
This feature performs element-wise subtraction (-) from the input.
Parameters#
- value: PropertyLike[int or float], optional
The value to subtract from the input. Defaults to 0.
- **kwargs: dict of str to 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(value=2) >>> pipeline.resolve() [-1, 0, 1]
Alternatively, the pipeline can be created using operator overloading: >>> pipeline = dt.Value([1, 2, 3]) - 2
Or: >>> pipeline = -2 + dt.Value([1, 2, 3])
Or, more explicitly: >>> input_value = dt.Value([1, 2, 3]) >>> sub_feature = dt.Subtract(value=2) >>> pipeline = sub_feature(input_value)