Median Absolute Deviation (MAD).
The median absolute deviation is the median of the absolute differences between each data point and the data's overall median. In an online setting, the median of the data is unknown beforehand. Therefore, both the median of the data and the median of the differences of the data with respect to the latter are updated online. To be precise, the median of the data is updated before the median of the differences. As a consequence, this online version of the MAD does not coincide exactly with its batch counterpart.
The median of the data.
from river import stats X = [4, 2, 5, 3, 0, 4] mad = stats.MAD() for x in X: print(mad.update(x).get())
0.0 2.0 1.0 1.0 1.0 1.0
Return the current value of the statistic.
Update and return the called instance.
- x — 'numbers.Number'