Divide#

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

Bases: ArithmeticOperationFeature

Divide the input with a value.

This feature performs element-wise division (/) of the input.

Parameters#

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

The value to divide the input. Defaults to 0.

**kwargs: Any

Additional keyword arguments passed to the parent constructor.

Examples#

>>> import deeptrack as dt

Start by creating a pipeline using Divide:

>>> pipeline = dt.Value([1, 2, 3]) >> dt.Divide(b=5)
>>> pipeline.resolve()
[0.2 0.4 0.6]

Equivalently, this pipeline can be created using:

>>> pipeline = dt.Value([1, 2, 3]) / 5
>>> pipeline.resolve()
[0.2 0.4 0.6]

Which is not equivalent to:

>>> pipeline = 5 / dt.Value([1, 2, 3])  # Different result
>>> pipeline.resolve()
[5.0, 2.5, 1.6666666666666667]

Or, more explicitly:

>>> input_value = dt.Value([1, 2, 3])
>>> truediv_feature = dt.Divide(b=5)
>>> pipeline = truediv_feature(input_value)
>>> pipeline.resolve()
[0.2 0.4 0.6]