Predicting new subscriptions with Machine Learning & Magicsheets

  • NOTE 1: You can directly implement the code in this notebook yourself: just go to the link below
  • NOTE 2: This notebook can be used directly with your own Mailchimp dataset. Just save it down on your laptop together with your own dataset called data.csv, and run the code again.

Motivation

  • are a subscription-based business,
  • manage a Slack channel,
  • manage your start-ups newsletter,
  • etc….

The Mailchimp subscriber forecasting problem

The dataset

Cleaning the data

CONFIRM_TIME  count
0 2021-07-26 46
1 2021-07-27 59
2 2021-07-28 50
3 2021-07-29 57
4 2021-07-30 62
.. ... ...
87 2021-10-21 55
88 2021-10-22 56
89 2021-10-23 44
90 2021-10-24 56
91 2021-10-25 65

Visualizing the dataset

Splitting the dataset

  • the model first trains on *most* of the information, for example 70% of the dataset.
  • you then ask the model: what do you predict for the remaining 30% of the dataset?
  • this prediction you can now compare with the real data that you kept hidden away from the model at training.

The predictive model: first attempt

Training the model

Testing the model

Assessing how good the model is

mean of the actual data:  54.47826086956522
prediction value: 69 54.304351
70 54.304351
71 54.304351
72 54.304351
73 54.304351
74 54.304351
75 54.304351
76 54.304351
77 54.304351
78 54.304351
79 54.304351
80 54.304351
81 54.304351
82 54.304351
83 54.304351
84 54.304351
85 54.304351
86 54.304351
87 54.304351
88 54.304351
89 54.304351
90 54.304351
91 54.304351
dtype: float64
51.323250355315075

Improving the predictive model

Teaching your model periodicity

the new model's error is =  47.13314112736905
the new model's error is a 8.164154060659747 % improvement over the old model

Predicting new Mailchimp subscriber numbers

day   prediction
69 51.888901
70 53.800013
71 57.400023
72 53.500012
73 55.100009
74 56.100020
75 52.100006
print(np.floor(predictions))
day prediction
69 51.0
70 53.0
71 57.0
72 53.0
73 55.0
74 56.0
75 52.0

Automating the subscriber predictions with Magicsheets

  1. Log into your Mailchimp, find your Audience signup data and download the dataset to your computer.
  2. Load the dataset into Python with Pandas.
  3. Identify and select the relevant data columns.
  4. Build the time series model (in our case, this is Exponential Smoothing model).
  5. Train the model on the training set.
  6. Test the model on the testing set.
  7. Calculate the MSE, plot the predicitons, and adjust hyperparameters.
  8. Repeat 4→7 until you are happy with your model’s MSE.
  9. Make the predictions
  10. The next day (or week, or month): rinse, wash, repeat!
  1. Log into your Mailchimp and select audience for predictions
  2. Re-train the model and generate new predictions any time you want in a dedicated Slack channel with typing a simple command ‘/run-magicpipe’

I want it! How do I get it?

--

--

--

Adding magic to your spreadsheets, one click at a time.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Time Series Forecasting: Predicting Bitcoin Prices with Machine Learning

Ten Elements of Machine Learning Interviews

NSFW Classifier : Nudity classification on mobile and edge devices.

How to train a Keras model to recognize text with variable length

Paper summary — BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding

What is a Neural Network??

Smart Thumbnailer: How we Improve Thumbor Feature Detector

Photo editor app while cropping image for thumbnail

K-means clustering in Machine Learning:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Magicsheets

Magicsheets

Adding magic to your spreadsheets, one click at a time.

More from Medium

Zillow: A Machine Learning Failure?

Segna Newsletter — 2 December 2021

A summary and some thoughts on GSoC 2021

Voila! Risk Alert