FloorDivide#

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

Bases: ArithmeticOperationFeature

Divide the input with a value.

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

Floor division produces an integer result when both operands are integers, but truncates towards negative infinity when operands are floating-point numbers.

Parameters#

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

The value to floor-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 FloorDivide:

>>> pipeline = dt.Value([-3, 3, 6]) >> dt.FloorDivide(b=5)
>>> pipeline.resolve()
[-1, 0, 1]

Equivalently, this pipeline can be created using:

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

Which is not equivalent to:

>>> pipeline = 5 // dt.Value([-3, 3, 6])  # Different result
>>> pipeline.resolve()
[-2, 1, 0]

Or, more explicitly:

>>> input_value = dt.Value([-3, 3, 6])
>>> floordiv_feature = dt.FloorDivide(b=5)
>>> pipeline = floordiv_feature(input_value)
>>> pipeline.resolve()
[-1, 0, 1]