<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Rachel Wehr Insight Project - Medium]]></title>
        <description><![CDATA[Churn prediction modeling — a consulting project - Medium]]></description>
        <link>https://medium.com/rachel-wehr-insight-project?source=rss----319f453a8d21---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Rachel Wehr Insight Project - Medium</title>
            <link>https://medium.com/rachel-wehr-insight-project?source=rss----319f453a8d21---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:30:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/rachel-wehr-insight-project" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Churn Around: Predicting user churn and retention in a mobile fitness app]]></title>
            <link>https://medium.com/rachel-wehr-insight-project/churn-around-predicting-user-churn-and-retention-in-a-mobile-fitness-app-e292e6933719?source=rss----319f453a8d21---4</link>
            <guid isPermaLink="false">https://medium.com/p/e292e6933719</guid>
            <category><![CDATA[insight-data-science]]></category>
            <category><![CDATA[churn-prediction]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Rachel Wehr]]></dc:creator>
            <pubDate>Fri, 04 Oct 2019 15:09:22 GMT</pubDate>
            <atom:updated>2019-10-22T22:54:58.956Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.linkedin.com/in/rachel-nauer/"><em>Rachel Wehr</em></a><em> is an </em><a href="https://www.insighthealthdata.com/"><em>Insight Health Data Science</em></a><em> Fellow (Fall 2019). She obtained her PhD in cognitive neuroscience and psychology from Boston University. During her graduate studies, she examined the neurobiological mechanisms of hippocampal subfield-related plasticity in the human brain and the opposing effects of aging and aerobic fitness on memory and cognition.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*QzKqok35JdAv1_d_jMzNBA.png" /><figcaption><strong>“We’re leveraging state-of-the-art science and technology, alongside thoughtful human craftsmanship, to deliver an engaging, evidence-based platform to bring healthy living to everyone, one person at a time.“ ~</strong><em>Rick Henrikson, Ongo Science CEO</em></figcaption></figure><p>During my Insight fellowship, I worked on a consulting project in collaboration with <a href="https://www.ongo.life/">Ongo Science</a>, a San Francisco based start up that is working to facilitate communication and flow of data between health and wellness content creators and users of their <a href="https://apps.apple.com/us/app/the-run-experience/id1189131975">apps</a>. Currently, available health and wellness content is usually a one-way street in terms of communication. Health content creators do not have a sufficient way to incorporate data such as whether someone reached their fitness or meditation goal, or what rates their users find success. Ongo Science is <a href="https://blog.ongo.life/owners-manual-for-your-body-88a945e6a8ce">working to facilitate flow of information</a> back to fitness coaches and health experts from their users. In turn, this will enable content creators to make informed decisions during content creation which facilitate greater user success and wellness. I analyzed metadata and active user data captured from the app since its launch (approximately 28 days prior to beginning my project at Insight) to predict user retention and user churn.</p><h3>Which users of a mobile app will continue engaging and which will discontinue (“churn”)?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qXZ2O17xzskToZWJsacbw.jpeg" /></figure><p>For many business, identifying which customers or consumers are likely to stop using the service or product (churn) is critical to company growth. According to <a href="https://hbswk.hbs.edu/archive/the-economics-of-e-loyalty">analyses</a> from Bain &amp; Company along with Earl Sasser of the Harvard Business School, as much as a 5% increase in customer retention can lead to profit increases ranging between 25% to 95%. In addition, it can cost companies up to <a href="https://www.invespcro.com/blog/customer-acquisition-retention/">five times more to attract a new customer</a> than it does to retain an existing one. Not surprisingly, churn is often considered a critical commercial metric customer satisfaction and company growth.</p><p>According to Quettra, mobile apps <a href="https://andrewchen.co/new-data-shows-why-losing-80-of-your-mobile-users-is-normal-and-that-the-best-apps-do-much-better/">lose approximately 77% of their daily active users</a> (DAUs) within the first three days following install. This means that only 23% of users return to use the app three days after installing. Particularly for start-ups, retaining users and limiting user churn is key to company success.</p><p>Therefore, the motivating priority for this project was to develop a framework to ingest and analyze data to better understand what the users of the app were doing, and which factors impact whether a user continues or stops using the app. The goal of this project was use a set of features defined by user in-app activity during the first week of downloading the app to build a machine learning model to predict churn. Because Ongo Science’s app was recently launched, the results of these analyses can give them early insight into where to target marketing and promotional campaigns in an effort to increase user retention.</p><h3>Data exploration and feature engineering</h3><p>Ongo’s vision for building fitness and wellness includes summarizing user information and feedback to the content creators. This effectively means that they are tracking a plethora of different types of data from their user activity including metadata interactions and active data collection.</p><p>When logging into the app, users have the option to engage in several ways. This includes active engagement such as tracking a run using built-in GPS, enrolling in a structured content track (such as “Half marathon training” or “30 day challenge”), or completing an exercise module as part of a track or a single session. Additionally, users have the option to engage in social media aspects like posting on their news feed, asking questions, and liking comments.</p><p>The data was located in a PostgreSQL database hosted by Amazon Web Services. I was given access to about 500M+ rows of data, detailing all of the users’ in-app activities across 45 different tables. The database contained user information from the very beginning of the app development through beta testing and the app launch. Beta testers are often not necessarily the same population as the eventual users and usually have access to different features of an earlier version of the app. Therefore, I narrowed my analysis window to include data collected the day of the app and subsequent days only.</p><p>As of the beginning of my project, the app had been launched about one month prior. By the conclusion of my analyses, the dataset contained 52 days of data post-launch. All the data presented here will be on this dataset. I interfaced the PostgreSQL database directly with RStudio using the <em>RPostgreSQL</em> and <em>sqldf</em> packages available in <em>R</em>. I built an interfaced workflow to seamlessly clean the data and engineer the model features using RStudio.</p><p>I chose to exclude users that had less than 14 total days of data (e.g. they must have downloaded the app at least 15 days prior to the last data entry point). My reasoning for this temporal cutoff was that I planned to use the first 7 days worth of data per user to predict subsequent churn. For health and running apps, users do not necessarily engage or login to the app daily. Specifically for health apps, median weekly logins are approximately around <a href="https://www.flurry.com/post/144245637325/appmatrix">3 logins per week</a>. Additionally, I was facing a temporal challenge — I had only 52 days of data since the app’s launch to use. Choosing the first 7 days allowed me enough of a temporal gradient to capture weekly fluctuations in exercise regimens for a user, but also gave a long enough time span (more than 7 additional days) to classify a user as churned. These temporal restrictions resulted in data from 73% from all active users.</p><p><strong><em>Defining churn:</em></strong></p><p>User churn is often flexibly defined by a company based on several factors including timescale of interest and various threshold levels. In general, churn rate for a customer base reflects the proportion of individuals that discontinue a service over a given time period. Deciding the time period of interest is often based on several factors such as 1) expected frequency of product or service use, and 2) a specific thresholded level of engagement the company is interested in measuring.</p><p>For instance, an e-commerce company that sell big ticket items such as furniture may classify a user as churned if they do not make a furniture purchase within one calendar year. Alternatively, a fitness app such as the one being analyzed in this project may reasonably expect users to keep coming back and opening or using the app once to a few times a week.</p><p>A second factor to consider when operationalizing churn for my model is the threshold for user engagement that we are interested in predicting. For my project with Ongo, I wanted to examine churn at two separate thresholds and create two models to evaluate what features of activity during the first week of download are predictive for each threshold.</p><p>In the data frame, I created two binary vectors reflecting these two thresholds for churn per each unique user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kUcJfd-KEgUjCP7wViL8YQ.png" /><figcaption>Moving from each threshold of engagement is an opportunity for a user to disengage from the app, or churn. I have identified two levels of user engagement that I am defining and analyzing user churn at these steps (Interest → Minimal and Minimal → Active).</figcaption></figure><ol><li><strong>Minimal engagement</strong>: A churner was defined as a user that opened the app <em>only one time or less</em> following the first week</li><li><strong>Active engagement:</strong> A churner was defined as a user that did not meaningfully engage in the app following the first week period</li></ol><p>After defining the different churn thresholds, it was time to dive into the data! While I was examining the data, I was faced with additional considerations:</p><ul><li>Each user has a unique day that they downloaded the app, so it would be important to shift to each user’s initial date with the app and not filter by calendar date to avoid data leakage</li><li>This meant also that each user has a unique number of days since they downloaded the app, creating different timelines of opportunity for “churn” for each user</li></ul><p>Therefore, I built a pipeline to ingest the data and address these issues using RStudio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HHEQDIHWvAWgqgzUOzrM2A.png" /><figcaption>*For illustration purposes only; Plotted values are simulated for confidentiality.</figcaption></figure><p><strong><em>Feature Engineering:</em></strong></p><p>The information collected by the app covered a breadth of available types of data. This ranged from timestamped metadata for specific exercise sessions to active GPS tracked runs to demographic information and more. Despite this breadth, the depth of each of these types of information varied in its scope. For example, while I included all users in with at least 14 days of data in the analysis, only 5% of users voluntarily inputted their age and only 4% inputted their gender.</p><p>In considering which features to input to the model, I had to be mindful of the depth and sparsity of each feature. For this reason, I chose to train my model on the following features:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hP5dsiHG6_1lz-xBh5BVGQ.png" /></figure><ul><li>Number of <strong>logins</strong></li><li>Number of GPS-tracked <strong>runs</strong></li><li>Number of <strong>days</strong> a user logged in</li><li>Number of <strong>tracks enrolled</strong> (e.g. joined “30 day challenge!”)</li><li>Number of <strong>sessions completed</strong> (e.g. completed “15 minute hill intervals” session)</li><li>Number of <strong>social media</strong> interactions (e.g. likes, news feed posts, comments, etc)</li><li><strong>Subscription</strong> status (free/premium)</li></ul><p>The model was trained on the calculation of these features using the first 7 days of data for each user following the download of the app. I originally intended to include several other features, but due to a high incidence of NA values I chose to leave them out. This included age, sex, and 3rd party app information imported from Fitbit and Healthkit. Including this information in future iterations of the model may be of interest when there is ample available data both in terms of temporally and depth.</p><p>While the granularity of the data extends to which tracks and sessions the user engaged with, there was not sufficient data to include each track or session as separate features within the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pej0PpOMw-U9veQiSEmMVg.png" /><figcaption>This shows an example of data from a single user during the first week using the app. The lollipop chart is showing the number of each occurrence for five features (logins, runs, sessions completed, social media interactions, and tracks enrolled). In addition, the total number of active days and the user subscription status were fed into the model to predict churn. Note the daily fluctuations in app use.</figcaption></figure><h3>Model selection and optimization</h3><p>To predict churn, I decided to employ Random Forest modeling using the <em>scikit-learn</em> package in Python. Random forest modeling is one of the most popular and powerful machine learning algorithms and is generally accepted as an effective model to predict churn. Random Forest modeling deals much better with features that have some collinearity than logistic regression.</p><p>The model uses bagging and feature randomness to build each decision tree within a forest. Each decision tree picks a random subset of features being fed into the model to produce a classification prediction. The end result is multiple individual decision trees that operate as an ensemble, in which the output of classification is based on the majority votes by the decision trees. The aggregation of information from multiple uncorrelated trees in the model protect against individual errors, resulting in a powerful machine learning algorithm that is generally resistant to overfitting and produces robust classification results.</p><p>Another bonus of using random forest modeling is that I can extract the importance of each feature. For the current project, this is particularly interesting, as one major goal was to examine which user activities have the most predictive power for determining churn or retention. Depending on feature importance, I can provide Ongo Science with valuable insight into future steps to test whether boosting or reducing particular activities within the app can improve retention and engagement, resulting in greater customer satisfaction and recovery of revenue.</p><p>I partitioned training and testing data using a 75/25 split for cross-validation. Using the features listed above, I trained each model on the first 7 days of data for each user that had the app for at least 14 days. I tuned each model’s hyperparameters using a 5-fold cross validation grid search via the GridSearchCV function in scikit-learn package in python. After determining the optimal hyperparameters for each model, I deployed the model with the test data. I had clear imbalance in my data, particularly for the Active Engagement model. To handle this, I stratified my train-test split to retain the same ratio of classes for testing and training data. Additionally, during model specification, I employed a penalty to misclassification of the minority class using the <em>class_weight= “balanced” </em>flag. This acts by using the y values to automatically adjust weights inversely proportional to class frequencies in the input data.</p><p>In Model 1 (Minimal Engagement model), a user was considered “churned” if he or she did not login to the app even once following the first 7 days. This model performed generally well with an area under the curve (AUC) of 0.80. Another metric of interest is the recall score. Recall answers the following question: of the users that truly churned, how many did we label? This is an important metric for this analysis because it is important to have a low number of eventual churners that were mislabeled. This is because Ongo would not want to miss out on the opportunity to apply marketing and promotional techniques to these individuals. Recall for this model was quite high at 0.88. As for feature importance, only two of the features seemed to carry much predictive weight: total number of logins and the number of active days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEXa5SpMByRZ_-Xcl7gMEw.png" /><figcaption>accuracy = 0.79; precision = 0.69; <strong>recall = 0.88</strong>; f1 score = 0.80</figcaption></figure><p>Next, I specified a higher threshold for considering a customer as retained in Model 2 (Active Engagement model). In this case, a user was considered churned if they did not have even one <em>active, meaningful engagement</em> in the app. This included social media interactions (likes, news story posts, questions, answers, comments), enrolling in an exercise track, completing an exercise session, or logging a GPS-enabled run. Naturally, this resulted in a reduced number of total retained users and a much more imbalanced dataset. This model had acceptable performance as measured by AUC (0.61). Importantly, recall was quite high (0.91).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RuJiIX_2033zYqq07_JPig.png" /><figcaption>accuracy = 0.85; precision = 0.92; <strong>recall = 0.91</strong>; f1 score = 0.85</figcaption></figure><p>Interestingly, the feature importance for the active engagement model looked quite different than the minimal engagement model. The number of total sessions completed during week 1 became the most important feature, followed by the number of total logins during the first week, social media interactions, and total active days.</p><h3>Final Product and Outcomes</h3><p>My analyses on data from very early on in the app’s lifecycle provide important insight about Ongo’s user base. To keep users involved later on, Ongo can try to incorporate push notifications to return the user to the app during the first week. One suggestion is to employ A|B testing to determine the efficacy of deploying push notifications reminding users to log back in during week 1 and whether it significantly reduces churn at this threshold.</p><p>For active engagement churn, the number of sessions completed during week 1 was the most important predictor of churn. One avenue for exploration is to employ promotional strategies for users that participate in the sessions during week. I also recommend that Ongo considers encouraging users to engage more often with the community platform in the app, as social media interactions were an important feature in predicting active engagement following week 1.</p><p>It is also possible that the specific sessions that users complete might be informative indicators for their future churn. At the time this was written, there was not ample data to capture this information. Ongo may eventually decide to examine this information and suggest specific sessions to their users.</p><p>Additionally, as they collect deeper data from users, they can flexibly alter both the <em>R</em> code that I provided to preprocess and clean additional features that were too sparse to include at the current moment. For example, encouraging users to enter demographic information may shed additional light on which populations are at risk for future churn.</p><p>My final deliverables included a data workflow that interfaces directly with their AWS-supported PostgreSQL database. Data cleaning, preprocessing, and feature engineering using RStudio. This information was then ported into a Jupyter notebook and the machine learning models were deployed using python. This workflow allows for this growing team to import, organize, and analyze their user’s data in near real-time to track trends in user engagement as they implement strategies to boost user retention and minimize churn.</p><p>Github for code: <a href="https://github.com/rwehr">https://github.com/rwehr</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e292e6933719" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rachel-wehr-insight-project/churn-around-predicting-user-churn-and-retention-in-a-mobile-fitness-app-e292e6933719">Churn Around: Predicting user churn and retention in a mobile fitness app</a> was originally published in <a href="https://medium.com/rachel-wehr-insight-project">Rachel Wehr Insight Project</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>