Подсчет LT и график Rolling Retention
Мне понадобилось на работе подсчитать LT и построить график Rolling Retention. После небольшого исследования, я поняла, что тема является насущной и неплохо было бы написать обо всех шагах, дабы кому-то это обязательно пригодится.
В основном, я опиралась на пример от Марии Мансуровой и библиотеку, написанную Darshil Desai и добавила кое-что свое.
https://nbviewer.jupyter.org/github/miptgirl/misc_code/blob/master/webinar_case.ipynb
medium.com/analytics-vidhya/user-retention-in-python-8c33fa5766b6
Теория по подсчету LT хорошо написана здесь и здесь.
Итак, я выбрала следующие пути:
- Я взяла когорты пользователей — зарегистрировавшихся с 1 Января по 31 Января 2020, c 1 Февраля по 29 Февраля и т.д. вплоть до Апреля. Посчитала LT в месяцах, предварительно выкинув пользователей 'проживших' один день. То есть внесших депозит и больше не появляющихся в какой-либо день за полгода.
- Я брала всех пользователей, даже тех кто прожил 1 день и рассчитывала когорты по неделям среди всех, зарегистрировавшихся с 1 января по 29 февраля 2020 года.
Я строила Rolling Retention. Его основное отличие от классического Retention в том, что в данном случае, смотрится первая дата активности и последняя, и считается, что пользователь заходил на сайт каждый месяц/неделю/день.
Итак, 1-ый способ
Для начала введем код в ячейку в Jupyter Notebook и установим следующую библиотеку: