TensorIoT and Amazon Forecast

TensorIoT Editor
TensorIoT
Published in
6 min readDec 2, 2019

By: The TensorIoT Machine Learning Team

Amazon Forecast is an Amazon Web Services (AWS) machine learning service that harnesses both traditional and recent cutting-edge forecasting approaches to make forecasting tools more accessible to a general audience. The AWS service facilitates data ingestion, provides interfaces to model time series, related time series and metadata information. Amazon Forecast offers five forecasting algorithms to create forecasts and generates forecast models and predictions. The machine learning team at TensorIoT leverages Amazon Forecast to make educated project decisions and give our customers the highest quality product possible.

AWS Summary of the Amazon Forecast Service

Forecast predictions are applied to make key decisions across many business domains. These domains include; financial market analyses, sales revenue estimation, resource staffing, and supply chain management. Generating estimates of future growth and demand can drive critical market decisions that affect expenditures, sales, and efficiency. Building accurate forecast models gives companies a leading edge and offers considerable ROI.

Methods used in the field range from simple average projections to regression techniques using seasonality modeling, and more recently, complex deep-learning approaches. These approaches have made forecasting more powerful and accurate, particularly for big and complex datasets. Developing highly accurate models requires substantial data science and time-series analyses expertise. The process to develop these models is characterized by multiple iterations of data engineering and experimentation to determine the best performing forecasts.

Amazon Forecast is an Amazon machine learning service that harnesses both traditional and recent cutting-edge forecasting approaches to make these tools more accessible to a general audience. This service facilitates data ingestion, provides interfaces to model time series, related time series and metadata information, offers five forecasting algorithms to create forecasts and generates forecast models and predictions. All this is done while using a suite of user-friendly tools.

To begin, the user will prepare a target time-series file in a specified format. Typically using a standard date, item id and quantity, along with optional related time series. For example — corresponding location or product categories or the user can include metadata for items in the target time series. Available algorithms include standard forecasting frameworks such ARIMA, Prophet, ETS or NPTS and a deep-learning algorithm DeepAR+. DeepAR+ leverages machine learning methods called neural networks, specifically LSTMS, which have proven to be particularly powerful in modeling complex and large time series datasets across multiple features. After choosing one or more algorithms to test, the forecasts can be generated and exported to AWS storage in S3 as csv, visualized in the console or called by AWS APIs.

TensorIoT has built solutions using Amazon Forecast for applications in financial services, retail and biotech. The fully managed tool has allowed for quicker implementation and more accurate forecast models. For example, TensorIoT has developed an Amazon Forecast solution to predict demand for supply chain management for a large biotech customer. Amazon Forecast was used to predict future demand to plan manufacturing output. This allowed our customer to meet demand and avoid overproduction. The development process began with the collection and identification of the proper transaction data for demand forecasting. We gathered and evaluated date timestamps, transaction types, and location information to initiate the process. The import process in Amazon Forecast validates the datasets and offers easy access and management of datasets.

TensorIoT’s Amazon Forecast Workflow

We then had to determine which features were relevant and needed to be incorporated in the forecast model. Using a combination of statistical tools and domain expertise to highlight relevant features we determined the necessary components. Communicating with demand planners and testing features like product codes, or stock levels, to see what impact the data has on model performance is an iterative process. Having the ability to run and archive multiple configurations with different datasets managed through the console was convenient and simplified experimentation across different groups of features.

Along with combinations of related time series and item data, we evaluated forecast model hyperparameters. Different algorithms allow specific tuning of hyperparameters. Since the DeepAR+ algorithm was the optimal algorithm for our data, we tested hyperparameters including learning rate, number of epochs and number of cells. These are all easily configurable and up to three predictors can be tested in parallel. Testing different values of hyperparameters is essential to tuning and selecting the best models and resulted in considerable improvement in our forecast predictions. The hyperparameter optimization option (HPO) for DeepAR+ will automates the search of optimal hyperparameters. To find the best hyperparameters for your model, to focus on the algorithms best suited for your dataset.

Hyperparameter Tuning and Optimization Options

Amazon Forecasts predictions include the id, forecast data, and three metrics P10, P50 and P90. P10 is the estimate at which 90 percent of the predicted values are above value. P50 is an estimate where 50 percent is the median value, and P90 is the estimate at which 90 percent of the predicted values are below value. The best models were evaluated by comparing the P50 point estimates of the predicted forecast to a back test window of actual historical values. Forecast error is measured by common metrics that calculate how close the forecast predictions are to actual historical values in a given test window. MAPE (mean average percent error ) and WAPE (WMAPE, weighted mean average percent error) are the most frequently used to gauge the performance of a forecast model. To calculate accuracy we are using 1-MAPE. The other metrics considered in the evaluation are the bias, or the arithmetic mean of the error, and the mean volatility which corresponds to standard deviation of the forecast.

In our comparison to the more traditional approaches to forecasting, Amazon Forecast deep learning algorithms consistently outperformed existing solutions by significant margins. The DeepAR+ algorithm is well-suited to finding optimal models for large, complex data sets using multiple features. These models are able to integrate multiple time series and metadata variables which would be very challenging with traditional forecast models. The algorithms available through Amazon Forecast are tailored to specific use cases based on the complexity, size, variance of the data or the desire to integrate other types of data with the target series, such as weather, locations or product groups. The AutoML option can automate the exploration of these algorithms by automatically running and evaluating the performance of each method to find the optimal approach.

Forecast Accuracy: Amazon Forecast vs Alternative Forecast tool

MAPE: 12.5

MAPE: 4.47

Amazon Forecast offers several advantages over other forecasting tools, from basic excel charts to enterprise-wide demand, collaborative demand-planning solutions. It provides a range of simple to sophisticated algorithms for experimentation and testing to find the framework that best aligns to your data. It makes the testing and experimentation scalable by facilitating the ingestion and management of data, and interfaces that allow for easily altering parameters. The Amazon Forecast engine offers the key functionality of effective forecast solutions: accurate forecast that integrate multiple feature types as target time series, related time series and items metadata, a flexible and scalable test environment and the capacity to integrate and deploy a forecast solution in a cloud-enabled, production pipeline. The AWS Forecast service is designed to be user-friendly and lightweight, easing implementation and deployment investments, making it one of the more attractive forecasting options in the market.

--

--