Tutorial: Create a time series anomaly prediction experiment
This tutorial guides you through using AutoAI and sample data to train a time series experiment to detect if daily electricity usage values are normal or anomalies (outliers).
When you set up the sample experiment, you load data that analyzes daily electricity usage from Industry A to determine whether a value is normal or an anomaly. Then, the experiment generates pipelines that use algorithms to label these predicted values as normal or an anomaly. After generating the pipelines, AutoAI chooses the best performers, and presents them in a leaderboard for you to review.
Tech preview This is a technology preview and is not yet supported for use in production environments.
Data set overview
This tutorial uses the Electricity usage anomalies sample data set. This data set describes the annual electricity usages for Industry A. The first column indicates the electricity usages and the second column indicates the date, which is in a day-by-day format.
Tasks overview
In this tutorial, follow these steps to create an anomaly prediction experiment:
Create an AutoAI experiment
Create an AutoAI experiment and add sample data to your experiment.
-
From the navigation menu , click Projects > View all projects.
-
Open an existing project or create a new project to store the anomaly prediction experiment.
-
On the Assets tab from within your project, click New asset > Build machine learning models automatically.
-
Click Resource hub sample > Electricity usage anomalies sample data, then select Next. The AutoAI experiment name and description are pre-populated by the sample data.
-
If prompted, associate a Watson Machine Learning instance with your AutoAI experiment.
- Click Associate a Machine Learning service instance and select an instance of Watson Machine Learning.
- Click Reload to confirm your configuration.
-
Click Create.
View the experiment details
AutoAI pre-populates the details fields for the sample experiment:
- Type series analysis type: Anomaly prediction predicts whether future values in a series are anomalies (outliers). A prediction of 1 indicates a normal value and a prediction of -1 indicates an anomaly.
- Feature column: industry_a_usage is the predicted value and indicates how much electricity Industry A consumes.
- Date/Time column: date indicates the time increments for the experiment. For this experiment, there is one prediction value per day.
- This experiment is optimized for the model performance metric: Average Precision. Average precision evaluates the performance of object detection and segmentation systems.
Click Run experiment to train the model. The experiment takes several minutes to complete.
Review the experiment results
The relationship map shows the transformations that are used to create pipelines. Follow these steps to review experiment results and save the pipeline with the best performance.
- The leaderboard lists and saves the three best performing pipelines. Click the pipeline name with Rank 1 to review the details of the pipeline. For details on anomaly prediction metrics, see Creating a time series anomaly prediction experiment.
- Select the pipeline with Rank 1 and Save the pipeline as a model. The model name is pre-populated with the default name.
- Click Create to confirm your pipeline selection.
Deploy the trained model
Before the trained model can make predictions on external values, you must deploy the model. Follow these steps to promote your trained model to a deployment space.
-
Deploy the model from the Model details page. To access the Model details page, choose one of these options:
- From the notification displayed when you save the model, click View in project.
- From the project's Assets, select the model’s name in Models.
-
From the Model details page, click the Promote to deployment space icon. Then, select or create a deployment space to deploy the model.
-
Select Go to the model in the space after promoting it and click Promote to promote the model.
Testing the model
After promoting the model to the deployment space, you are ready to test your trained model with new data values.
-
Select New Deployment and create a new deployment with the following fields:
- Deployment type:
Online
- Name:
Electricity usage online deployment
- Deployment type:
-
Click Create and wait for the status to update to Deployed.
-
After the deployment initializes, click the deployment. Use Test input to manually enter and evaluate values or use JSON input to attach a data set.
-
Click Predict to see whether there are any anomalies in the values.
Note:-1 indicates an anomaly; 1 indicates a normal value.