Published on

January 5, 2024

Machine Learning
eBook

Time Series Forecasting with Deep Learning and Attention

In this article, we explore how deep learning can be used for time series forecasting, a critical task for businesses and organizations of all sizes.
Jon Reilly
Co-Founder, Co-CEO, Akkio
Machine Learning

Time series forecasting is a critical task for businesses and organizations of all sizes. Predicting future events is essential for making informed decisions, and time series forecasting can provide crucial insights into trends and patterns that may otherwise be unavailable.

Due to its complexity, however, only 13% of companies are effective at forecasting. Further, 93% of sales leaders are unable to forecast revenue within 5 percent (even with just 2 weeks left in the quarter!). Traditionally, time series forecasting has been a domain tackled by experts using sophisticated mathematical models. More recently, machine learning, and in particular, deep learning, have emerged as powerful tools for time series forecasting. 

Machine learning is set to add over $15 trillion to the world economy by 2030, and time series forecasting is one of the most promising applications of AI.

In this article, we will explore how deep learning can be used for time series forecasting, and we will discuss some of the advantages that deep learning and attention offer in this domain. We’ll also look at how Akkio’s intuitive no-code interface makes implementing time-series forecasting models easy.

What Is Time Series Forecasting?

First, let’s take a look at what constitutes a time series. Simply put, a time series is a collection of data points recorded at successive points in time. The data can be anything from sales figures to stock prices to weather data. The key characteristic of a time series is that the data points are ordered in time.

One of the most common tasks in time series forecasting is predicting the future value of a given variable. This can be done by modeling the trend and patterns in the data and then using this model to predict future values. There are many different approaches to time series forecasting, but all of them rely on models that are built on historical data.

Time series forecasting can be used in predicting future customer attrition or cart abandonment, predicting demand and sale fluctuations, economic trends, and many other areas. On a bigger scale, time series forecasting is a crucial tool in managing the supply chain, understanding economic trends, and making better financial decisions.

In recent events, for instance, The Federal Reserve has raised interest rates wdue to inflationary concerns. To get a sense of where the economy is heading, analysts turn to time series data to understand if these trends are temporary or part of a larger pattern. By understanding historical data, we can make better predictions about the future.

In part due to time series forecasts, analysts have figured out that the inflation of 2021 and 2022 is not transitory but will most likely be a longer-term trend, which has allowed them to make better decisions about interest rates.

Why Do We Need Time Series Forecasting?

In today’s complex business environment, understanding how your company works at scale requires timely knowledge of key metrics across multiple departments and divisions. Businesses use these metrics to make informed decisions about their operations like inventory management, capital allocation, pricing strategies, and more. 

A good indication when you need time series forecasts is when you are trying to evaluate the success or failure of a process over time - for example when you want to know which customers have abandoned their shopping cart or whether sales from a specific media channel are meeting expectations.

You could then use this information to optimize your marketing campaigns, resource allocation, pricing policies, and more. 

Types of Forecasting: Statistical Techniques and Neural Networks

Time series forecasting can be divided into two categories: statistical techniques and neural network models. Let’s explore both of these in detail.

Statistical techniques for forecasting

Trend analysis is the most common type of time series forecasting. It involves identifying the trend in the data and using it to predict future events. The trend can be linear or nonlinear, and it can be determined using a variety of techniques, such as moving averages or exponential smoothing.

Regression analysis is another common type of time series forecasting. It involves using historical data to identify relationships between different variables. This information can then be used to predict future events.

Unlike AI-based approaches, which are often used for complex predictions, regression analysis is usually used for predictions that are relatively easy to make. For example, you might use regression analysis to predict how much a company’s revenue will increase next year.

ARIMA is a type of regression analysis that is used specifically for time series forecasting. It stands for AutoRegressive Integrated Moving Average, and it is a powerful tool for predicting future events. 

There are three components of ARIMA to pay attention to:

  • AutoRegression means there’s a dependent relationship between an observation and lagged observations.
  • Integrated means subtracting an observation from an observation at the previous time step to make the time series stationary.
  • Moving Average means applying the dependency between an observation and a residual error to lagged observations.

There are several variants of ARIMA models, such as random-walk and random-trend models, and exponential smoothing models, which are used for different purposes. For example, exponential smoothing is used when the data is non-stationary (has seasonality), while random walk ARIMA is used to correct for autocorrelation.

While each of these variants has its own strengths and weaknesses, all of them are very effective at predicting future events. In fact, ARIMA-based models are still used in recent research for applications like housing sales prediction, consumer goods sales prediction, stock price forecasting, and more.

A recent research study, for instance, used a form of ARIMA to forecast non-elective bed occupancy and admissions in the NHS. Forecasting bed occupancy and admissions is important in order to ensure that hospitals have the resources they need to meet demand. The study found that the ARIMA model was able to provide accurate predictions, even when there was a high level of uncertainty.

Another recent study used ARIMA to forecast charitable donations in Sweden before and after COVID. Charities need to be able to predict how much donations they will receive in order to budget appropriately.

Drawbacks of statistical techniques

Businesses have long used statistical forecasting to predict future sales, inventory needs, and other factors. This approach relies on historical data to identify patterns that can be used to predict future outcomes. While traditional statistical forecasting is still widely used, it's becoming increasingly clear that it has some major drawbacks relative to newer artificial intelligence methods.

One of the biggest problems with traditional statistical forecasting is that it's often difficult to account for changes in the environment or in customer preferences. For example, if a company changes its products or services, or if the overall economy changes, traditional forecasting methods may not be able to take these changes into account.

One highly-cited study with the bold title "forecasting for COVID-19 has failed" found that bad forecasting techniques to real-world harms, like draconian lockdowns that could have been avoided.

Beyond adapting to changes in the environment, traditional forecasting can also be insufficient when it comes to making use of large, diverse datasets. 

AI-based methods, such as machine learning and deep learning, often have an advantage over traditional statistical forecasting methods in that they are able to learn and adapt over time. This means that they can take into account changes in the environment and in customer preferences, which can lead to more accurate predictions. 

In addition, AI-based methods are typically able to process more data than traditional methods, which can lead to even more accurate predictions.

Neural networks for forecasting

Deep learning neural networks are a powerful tool for forecasting time series data. Recent advances in the area have shown that these networks can outperform traditional methods, such as regression, when it comes to predicting future values.

Neural networks are a broad category, and include specific approaches like recurrent neural networks, long short-term memory networks, convolutional neural networks (CNNs), feedforward neural networks, and a variety of other learning methods.

There are many different applications for deep learning for forecasting. One of the most common is weather forecasting. Weather data is extremely complex, and traditional forecasting methods often produce inaccurate results. Deep learning has been shown to be more effective than traditional methods at predicting weather patterns.

Another area where deep learning algorithms are being used for forecasting is financial markets. Traditionally, financial analysts have used human intuition and experience to make decisions about where to invest money. However, deep learning is now being used to create models that can predict stock prices and other financial indicators with greater accuracy than humans can.

There are also a number of applications for deep learning in the medical field. For example, deep learning has been shown to be effective at predicting patient outcomes. This can be used to help healthcare professionals make decisions about the best treatment plan for a patient. Deep learning can also be used to predict the likelihood of a patient developing a particular disease.

Demand forecasting problems are yet another popular use-case, which lets businesses predict how much product they will need to order and when in order to meet customer demand. This is often done using historical sales data.

However, one limitation of the current approach is that it cannot sufficiently handle large amounts of input information. To address this issue, researchers developed a new approach called attention. 

Attention allows a deep learning model, or any other kind of neural network, to access information in so-called “hidden states.” This method outperforms conventional models, and paved the way for Transformers, which underlie state-of-the-art language models.

Attention has been shown to be particularly effective for time series forecasting tasks. Besides overall performance improvements compared to models like RNNs and LSTMs, they bring an added benefit of interpretability through attention heat maps.

Overall, attention provides a valuable tool for more accurate and interpretable deep neural networks. This can help you to debug and troubleshoot time series models, make models faster, and improve their accuracy.

Given the drawbacks of traditional methods, attention provides a much needed improvement for time series modeling. Not only does it offer better performance, but it is also more interpretable, making it easier to understand why the model is making certain predictions.

Neural network forecasting methods

Neural networks are a powerful tool for forecasting. They can be used for both linear and non-linear forecasting problems, making them a versatile tool for many applications.

Multilayer feed-forward networks (MLPs) are one type of neural network that can be used for forecasting. MLPs are fully connected networks, meaning each neuron in one layer is connected to every neuron in the next layer. This type of architecture allows MLPs to model complex relationships between input and output variables.

Convolutional neural networks (CNNs) are another type of neural network that can be used for forecasting. CNNs are similar to MLPs, but they have an additional layer: the convolutional layer. This layer is responsible for extracting features from the data. CNNs are often used for image recognition tasks, but they can also be applied to time series data.

Long short-term memory (LSTM) networks are a type of recurrent neural network (RNN). RNNs are designed to model sequential data, making them well suited for time series analysis. LSTMs are a specialized type of RNN that can learn long-term dependencies, making them especially well suited for forecasting applications.

How Can You Implement Time-Series Forecasting Techniques?

From the statistical techniques we discussed to deep learning and attention, all of these methods require code and technical expertise with tools like TensorFlow, Keras, Python Pandas, and Numpy, which often means hiring data scientists.

This is because you would need to handle tasks like feature engineering, model optimization, gradient descent, and an iterative, sequential approach to model creation and deployment, all manually and after setting up data pipelines.

However, there are ways to automatically implement these methods without any coding required.

This is made possible by using a no-code AI platform. These platforms allow you to build and deploy machine learning models without any coding. You simply need to input your data and specify what type of model you want to build. The platform will then take care of the rest, including training the model and deploying it.

One such platform is Akkio. Akkio is a tool that makes leveraging machine learning for marketing and business functions incredibly easy. Akkio offers an intuitive interface that allows users with no technical knowledge or background in data science to implement powerful predictive models without any code or previous experience required. 

Further, Akkio handles the heavy lifting in the background, from managing compute to training data preprocessing and validation. Simply connect your time series dataset, and Akkio will automatically test out a range of time series forecasting methods and hyperparameters. From there, you can deploy your model anywhere. 

Users can train custom models on their own data sets with no prior expertise in machine learning required; they can then deploy those models into different applications like:

  • Use predictions to estimate revenue growth by country, total number of sales per month by salesperson etc; predict churn rates; determine optimal prices; forecast costs 
  • Forecast the future - generate predictions about future events based on historical data - predict PPY (price per year), revenue forecast 
  • Build better products by using real-time customer behavior generated from mobile apps or web applications

Let's explore some of these applications in more depth.

1. Estimating Revenue Growth

Revenue growth is essential for any business to scale and be successful. By using machine learning to predict revenue, businesses can make more informed decisions about where to invest their resources. For example, a retail business could use predictions to estimate revenue growth by country. This would enable the business to focus its resources on areas that are most likely to generate sales and improve profitability. Alternatively, a company could use predictions to determine the total number of sales per month by salesperson. This information could be used to set targets and commission structures accordingly.

2. Predicting Churn Rates

Churn rates are a measure of how many customers are leaving a service or product during a given period of time. They are an important metric for businesses to track as they can indicate whether a company is losing or gaining customers. Machine learning can be used to predict churn rates by analyzing customer data such as purchase history, interactions with customer service, and demographic information. This information can then be used to develop strategies for retaining customers and reducing churn.

3. Determining Optimal Prices

Pricing is a critical aspect of any business, and getting it right can be the difference between success and failure. Machine learning can be used to determine optimal prices for products or services by analyzing customer data such as purchasing habits, price sensitivity, and demographic information. This information can then be used to develop pricing strategies that maximize profits and minimize losses.

4. Forecasting Costs

Cost forecasting is a vital part of financial planning for businesses. It can be used to estimate future expenses and develop budgeting strategies. Machine learning can be used to forecast costs by analyzing past data such as invoices, purchase orders, and financial reports. This information can then be used to develop plans for reducing costs and improving profitability.

A Hands-On Forecasting Walk-Through

To get started, simply upload your data to the Akkio platform. You can connect a Google Sheets link, Excel file, CSV, or even directly connect to tools like Snowflake, Salesforce, or Hubspot.

Once your data is uploaded, simply select the date column and the prediction column. Akkio's AI will automatically identify the best machine learning models to use for forecasting. No data science expertise or coding is required.

One of the benefits of using Akkio's AI for sales forecasting is that it can account for the impact of seasonality and trends on your data. For example, if you sell Christmas ornaments, you would expect a surge in sales in December, but only in certain markets, and perhaps less amidst an economic downturn. Akkio's AI can identify this trend and predict sales for specific SKUs accordingly.

Additionally, Akkio's AI can identify patterns in your data that you may not have been aware of. For example, if you sell products online, you may notice a trend in which sales are higher on weekdays than weekends. Akkio's AI can identify this trend and use it to improve your sales forecasting.

Once the model has been built, which takes as little as a few seconds, you can view the predictions for any future date. You can also deploy the model in a variety of settings, such as back in Salesforce, to automate predictions and help you make better decisions. With Zapier, you can deploy predictions in thousands of applications without any code.

More technically-inclined users can use the Akkio API to build custom predictions or integrations.

Conclusion

Akkio's no-code AI offers a fast, easy, and accurate way to forecast future events. It can handle large data sets and quickly identify patterns to predict outcomes. Additionally, it is very user-friendly, making it easy for anyone to use.

Once a model has been built, it can be deployed in minutes to a production environment and updated as needed. Akkio's no-code AI is the perfect tool for time series analysis.

Many other AI tools take weeks to set-up and months to learn. Akkio's ease of use and fast deployment makes it the perfect tool for forecasting. Try a free trial today to see how it can benefit your business, or check out our tutorials page.

By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.