Unveiling the future: Empowering Predictions with Snowflake Cortex ML Time Series Forecasting

Introduction:

 With Snowflake Cortex, Snowflake users now have access to a set of functions that easily accelerate everyday analytics and AI app development. In this blog, we have explored the usage of machine learning functions using snowflake cortex from within the snowflake environment. Snowflake Cortex’s time series model trains on historical time series data and forecasts that time series into the future with automated handling of seasonality, scaling and more.

Objective:

The objective of this blog is to delve into customer service ticket forecasting using machine learning techniques using Snowflake Cortex’s forecasting model. Ticket forecasting aids in proactive resource allocation, enhances service efficiency, and ensures optimal customer satisfaction by anticipating support demands accurately.

The use case:

Leveraging Snowflake Cortex ML’s forecasting capability, this visualization provides predictive insights into future ticket volumes based on historical data, enabling organizations to proactively allocate resources and optimize support operations. The time series prediction interval defines an estimated span of values, bounded by an upper and lower limit, within which the data would fall.

Data:

The data utilized comprises synthesized set of record of tickets logged through Feb 2024. Below is a sample screenshot illustrating the data structure. A more exhaustive dataset can be used for precise forecasts, but as the goal of this blog is to focus on the functionality and implementation of the forecasting model, we leveraged just a month’s worth of synthesized data.

High level Summary:

We begin by establishing a database and schema tailored to our specific data needs. Subsequently, we introduce a stage layer to facilitate the initial staging of our data before it progresses to the designated table. Utilizing the inherent capabilities of Cortex, we proceed to create and store forecasting models directly derived from the data housed within the table. This holistic approach ensures the smooth flow of data and seamless integration and visualization of forecasting insights.

We are following a three step process to achieve this functionality as show below.

Steps:

Step 1: Setting up Data:

  • A sample ticket data is used to implement ML forecast. Corresponding database and scheme are created in Snowflake.
  • A stage layer is created in the name tk_int_stg and the data in the csv file from local is uploaded in that layer.
  • Created a new table named ticket forecast in line with the number of columns and their respective data types in the stage layer.
  • Finally,  we use copy into command to insert data into table from stage.

Step 2: Create a forecast function 

  • A view is created on top of the Ticket Forecast table and the date column is converted into timestamp and stored.to perform a univariate forecasting of ticket with respect to the date of tickets.
  • Finally, a forecast model named ticket_forecast is built using the snowflake.ml.forecast package on top of the view we just created.

Note:

Both the create <forecast> and call <forecast> commands in snowflake are functionalities of Snowflake Cortex. A timestamp column is mandatory to forecast a variable in the data.

Step 3: Forecasting the Data:

  • Now the model is ready and can be leveraged to forecast ticket volumes for future periods.
  • We will perform forecasting for the next 14 periods (which in our case is days).

The results are shown below.

  • The visual of the forecast is created by leveraging Streamlit with python.
  • The representation contains values with lower and upper bound ranges, to provide the potential span.

Conclusion:

Snowflake Cortex empowers every Snowflake user with cutting-edge ML and LLM models through user-friendly interfaces and serverless functions. It transforms time series forecasting into a robust yet accessible and user-friendly process with intuitive visuals. Users can thereby effortlessly harness the power of advanced analytics to derive more value from their enterprise data. This innovative approach eliminates the need for specialized AI expertise or the hassle of managing a complex infrastructure.  In use cases such as ticket forecasting, such approach helps with optimizing resource allocation, enhancing customer satisfaction, and driving continuous improvement, ultimately achieving greater operational efficiency and competitive advantage in today’s fast-paced business environment.

Please feel free to reach out to us to discuss how we can address your needs in the AI/ML space. We offer customized solutions designed to effectively meet your specific requirements.



Leave a Reply