Power#

class deeptrack.features.Power(value: float | Callable[[...], float] = 0, **kwargs: Dict[str, Any])#

Bases: ArithmeticOperationFeature

Raise the input to a power.

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

Parameters#

valuePropertyLike[int or float], optional

The value to take the power of 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 elevated to the 3.

Start by creating a pipeline using Power:

>>> from deeptrack.features import Power, Value
>>> pipeline = Value([1, 2, 3]) >> Power(value=3)
>>> pipeline.resolve()
[1, 8, 27]

Equivalently, this pipeline can be created using:

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

Or, most explicitly:

>>> input_value = Value([1, 2, 3])
>>> pow_feature = Power(value=3)
>>> pipeline = pow_feature(input_value)