How can sequential retention fractions become cumulative retention?

cumprod returns a running product. Multiplying stage-relative fractions expresses retention against the original cohort.

numpy.cumprod in practice

Retain half the cohort, then four fifths of the survivors, and two fifths remain. Check the denominator before combining fractions already measured against the initial cohort.

import numpy as np
np.cumprod([0.5,0.8])

Result [0.5, 0.4]

中文

多轮留存率怎样合成累计留存?

cumprod 计算因子的前缀积。当每个比率都相对上一阶段时,连乘给出相对起点的比例。

numpy.cumprod 算例

第一步保留一半,第二步保留其中八成,最终剩四成。若两个百分比本来都以初始人群为分母,就不能再次相乘。

import numpy as np
np.cumprod([0.5,0.8])

结果 [0.5, 0.4]

References / 参考来源

Keep reading / 继续阅读