jax.scipy.signal.detrend#
- jax.scipy.signal.detrend(data, axis=-1, type='linear', bp=0, overwrite_data=None)[源代码][源代码]#
从数据中去除线性或分段线性趋势。
JAX 实现的
scipy.signal.detrend()
。- 参数:
- 返回:
去趋势化后的数据数组。
- 返回类型:
示例
一维中的简单去趋势操作:
>>> data = jnp.array([1., 4., 8., 8., 9.])
从数据中去除线性趋势:
>>> detrended = jax.scipy.signal.detrend(data) >>> with jnp.printoptions(precision=3, suppress=True): # suppress float error ... print("Detrended:", detrended) ... print("Underlying trend:", data - detrended) Detrended: [-1. -0. 2. -0. -1.] Underlying trend: [ 2. 4. 6. 8. 10.]
从数据中去除恒定趋势:
>>> detrended = jax.scipy.signal.detrend(data, type='constant') >>> with jnp.printoptions(precision=3): # suppress float error ... print("Detrended:", detrended) ... print("Underlying trend:", data - detrended) Detrended: [-5. -2. 2. 2. 3.] Underlying trend: [6. 6. 6. 6. 6.]