Lihat retensi secara cepat dengan heatmap cohort

6.7.19

Lihat retensi secara cepat dengan heatmap cohort

Diperbarui 2020-10-07 Baca 1 menit

Untuk analisis retensi, heatmap yang menampilkan cohort akuisisi dan bulan berjalan adalah pendekatan standar. Pola garis vertikal atau horizontal sering menunjuk masalah periode tertentu.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

cohorts = ["2024-01", "2024-02", "2024-03", "2024-04", "2024-05", "2024-06"]
months = [f"Bulan {m}" for m in range(1, 7)]
rng = np.random.default_rng(21)
base = np.linspace(0.7, 0.4, num=6)
matrix = np.vstack(
    [
        np.clip(base - idx * 0.03 + rng.normal(0, 0.01, size=base.size), 0.1, 0.9)
        for idx in range(len(cohorts))
    ]
)

fig, ax = plt.subplots(figsize=(6.4, 3.8))
im = ax.imshow(matrix, cmap="YlGnBu", vmin=0, vmax=1)

ax.set_xticks(range(len(months)), labels=months)
ax.set_yticks(range(len(cohorts)), labels=cohorts)
ax.set_title("Heatmap cohort retensi langganan")

for i in range(matrix.shape[0]):
    for j in range(matrix.shape[1]):
        ax.text(j, i, f"{matrix[i, j]*100:.0f}%", ha="center", va="center", fontsize=9)

cbar = fig.colorbar(im, ax=ax, fraction=0.045, pad=0.02)
cbar.set_label("Tingkat retensi")
ax.set_xlabel("Bulan sejak akuisisi")
ax.set_ylabel("Cohort akuisisi")

fig.tight_layout()

plt.show()

Pola garis dapat mengungkap masalah periode tertentu.

Kiat membaca #

  • Jika satu cohort turun tajam, bulan akuisisi tersebut mungkin bermasalah.
  • Perubahan horizontal mengindikasikan tantangan siklus hidup produk.
  • Menampilkan persentase membantu interpretasi tanpa bergantung pada warna saja.