central_moment
Calculates the central moment.
xxxxxxxxxx
central_moment(x, k)
xxxxxxxxxx
m = central_moment(x, k)
Compute the k-th central moment of all the observations.
That is,
where
xxxxxxxxxx
>>> from OpenHA.processing.feature import central_moment
>>> import numpy as np
>>> x = np.array([0, 1, 2, 3, 4])
>>> print(central_moment(x, 2))
# x_ = 2
# = ((-2)^2 + 1^2 + 0^2 + 1^2 + 2^2) / 5
# = (4 + 1 + 0 + 1 + 4) / 5
# = 10 / 5
2
x
—— The value of observations, specified as an array of N-D array of length n
.
For an n-by-m array, it indicates n
observations with m
features.
k
—— Order of raw moment, specified as a positive integer scalar.
Name of the parameters | Is optional? | Source, dialog or input port? |
---|---|---|
x | No | Input port |
k | No | Dialog |