Power#

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

Bases: ArithmeticOperationFeature

Raise the input to a power.

This feature performs element-wise power (**) of the input.

Parameters#

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

The value to take the power of 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 Power:

>>> pipeline = dt.Value([1, 2, 3]) >> dt.Power(b=3)
>>> pipeline.resolve()
[1, 8, 27]

Equivalently, this pipeline can be created using:

>>> pipeline = dt.Value([1, 2, 3]) ** 3
>>> pipeline.resolve()
[1, 8, 27]

Which is not equivalent to:

>>> pipeline = 3 ** dt.Value([1, 2, 3])  # Different result
>>> pipeline.resolve()
[3, 9, 27]

Or, more explicitly:

>>> input_value = dt.Value([1, 2, 3])
>>> pow_feature = dt.Power(b=3)
>>> pipeline = pow_feature(input_value)
>>> pipeline.resolve()
[1, 8, 27]