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