solution flow diagram
Today, gaining customer loyalty cannot be a one-off thing. A brand needs a focused and integrated plan to retain its best customers—put simply, it needs a customer loyalty program. Earn and burn programs are one of the main paradigms. A typical earn and burn program rewards customers after a certain number of visits or spend.
For example, a fast food chain has launched its earn and burn loyalty pilot program in some locations. They are looking to use the loyalty program to make their customer experience more personal. Upon testing, they want to expand it to more locations across different countries in the future. The program allows customers to earn points for every dollar that they spend. They can redeem the points toward different rewards options. To attract new customers, they also give points to new customers. They test the redeem pattern every month to check the performance of the loyalty program at different locations. Identifying redeem pattern anomalies is crucial in order to take corrective action in time and ensure the overall success of the program. Customers have different earn and redeem patterns at different locations based on their spend and choice of food. Therefore, the process of identifying an anomaly and quickly diagnosing the root cause is difficult, costly, and error-prone.
This post shows you how to use an integrated solution with Amazon Lookout for Metrics to break these barriers by quickly and easily detecting anomalies in the key performance indicators (KPIs) of your interest.
Lookout for Metrics automatically detects and diagnoses anomalies (outliers from the norm) in business and operational data. You don’t need ML experience to use Lookout for Metrics. It’s a fully managed machine learning (ML) service that uses specialized ML models to detect anomalies based on the characteristics of your data. For example, trends and seasonality are two characteristics of time series metrics in which threshold-based anomaly detection doesn’t work. Trends are continuous variations (increases or decreases) in a metric’s value. On the other hand, seasonality is periodic patterns that occur in a system, usually rising above a baseline and then decreasing again.
In this post, we demonstrate a common loyalty points earn and burn scenario, in which we detect anomalies in the customer’s earn and redeem pattern. We show you how to use these managed services from AWS to help find anomalies. You can apply this solution to other use cases such as detecting anomalies in air quality, traffic patterns, and power consumption patterns, to name a few.
This post demonstrates how you can set up anomaly detection on a loyalty points earn and redeem pattern using Lookout for Metrics. The solution allows you to download relevant datasets and set up anomaly detection to detect earn and redeem patterns.
Let’s see how a loyalty program typically works, as shown in the following diagram.
Customers earn points for the money they spend on the purchase. They can redeem the accumulated points in exchange for discounts, rewards, or incentives.
Building this system requires three simple steps:
Then you can review and analyze the results.
Download the file loyalty.csv and save it locally. Then continue through the following steps:
This bucket needs to be unique and in the same Region where you’re using Lookout for Metrics.
loyalty.csv
file.A detector is a Lookout for Metrics resource that monitors a dataset and identifies anomalies at a predefined frequency. Detectors use ML to find patterns in data and distinguish between expected variations in data and legitimate anomalies. To improve its performance, a detector learns more about your data over time.
In our use case, the detector analyzes daily data. To create the detector, complete the following steps:
Your data is encrypted by default with a key that AWS owns and manages for you. You can also configure if you want to use a different encryption key from the one that is used by default.
Now let’s point this detector to the data that you want it to run anomaly detection on.
A dataset tells the detector where to find your data and which metrics to analyze for anomalies. To create a dataset, complete the following steps:
loyalty-point-anomaly-dataset
).With Amazon S3, you can create a detector in two modes:
Measures define KPIs that you want to track anomalies for. You can add up to five measures per detector. The fields that are used to create KPIs from your source data must be of numeric format. The KPIs can be currently defined by aggregating records within the time interval by doing a SUM or AVERAGE.
Dimensions give you the ability to slice and dice your data by defining categories or segments. This allows you to track anomalies for a subset of the whole set of data for which a particular measure is applicable.
In our use case, we add two measures, which calculate the sum of the objects seen in the 1-day interval, and have one dimension, for which earned and redeemed points are measured.
Every record in the dataset must have a timestamp. The following configuration allows you to choose the field that represents the timestamp value and also the format of the timestamp.
The next page allows you to review all the details you added and then choose Save and activate to create the detector.
The detector then begins learning the data inthe data source. At this stage, the status of the detector changes to Initializing.
It’s important to note the minimum amount of data that is required before Lookout for Metrics can start detecting anomalies. For more information about requirements and limits, see Lookout for Metrics quotas.
With minimal configuration, you have created your detector, pointed it at a dataset, and defined the metrics that you want Lookout for Metrics to find anomalies in.
When the backtesting job is complete, you can see all the anomalies that Lookout for Metrics detected in the last 30% of your historical data. From here, you can begin to unpack the kinds of results you will see from Lookout for Metrics in the future when you start getting the new data.
Lookout for Metrics provides a rich UI experience for users who want to use the AWS Management Console to analyze the anomalies being detected. It also provides the capability to query the anomalies via APIs.
Let’s look at an example anomaly detected from our loyalty points anomaly detector use case. The following screenshot shows an anomaly detected in loyalty points redemption at a specific location on the designated time and date with a severity score of 91.
It also shows the percentage contribution of the dimension towards the anomaly. In this case, 100% contribution comes from the location ID A-1002 dimension.
To avoid incurring ongoing charges, delete the following resources created in this post:
In this post, we showed you how to use Lookout for Metrics to remove the undifferentiated heavy lifting involved in managing the end-to-end lifecycle of building ML-powered anomaly detection applications. This solution can help you accelerate your ability to find anomalies in key business metrics and allow you focus your efforts on growing and improving your business.
We encourage you to learn more by visiting the Amazon Lookout for Metrics Developer Guide and trying out the end-to-end solution enabled by these services with a dataset relevant to your business KPIs.
One of the significant challenges statisticians and data scientists face is multicollinearity, particularly its most…
Artificial intelligence is not just altering the way we interact with technology; it’s reshaping the…
This post was co-written with Mickey Alon from Vidmob. Generative artificial intelligence (AI) can be…
Prompt Poet allows you to ground LLM-generated responses to a real-world data context, opening up…
NASA has three more operational Starliner missions on the books. It hasn't decided whether it…
When training a machine learning model, you may sometimes work with datasets with a large…