Standard Deviation Transform¶
The standard deviation transform computes the standard deviation of a window. When combined with the SlidingWindow
abstraction, the standard deviation transform can be used to compute the std
feature of a time series. The standard deviation is defined as:
where \(x_i\) is the \(i\)-th element of the window, \(n\) is the number of elements in the window, and \(\mu\) is the mean of the window.
Bases: Transform
Compute the standard deviation of the values in x
.
__call__(signal_window, ddof=0, where=lambda : not np.isnan(x))
¶
Compute the standard deviation of the signal window provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal_window | ndarray | The signal window to find the standard deviation of. | required |
ddof | Union[int, int_] | The delta degrees of freedom. Default is | 0 |
where | Callable[[Union[int, float, int_, float_]], Union[bool, bool_]] | A function that takes a value and returns | lambda : not numpy.isnan(x) |
Returns:
Type | Description |
---|---|
Union[float_, int_] | A scalar value representing the standard deviation of the signal. |
Examples¶
import numpy as np
import autonfeat as aft
# Random data
n_samples = 100
x = np.random.rand(n_samples)
# Create sliding window
ws = 10
ss = 10
window = aft.SlidingWindow(window_size=ws, step_size=ss)
# Create transform
tf = aft.StdTransform()
# Get featurizer
featurizer = window.use(tf)
# Get features
features = featurizer(x)
# Print features
print(window)
print(tf)
print(features)
If you enjoy using AutonFeat
, please consider starring the repository ⭐️.