EXPLANATION FOR TIME SERIES FORECASTING MODELS

A method, system, and computer program product for explaining predictions made by black box time series models. The method may include identifying a black box time series model. The method may also include predicting one or more time instances using the black box time series model. The method may also include selecting a predicted time instance from the predicted data. The method may also include receiving training data for the black box time series model. The method may also include generating a set of white box time series models similar to the black box time series model. The method may also include selecting a preferred white box time series model. The method may also include analyzing behavior of the preferred white box time series model. The method may also include generating an explanation illustrating why the black box time series model forecasted the predicted time instance.

BACKGROUND

The present disclosure relates to time series models and, more specifically, to using training data and similar white box time series models to explain predictions made by black box time series models.

When predicting using machine learning technology, time may not be considered or may only be minimally considered during the prediction. For instance, the past data may be considered at an equal weight and the predictions made may simply be for some future date. However, in some instances, times that the past data occurred and times that the model is forecasting for may be considered. Therefore, there may be a time component to the prediction. The data, when time is a component, may be represented in a time series. A time series may include data that is listed, graphed, displayed, etc. in time order. Time series forecasting may use the time series and a machine learning model and predict future data for the time series.

SUMMARY

The present invention provides a computer-implemented method, system, and computer program product to use training data and similar white box time series models to explain predictions made by black box time series models. The method may include identifying a black box time series model. The method may also include predicting one or more time instances using the black box time series model, resulting in predicted data. The method may also include selecting a predicted time instance from the predicted data. The method may also include receiving training data for the black box time series model. The method may also include generating a set of white box time series models similar to the black box time series model. The method may also include selecting a preferred white box time series model from the set of white box time series models based on a difference between each white box time series model and the black box time series model. The method may also include analyzing behavior of the preferred white box time series model. The method may also include generating, based on the analyzing and the training data, an explanation illustrating why the black box time series model forecasted the predicted time instance. The system and computer program product may include similar steps.

DETAILED DESCRIPTION

Aspects of the present disclosure relate to time series models and, more specifically, to using training data and similar white box time series models to explain predictions made by black box time series models. While the present disclosure is not necessarily limited to such applications, various aspects of the disclosure may be appreciated through a discussion of various examples using this context.

Time series forecasting may use machine learning models to predict, or forecast, future data in the time series. Because time is a specific component that is being considered, time series forecasting models may be more complex (due to the additional time factor) than conventional machine learning models, but may also be more accurate.

In some instances, time series forecasting models may be black box models. Black box models are models in which the internal workings are unclear and/or inaccessible. For example, a neural network may be a black box model as the internal workings may be unclear and hard to understand. Other examples of black box models may include gradient boosting models, proprietary models, complex models, etc. In some instances, only the inputs and outputs of a black box model (e.g., a black box time series forecasting model) may be visible and/or accessible. However, it may be unclear how and/or why the model forecasted the data it did. When there is no explanation for the forecasting model (for example, because it is a black box model), there may be no way, or at least it may be difficult, to fix any errors in the forecasting model. Existing conventional methods, such as time series explanability, only address and are only applicable to time series classification (i.e., classifying multiple time series into a class or classes).

The present invention provides a computer-implemented method, system, and computer program product to use training data and similar white box time series models to explain predictions made by black box time series models. Determining an explanation for the predictions made by the black box time series model may increase debugging capabilities of the model. For instance, the explanations may be used to determine incorrect predictions and find parameters, training data, etc. that may be responsible for incorrect predictions by the black box model. Additionally, determining an explanation for the predictions may increase trust in the model because there may be accessible explanation and analysis of why the model is predicting/forecasting the points that it is.

In some instances, an explanation for a specific data point forecasted by the black box time series model may be determined. The forecasted point, the overall forecasted data (for example, a set of forecasted points) predicted by the black box time series model, and the original time series data and training data that were used to create and train the black box time series model may all be used to build and train white box time series models similar to the black box time series model. In some embodiments, the white box time series models are created on the time instances in the training data of the black box time series model and using the predictions of the black box time series model. In some instances, the black box time series model may not strictly follow the values from the training data, therefore the black box time series model predictions may be used to create the white box time series models in order to more accurately imitate the black box time series model. Once the white box time series models are created, they may be compared to the black box time series model to determine how similar each model is to the black box time series model. In some instances, each white box time series model may be compared to the black box time series model at the specific forecasted data point (that the explanation may be determined for) and as a whole. A white box time series model may be selected from the set of white box time series models as the preferred white box time series model. The preferred white box time series model and the time series data (for the black box time series model) may be used to generate an explanation for the specific forecasted data point (referred to herein as a predicted time instance). In some instances, the explanation may include trends and seasonality of the data forecasted by the black box time series model. Additionally, in some instances, the explanation may include data points from the black box time series model that were determined to be important to the forecasting of the predicted time instance.

Referring now toFIG. 1, a flowchart illustrating a method100for explaining predictions made by black box time series models is depicted, according to some embodiments. In some embodiments, method100is executed by a server (e.g., computer system/server602(FIG. 6)) on or connected to a computer system (e.g., computer system600(FIG. 6)). In some embodiments, the method100is implemented as a computer script or computer program (e.g., computer executable code) to be executed on or connected to the computer system. In some embodiments, the method100is executed by a processor (e.g., processor205(FIG. 2) and/or processing unit610(FIG. 6)) on or connected to a computer system (e.g., computer system600(FIG. 6)).

Method100includes operation110to identify a time series model. As discussed herein, a time series may include data that is listed, graphed, displayed, etc. in chronological order. A time series model may be a model (e.g., an algorithm or series of algorithms) that fits the time series, in some instances. In some embodiments, the time series model is a machine learning time series model. In some embodiments, the time series model is a forecasting model. In some embodiments, the time series model is a univariate time series model.

Method100includes operation120to determine whether the model is a black box model. A black box model may be a model with unclear and/or inaccessible internal workings. For instance, it may be difficult or even impossible to determine why a black box model generated a certain output or made a particular conclusion based on a set of data. In some embodiments, determining whether the model is a black box model includes attempting to analyze or interpret the model. If the time series model can be interpreted and analyzed (for example, if the internal workings and information for the time series model are accessible), the time series model may be a white box model and may not be a black box model. If the time series model cannot be interpreted and/or analyzed (for example, if the internal workings and information for the time series model are not accessible), the time series model may be a black box model. If the time series model is a black box model (meaning that it cannot be interpreted and/or analyzed), it may be unknown why the black box model predicted the data that it did. Therefore, an explanation may need to be generated in order to explain and/or illustrate the prediction(s) made by the black box model (for example, explaining a specific data point that was predicted by the black box time series model). In some embodiments, the explanation may include seasonality and/or other trends of the time series data. In some embodiments, the explanation may include residual and/or other errors of the black box time series model compared to the actual time series data. Seasonality, trends, errors, etc. may help demonstrate why the black box time series model predicted the certain data point(s) (i.e., predicted time instance(s)).

In some embodiments, if it is determined, in operation120, that the model is not a black box model, method100may end. If it is determined that the model is a black box model (in operation120), then a black box time series model may be identified, and method100may proceed to operation130.

Method100includes operation130to predict time instances using the black box time series model. In some embodiments, the black box time series model is a prediction model (for example, a machine learning prediction model). Therefore, in some embodiments, the black box time series model may be created to, or at least have the capability to, forecast or predict future time series data. For example, the black box time series model may predict airplane ticket sales and the future times those airplane ticket sales may occur. In some embodiments, the black box time series model uses time series data to train the model and the trained model then forecasts future time instances at which an event (for example, the ticket sales) may occur. In some instances, the one or more time instances predicted using the black box time series model may be referred to herein as predicted data.

Method100includes operation140to select a predicted time instance from the predicted data for explanation. As discussed herein, the black box time series model (for example, after being trained using time series training data) may predict future time instances. However, due to the black box nature of the time series model, it may be difficult to, or there may be no way to, determine why the black box time series model forecasted the future time instances (or, “predicted data”) it did. Therefore, in some instances, a specific time instance from the predicted data may be selected for explanation. For example, the predicted data may show an average household income from January 2022 through January 2023. There may be multiple forecasted time instances between January 2022 and January 2023. In this example, a specific forecasted data point of $70,000 in June 2022 may be selected for explanation. Therefore, the system may generate an explanation of why the black box time series model determined that the average household income would be $70,000 in June 2022. In this example, $70,000 in June 2022 is the specific time instance.

In some embodiments, a user selects the specific predicted time instance for explanation. In some embodiments, the specific predicted time instance may be automatically selected by the computer system. For example, the system may select a most recent predicted time instance for explanation. In some embodiments, a plurality of predicted time instances may be selected for explanation. For example, there may be multiple predicted time instances that a user, or the system, may want explanation for.

Method100includes operation150to receive training data for the black box time series model. The training data may be the actual data used to train the black box time series model. As discussed herein, the black box time series model may use training data (for example, time series data) to build and train the black box time series model. In some instances, the training data may include a set of time series data from the past and/or present (i.e., not the future) that was used to build and train the black box time series model. Put differently, the training data may include actual time series data (i.e., not predicted time series data), in some instances. In some embodiments, the black box time series model may be built and trained on a computer system connected to the system executing method100. In such embodiments, receiving the training data for the black box time series model may include receiving time series training data from the computer system that built and trained the black box time series model. In some embodiments, the black box time series model may be built and trained on the computer system executing method100. In such embodiments, receiving the training data for the black box time series model may include accessing and/or requesting the training data (i.e., time series data) from a server and/or memory of the computer system.

Method100includes operation160to generate a set of white box time series models that are similar to the black box time series model. Generating the set of white box time series models may include generating a plurality of different white box time series models. In some embodiments, each white box time series model in the set of white box time series models is a different type of model.

Although the black box time series model may have unclear and/or inaccessible inner workings, there may be other time series models that have clear and/or accessible inner workings. For example, the white box time series models may be linear models with formulas and/or calculations that may be easily accessible. In some instances, white box time series models may include one or more classes of models. The one or more classes may be selected from autoregressive (AR) models, moving average (MA) models, and integrated (I) models. AR, MA, and I models may all be linear models. In some embodiments, the white box time series models may include combinations of multiple classes (or types) of models. For example, the white box time series models may include auto regressive moving average (ARMA) models and/or auto regressive integrating moving average (ARIMA) models. In some embodiments, the white box time series models may include other time series models such as a Holt-Winters forecasting model. Therefore, in some embodiments, the various types of white box time series models may include AR (auto regressive) models, MA (moving average) models, ARMA (auto regressive moving average) models, ARIMA (auto regressive integrating moving average) models, and/or Holt-Winters models.

In some embodiments, a plurality of types of white box time series models (for example, two or more different types of white box time series models) may make up the set of white box time series models. For example, the set of white box time series models may include an AR, MA, and Holt-Winters model. In another example, the set of white box time series models may include ARMA and ARIMA models. In some embodiments, the set of white box time series models may include an AR model, MA model, ARMA model, ARIMA model, and Holt-Winters model.

In some embodiments, the types of white box time series models that make up the set of white box time series models may be predetermined. For example, the system may have a predetermined group of white box time series models that may be used as the set of white box time series models. In some embodiments, the system may automatically select the plurality of types of time series models as the set of white box time series models. In some embodiments, a user may select the types of time series models for the set of white box time series models. For example, a user may be presented with a list of time series models (e.g., AR, MA, ARMA, ARIMA, and Holt-Winters) and the user may select multiple models from the list of time series models as the set of white box time series models. The list of time series models may include linear models, in some instances, as the linear models may have accessible inner workings and may be white box time series models.

In some embodiments, generating the set of white box time series models includes generating a set of model parameters for each of a plurality of types of white box time series models. This may result in a plurality of initial white box time series models. In some instances, the plurality of types of white box time series models includes AR, MA, ARMA, ARIMA, and/or Holt-Winters types of time series models. An AR model may have a single parameter “p.” “P” may represent a number of lags that are used as predictors or the order of the autoregressive model. Therefore, for an AR model, generating the set of model parameters may include generating the “p” parameter. In an MA model, there may be a parameter “q” that represents a number of lagged forecast errors (or, put differently, the number of autoregressive (AR) terms). For an MA model, generating the set of model parameters may include generating the “q” parameter.

An ARMA model may include a combination of the AR model and the MA model, and thus may include both the “p” and “q” parameters. For an ARMA model, generating the set of model parameters may include generating the “p” and “q” parameters. An ARIMA model may include the AR model, the MA model, and the I (integrated) model and may include both the “p” and “q” parameters, as well as a parameter “d” that represents a number of nonseasonal differences needed for stationarity or stationarization. Therefore, for an ARIMA model, generating the set of model parameters may include generating the “p,” “q,” and “d” parameters. For a Holt-Winters model, the parameters may include an “α” (representing smoothing), “β” (representing the length of a season), and “γ” (representing a number of periods in a season). Therefore, for a Holt-Winters model, generating the set of model parameters may include generating the “α,” “β,” and “γ” parameters.

In some embodiments, depending on which types of white box time series models are used for the plurality of initial white box time series models (e.g., the plurality of types of white box time series models with their specific parameters), stationarization methods may be applied to the training data before the model is trained. A stationary time series model and stationary training data may not depend on the different times the time series was observed and may have constant properties (e.g., mean, variance, etc.). In time series, there may be trends such as seasonality that indicate that a time or season that the data was taken may affect the value of the time series. For example, if a time series depicted the average temperature over the course of a year, the average predicted temperature may change depending on the month. For example, months such as December, January, and February may have cold average temperatures, whereas months such as June, July, and August may have warm average temperatures. These trends may be seasonality trends, as the value of the time series (in this example, the average temperature) is affected by which month the data was taken from. Therefore, certain time series datasets may need to be stationarized to become stationary before they are trained, in order to accurately train the model.

In some instances, because the white box time series models (e.g., AR, MA, ARMA, etc.) may be linear models, they may be stationary time series models. However, in some instances, the time series data that will be used to train the model(s) may not initially be stationary. Therefore, before training the model, the training data (e.g., time series data) may need to become stationary to remove dependence on the times the data was observed. For example, models like the AR, MA, and ARMA models may not have stationarization built into the model. Therefore, stationarization methods may be applied to the training data in order to create a stationary time series.

In some embodiments, stationarization methods include at least seasonal differencing. Differencing may be a data transform technique used to convert non-stationary time series data into stationary time series data. In some instances, seasonality may be a common trend that occurs in time series data. Therefore, to stationarize a time series dataset, seasonal differencing may be applied to the data to remove seasonality from the time series.

In some embodiments, certain white box time series models may have stationarization methods built into the model and a separate stationarization step may not be needed. For instance, the integrated (I) portion of the ARIMA model may include a preprocessing procedure that stationarizes the time series model (if needed). Therefore, and ARIMA model may include stationarization within the model itself and may not need additional stationarization methods applied to the model.

In some embodiments, generating the set of white box time series models includes training each of the initial white box time series models using the training data and the set of model parameters. This may result in a plurality of trained white box time series models. After the initial set of white box time series models are determined (for example, by identifying and establishing the various parameters for each white box time series model), the training data used to train the black box time series model (for example, the training data received in operation150) may also be used to train each of the initial white box time series models. In some embodiments, as discussed herein, the training data may be stationarized before being used to train the white box time series models. In some embodiments, stationarization of the training data may be included in the training process. In some embodiments, the initial white box time series models may be trained using conventional training methods. In some embodiments, each of the initial white box time series models (e.g., AR, MA, ARMA, ARIMA, and/or Holt-Winters models) may be trained separately. In some embodiments, one or more of the initial white box time series models may be trained simultaneously.

In some instances, it may be determined whether any models from the plurality of trained white box time series models did not complete training successfully. For instance, the model may not have properly learned from the training data. In some embodiments, determining whether any models did not complete training successfully includes determining whether any models (from the plurality of trained white box time series models) include non-stationary coefficients. As discussed herein, in order to properly fit and train the white box time series models (for example, linear time series models), the time series data may need to be stationary. However, oftentimes time series data is not stationary and may have various trends and/or seasonality. In some embodiments, if the time series data is not properly stationarized then the white box time series model(s) may not be trained successfully.

As discussed herein, certain white box time series models may include stationarization as a part of their model and other white box time series models may not include stationarization, and the training data may be stationarized prior to training the model. Therefore, instances where the training data may not have been successfully stationarized prior to training the white box time series models may result in one or more of the models that do not include stationarization having coefficients that are non-stationary and thus having unsuccessful training. However, in these embodiments, the white box time series models including stationarization may have successful training and stationary coefficients, as these models may not need stationary training data.

In some embodiments, one or more issues may have occurred while training one or more models that include stationarization (for example, ARIMA models). This may result in a white box time series model (e.g., an ARIMA model) without properly stationarized coefficients.

If there are models that did not complete training successfully, those models may be removed from the plurality of white box time series models. For instance, the white box time series models may be stationary models. Therefore, white box time series model(s) with non-stationary coefficients may be completely inaccurate and full of errors. These models may be removed from the set of white box time series models to prevent issues and increase accuracies of any explanations generated based on the white box time series models. The remaining white box time series models that were trained successfully may be referred to as a reduced plurality of trained white box time series models.

In some embodiments, generating the set of white box time series models includes identifying an overall forecast time period of the black box time series model. The overall forecast time period may be the complete time period that the black box time series model forecasted data for. For example, a black box time series model may predict the average household income for January 2022, February 2022, March 2022, April 2022, May 2022, June 2022, July 2022, August 2022, September 2022, October 2022, November 2022, December 2022, and January 2023. In this example, the specific time instance may be a household income of $70,000 in June 2022. The overall forecast time period, in this example, may be from January 2022 to January 2023, as that is the overall time period that the black box model forecasted data through. In some embodiments, if the black box time series model forecasted data over a certain time period (the overall forecast time period), each white box time series model (from the reduced plurality of trained white box time series models) may also forecast data over the same overall forecast time period. For example, the white box time series models would also forecast average household incomes from January 2022 to January 2023. This may help determine how each white box time series model performs over the whole overall forecast time period (compared to the black box time series model). In some instances, each time series model (for example, black box and/or white box) may be depicted as a visualization (for example, a graph).

In some embodiments, generating the set of white box time series models includes generating output visualizations for each white box time series model. The output visualizations may help depict the similarities and differences between each model and may help identify the preferred white box time series model, in some instances. The output visualizations may range at least the overall forecast time period for each white box time series model (from the plurality of trained white box time series models). For instance, a graph (such as a line graph) may be generated for each white box time series model. For example,FIG. 4depicts visualizations (in this example, line graphs) for each white box time series model in the set of white box time series models. Each visualization may be depicted on a same graph, in some instances.

In some embodiments, when some models are not trained successfully and are removed from the plurality of trained white box time series models (resulting in the reduced plurality of trained white box time series models), the output visualizations may be generated for each white box time series model from the reduced plurality of trained white box time series models. Put differently, output visualizations may not be generated for any of the white box time series models that were not trained successfully.

Method100includes operation170to select a preferred white box time series model from the set of white box time series models. In some embodiments, selecting a preferred white box time series model includes comparing each white box time series model to the black box time series model. Comparing the white box time series model(s) to the black box time series model may include determining the similarities and differences between each white box time series model and the black box time series model. In some embodiments, comparing the white box time series model may include comparing the overall white box time series model (for example, each predicted time instance of the white box time series model) to the overall black box time series model (for example, each predicted time instance of the black box time series model) and then comparing the predicted data point at the specific time instance for the white box time series model to the specific time instance of the black box time series model. Therefore, in some embodiments, the selecting may be based on at least each white box time series model as a whole and each white box time series model at the predicted time instance. Put differently, when selecting a preferred white box time series model, each white box time series model may be compared to the black box time series model at the specific time instance that an explanation will be generated for. In addition, each white box time series model may be compared to the black box time series model as a whole.

For example, using the set of time series models410depicted inFIG. 4, the predicted time instance may be at time March 2019. In this example, the black box time series model430(FIG. 4) may have predicted that there is $3 Million of in-game currency spent per day in March of 2019. When looking at the plurality of white box time series models, both white box time series model420and440appear to be closest to black box time series model430at the specific time instance of March 2019. However, in this example, white box time series model440appears to be different from black box time series model430everywhere but times through November 2018 and at March 2019. White box time series model420appears to be more similar to black box time series model430when looking at the model both at the specific March 2019 time instance and as a whole. White box model450appears to be different from the black box time series model430everywhere except for January 2019.

In an example where January 2019 is the predicted time instance, white box time series model450may appear to be the preferred white box time series model at the specific time instance. However, when comparing model450to the black box time series model430as a whole, white box time series model450is only similar to black box time series model430at the January 2019 point and is different from black box time series model430everywhere else. Therefore, in this example, even though white box time series model450is the most similar to black box time series model430at the specific time instance of January 2019, white box time series model450may not be the preferred time series model due to its differences from black box time series model430as a whole.

In some embodiments, selecting the preferred white box time series model includes determining a time instance prediction error for each white box time series model (from the set of white box time series models) for the predicted time instance. The time instance prediction error may be the error at the specific predicted time instance. For example, the time instance prediction error may be how far off the white box time series model is from the black box time series model (e.g., the difference between the white box model and the black box model) at the specific time instance. For example, looking again atFIG. 4, white box time series models420and440may both have a low time instance prediction error at the time instance March 2019 and white box time series model450may have a higher time instance prediction error.

In some embodiments, selecting the preferred white box time series model includes determining a global prediction error for each white box time series model based on the black box time series model. The global prediction error may be the overall error of each white box time series model over the overall forecast time period. In some embodiments, finding the global prediction error may include finding the error at each forecasted data point, and then averaging the errors to determine the overall error. For example, if a white box time series model predicted five forecasted data point, and the error at each point was 0.05, 0.2, 0.1, 0.12, and 0.08, the global prediction error for the white box time series model may be 0.11.

In some embodiments, selecting the preferred white box time series model includes analyzing the time instance prediction error and the global prediction error for each white box time series model. Analyzing the time instance prediction error and the global prediction error may include comparing the errors for each model and/or identifying any trends in the errors. For example, one white box time series model may have a lowest time instance prediction error and a lowest global prediction error. In such instances, the white box time series model with both a lowest time instance prediction error and global prediction error may be selected as the preferred white box time series model.

In some instances, analyzing the time instance prediction error and the global prediction error may include weighting the time instance prediction error and the global prediction error and determining an overall weighted error for each white box time series model. As discussed herein, there may be instances where a white box time series model may have a low (or lowest) time instance prediction error but a higher global prediction error, or vice versa. In such instances, even if a white box time series model was accurate in predicting a specific time instance, if the model was not accurate in predicting any other time instances, the explanation or reasoning that the white box time series model may have for predicting the specific time instance may not be the same explanation the black box time series model had for predicting the same/similar specific time instance. Therefore, in some embodiments, weighting the errors and determining an overall weighted error for each white box time series model may help balance the two errors and prevent a white box time series model from being selected if it was only accurate at the specific time instance (or if it was not at all accurate at the specific time instance).

For example, the set of white box time series models may include three different models, an AR model, MA model, and ARIMA model. In this example, the AR model may have a time instance prediction error of 0.05 and a global prediction error of 0.22. The MA model may have a time instance prediction error of 0.15 and a global prediction error of 0.20. The ARIMA model may have a time instance prediction error of 0.11 and a global prediction error of 0.21. In this example, each global prediction error (0.22, 0.20, and 0.21) is relatively similar. Therefore, in this example, the time instance prediction error may be weighted higher than the global prediction error. In this example, the time instance prediction error may have a weight of 5, where the global prediction error may have a weight of 1. Therefore, the overall prediction error, in this example, for the AR model is 0.47, for the MA model is 0.95, and for the ARIMA model is 0.76. In this example, the AR model has the lowest overall weighted error, even though it has the highest global prediction error.

In another example, the set of white box time series models may include a Holt-Winters model, an ARIMA model, and an ARMA model. The Holt-Winters model may have a time instance prediction error of 0.2 and a global prediction error of 0.2. The ARIMA model may have a time instance prediction error of 0.25 and a global prediction error of 0.1. The ARMA model may have a time instance prediction error of 0.1 and a global prediction error of 0.25. In this example, the time instance prediction error may have a weight of 3 (for example, because the explanation may be generated for the specific time instance) and the global prediction error may have a weight of 2. Therefore, the overall prediction error for the Holt-Winters model may be 1, for the ARIMA model may be 0.95, and the ARMA model may be 0.8. In this example, although the Holt-Winters model may have never had the highest error, the ARMA model may have the lowest overall weighted error due to its low time instance prediction error.

In some embodiments, selecting the preferred white box time series model includes identifying, based on the analyzing, the white box time series model with a minor error. In some embodiments, the minor error may be the lowest overall error. If a white box time series model has both the lowest overall error and the lowest global prediction error, it may have the lowest overall error and may be selected as the preferred white box time series model. In some instances, the overall error may be the total error. For example, using the above Holt-Winters, ARIMA, and ARMA example, the Holt-Winters model may have an overall error of 0.4, the ARIMA model may have an overall error of 0.35, and the ARMA model may have an overall error of 0.35. In some instances, such as this example, more than one model may have the same overall error. Therefore, in some embodiments, the errors may be weighted and an overall weighted error may be used. Thus, in some instances, the white box time series model with a minor error may be the white box time series model with a lowest overall weighted error. Again, using the above Holt-Winters, ARIMA, and ARMA example, the ARMA model may be selected as the preferred white box time series model, as it has the lowest overall weighted error.

Method100includes operation180to generate an explanation for the predicted time instance. An explanation may include reasonings and/or observances that may have contributed to the predicted time instance. For example, there may be notable trends, seasonalities, residuals, and/or errors of the time series data that may have resulted in the predicted time instance. In some embodiments, the generated explanation is based on the preferred white box time series model, the training data, and the black box time series model.

In some embodiments, generating the explanation for the black box time series model may include analyzing behavior of the preferred white box time series model. For instance, the seasonal differencing and/or stationarization operations may be inverted for the preferred white box time series model so that the various trends and seasonalities are shown for the trained model. The preferred white box time series model (or the visualization (e.g., graph) of the white box time series model) may be analyzed for at least trends and seasonalities. The trends and seasonalities of the preferred white box time series model (and the training data) may be used to identify any trends and seasonalities in the black box time series model.

In some instances, there may be previous data points (either from the training data or from the forecasted data) that may affect (for example, largely impact) the predicted time instance. For example, if the black box time series model is predicting the average temperature each month, the average temperature that was predicted for March (or, for example, the end of March) may have a large impact on the temperature prediction for April. For instance, if March is predicted to be unseasonably cold, April might also be predicted to be unseasonably cold. Therefore, an unseasonably cold prediction for March 28th, for example, may impact what is predicted for April 2nd. These impactful data points may be a part of the explanation for the predicted time instance, in some embodiments.

In some embodiments, generating the explanation for the black box time series model includes determining at least a trend, seasonality, and residual of the black box time series model based on the analyzed behavior of the preferred white box time series model. Seasonality of the black box time series model may include seasonal variations or trends of the time series.

Trends of the black box time series model may include any other trends of the time series. For instance, there may be long-term movements or trends. For example, using the previous temperature example, there may be a long-term movement of colder temperatures in the winter. Put differently, each winter (or every few winters) may have slightly colder temperatures than the previous few winters. Another trend may be cyclic variations in the time series. Cyclic variations may include any trends or changes in cycles of the time series. For example, colder temperatures when the sun is down (i.e., it is dark out) and warmer temperatures when the sun is up (i.e., it is light out) may be a cyclic trend or cyclic variation. In some instances, another possible trend may be irregular variations or movements. For example, if January 15thhad an average temperature of 54 degrees Fahrenheit, when the rest of January had average temperatures ranging 15-30 degrees Fahrenheit, January 15thmay be an irregular variation.

Residuals of the black box time series model may be a difference between the observations (or what was expected) for the model and what was predicted for the model. For example, for a time series model predicting average temperatures, it may be expected that the winter months are colder than the summer months. However, in this example, the black box time series model may predict that in February, the temperature is relatively warm. The prediction may be different than what was expected and thus may have a residual error.

In some embodiments, the explanation for the black box time series model includes the seasonality, trends, residuals, error, and/or key data points. These components of the explanation may demonstrate why the black box time series model predicted the value it did at the predicted time instance.

In some embodiments, generating the explanation for the black box time series model includes generating a visualization of the black box time series model. For instance, one or more graphs and/or schematic diagrams may be generated to depict the explanation. In some instances, the visualization of the black box time series model may include at least a first visualization of the trend, a second visualization of the seasonality, and a third visualization of the residual. For example, the explanation may include a graph depicting the trends of the black box time series model (for example, the time series models forecasted by the black box time series model), a graph depicting the seasonality of the black box time series model, and/or a graph depicting the residual error of the black box time series model.FIG. 5depicts an example explanation500.

Referring toFIG. 2, a schematic diagram200of various inputs and outputs for explaining predictions made by black box time series models is depicted, according to some embodiments. In some embodiments, method100is executed by processor205. The processor205may be on or connected to a computer system (such as system600), in some instances. Processor205may execute a method (e.g., method100(FIG. 1)) to generate explanations for the predicted time instance forecasted by the black box time series model.

In some embodiments, time series data210, forecasted data220, and the specific predicted time instance230may be inputted into the processor205. The time series data210may be the training data used to train the black box time series model. In some embodiments, time series data210is obtained in operation150(FIG. 1). The forecasted data220may be the time series data, or time instances, predicted using the black box time series model. In some embodiments, the forecasted data220is predicted in operation130(FIG. 1). The predicted time instance230may be a single piece of forecasted data220. In some instances, a single predicted time instance230is selected from the forecasted data220for explanation (for example, in operation140(FIG. 1)). Put differently, the system may want to explain the prediction of a single time instance230from the plurality of time instances that may make up the forecasted data220. In some embodiments, forecasted data220includes a single data point and the predicted time instance230is the same as the forecasted data220.

In some embodiments, processor205generates and outputs an explanation270. In some embodiments, the explanation270includes key data points240for the black box time series model, a trend250of the black box time series model and the forecasted data220, and a seasonality260of the black box time series model and the forecasted data220. Key data points240may be time series data points that have a significant impact on the predicted time instance230. For example, when predicting the household income in March of 2022, the household income in December 2021 may have a significant impact on the income in March of 2022 because of end-of-year raises. If no end-of-year raise is given (or forecasted to be given) in December, then the household income in March may be lower than expected (for instance, than if a raise was given). Trends250of the black box time series model may include any patterns that occur for the time series. For example, the household income may be increasing each year. Seasonalities260of the black box time series model may include patterns in the times/seasons that things occur. For example, the end-of-year raises in December may be a seasonality. A household income in December may typically be higher than the household income in November. The explanation270is further discussed herein and depicted inFIG. 5.

Referring toFIG. 3, a schematic diagram of a visual representation300of forecasting done by a black box time series model is depicted, according to some embodiments. The visual representation300may include a graph305of the time series data. The graph305of the time series data may include the time series data used to train the black box time series model (referred to herein as the training data portion330) and the time series data predicted using the trained black box time series model (referred to herein as the forecasted data portion240). For example, data about the average temperature in January for each year from 1980-2020 may have been used to train the black box model and may be depicted as training data portion330. In this example, data may be predicted for the average temperature in January from 2021-2040 and may be depicted as forecasted data portion340. In some instances, the x-axis310of the graph represents a time component and the y-axis320of the graph may represent a second component (for example, household income, temperature, in-game currency, storage quantities, etc.). Continuing the above example, the x-axis310of the graph may be the year (e.g., January 1990, 1991, 1992, etc.) and the y-axis may be the temperature.

In some embodiments, portion330of the graph305is a visual representation of the training data for the black box model. The training data portion330of the black box model may include training data that was used to train the black box time series model. In some embodiments, portion340of the graph305is a visual representation of the forecasted data for the black box time series model. The forecasted data portion340of graph305may include the data that the black box time series model predicted will occur. In some embodiments, times342,344, and346are all forecasted times that correspond to three forecasted data points of the graph305. For example,342may be January 2021,344may be January 2030, and346may be January 2040. Data point345at time344may be the forecasted data point that is selected for explanation. For example, data point345may be an average temperature of 20 degrees Fahrenheit in January 2030. This data point345may be referred to herein as the predicted time instance.

Referring toFIG. 4, a schematic diagram of visual representations400of a set of white box time series models is depicted, according to some embodiments. In some embodiments, the visual representation400includes a plurality of graphs410corresponding to each white box time series model420,440, and450and, in some instances, the black box time series model430. The graphs for each time series model may be referred to herein as time series models410. The time series models410may include at least white box time series model420, white box time series model440, white box time series model450, and black box time series model430.

In the example visual representation400, the time series models410may be forecasting amounts of in-game currency at various times in the time series. In visual representation400, white box time series models420and440and black box time series model430are similar and do not differ much from each other from approximately time May 2018 through approximately time October 2018. After time October 2018, each of the white box time series models420,440, and450appear to diverge more from each other. Each of the white box models420,440, and450may be compared to the black box model430to determine which white box model is the preferred white box model. For instance, white box time series model450appears to differ significantly from black box time series model430. White box time series models420and440appear to be more similar to black box time series model430, however, white box time series model440appears to be similar to black box model430at approximately times May through September 2018 and March 2019, and appears to diverge the rest of the time. White box time series model420appears to be the most similar to black box time series model430.

At the specific time instance of January 2019, White box time series model450is most similar to black box time series model430. If the preferred white box time series model was selected based on just the specific time instance, white box time series model450may be determined to be the preferred time series model at time instance January 2019. However, when the preferred white box time series model is selected based also on the models as a whole, white box time series model450may not be selected as the preferred white box time series model, in this example, due to its differences compared to black box time series model430.

Referring toFIG. 5, a schematic diagram of an example explanation500of a prediction made by a black box time series model is depicted, according to some embodiments. In some embodiments, the explanation500of the prediction may be depicted as a visualization such as a graph, or graphs. Example explanation500includes a forecast and trend visualization510, a seasonality visualization520, a residual visualization530, and an error visualization540. Box550may depict the areas of each visualization that represent the future data (referred to herein as future data550). In some embodiments, explanation500may also include key data points502and506. In some embodiments, key data points502and506are data points that had a significant impact on forecasting the predicted time instance518.

In some embodiments, the forecast and trend visualization510may include at least any trends of the black box time series model. In some embodiments, the forecast and trend visualization510may include forecasted data514. In example explanation500, forecast and trend visualization510includes the actual data512, the forecasted data514, and the trends516. The forecasted data514may include the data that was forecasted by the time series model. The actual data512may include the actual time series data that occurred. For example, the black box time series model may have predicted data (i.e., forecasted data514). However, between the time the data was forecasted and the explanation500was generated, time may have passed and actual data512may have occurred. Therefore, in some instances, the system may have access to actual data512and may be able to depict the actual data512and compare it to the forecasted data514. In some instances, the forecast and trend visualization may not include actual data512. In forecast and trend visualization510, actual data512only occurs through future data550, as future data550includes forecasted data for times that may not have occurred yet, so actual data512may not exist.

In some embodiments, trends516shows the trend(s) of the forecasted data514. In forecast and trend visualization510, the trend516of the forecasted data514includes that the data increases while peaking at around predicted time instance518. In some embodiments, predicted time instance518is the time instance that has been selected for explanation.

In some embodiments, seasonality visualization520includes the seasonality525of the forecasted data514. In some embodiments, each trough to peak to trough may be a season. In the seasonality visualization520, there may be at least 24 seasons depicted. Seasonality visualization520may include predicted time instance518and where in the seasonality trend predicted time instance518occurs. For example, in example explanation500, predicted time instance518is towards the end of the season, during the downward trend. Further, seasonality visualization520may include a representation of key points502and506and their corresponding positions on the seasonality trend525. In this example, key points502and506both occur at approximately the same trend, however key point502occurs in the earlier portion of the season, where key point506occurs at a similar point of the season as predicted time instance518.

In some embodiments, residual visualization530may depict the residuals535(e.g., the difference between the observed value and the estimated value) between the expected data and the forecasted data514. The expected data may be the data that, based on training data and observations, the black box time series model was expected to predict. The forecasted data514may be the data that the black box time series model actually predicted. The residual error535for the black box time series model appears to be relatively low, or at least moderately low, however there are multiple peaks throughout the residual535where the residual error appears to be high. The residual error at the time of the predicted time instance518appears to be relatively low, which may indicate that the black box time series model predicted similar to what was expected at the predicted time instance518.

In some embodiments, the error visualization540may depict the absolute error545of the forecasted data514(compared to the actual data512). For instance, absolute error545may show the difference between forecasted data514and actual data512. In some embodiments, the actual error visualization540may only occur when there is actual data512. If there is no actual data512, there may be no absolute error for the forecasted data514, in some instances.

In some embodiments, the intersection points between key points502and506and the trends516, the seasonality trend525, and the residual535may be weighted. In some instances (not depicted), these intersections may be marked using circles or dots, and the weights may be denoted by the size of the circles on the intersection points. The weights may represent how much the key points502and506affect the predicted time instance. For example, key point506may significantly impact the prediction of time instance518(e.g., because it is also a peak) and key point502may not impact the prediction of time instance518quite as much. Therefore, in this example, key point506on the trend525line may have a larger weight than key point502on the trend525line and key point506may have a larger circle on the trend525line than key point502.

In some embodiments, the explanation500may be used by the system and/or users of the system. For example, trend visualization510may be used to show that there is an overall rising trend to the data. Therefore, the black box time series model's prediction of time instance518may be higher than previous time series data points, such as at time instance502, due to at least the trends of the forecasted data514. Seasonality visualization520may show that there are seasonality trends for the data. Without having knowledge of the seasonality trends, a system and/or user may not understand why the black box time series model predicts some time series points as going down over short periods (for example at time instance502) when the overall trend516of the forecasted data is going up. The error visualization(s) (i.e., residual visualization530and/or error visualization540) may help show any weaknesses in the black box time series model. For instance, the residual visualization530and the error visualization540have various peaks where the black box time series model was not as accurate in its predictions. The residual visualization530and error visualization540may be particularly useful for debugging the black box time series model. For example, a large residual error (or even a large actual error) may indicate that there was a problem with the prediction at that particular time instance, and that time instance could be flagged for debugging. Further, trends and seasonalities may also help identify unexpected and/or inaccurate predictions to flag for debugging.

Referring toFIG. 6, computer system600is a computer system/server602is shown in the form of a general-purpose computing device, according to some embodiments. In some embodiments, computer system/server602is located on the linking device. In some embodiments, computer system602is connected to the linking device. The components of computer system/server602may include, but are not limited to, one or more processors or processing units610, a system memory660, and a bus615that couples various system components including system memory660to processor610.

Computer system/server602typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer system/server602, and it includes both volatile and non-volatile media, removable and non-removable media.

System memory660can include computer system readable media in the form of volatile memory, such as random-access memory (RAM)662and/or cache memory664. Computer system/server602may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system665can be provided for reading from and writing to a non-removable, non-volatile magnetic media (not shown and typically called a “hard drive”). Although not shown, a magnetic disk drive for reading from and writing to a removable, non-volatile magnetic disk (e.g., a “floppy disk”), and an optical disk drive for reading from or writing to a removable, non-volatile optical disk such as a CD-ROM, DVD-ROM or other optical media can be provided. In such instances, each can be connected to bus615by one or more data media interfaces. As will be further depicted and described below, memory660may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the disclosure.

Program/utility668, having a set (at least one) of program modules669, may be stored in memory660by way of example, and not limitation, as well as an operating system, one or more application programs, other program modules, and program data. Each of the operating system, one or more application programs, other program modules, and program data or some combination thereof, may include an implementation of a networking environment. Program modules669generally carry out the functions and/or methodologies of embodiments of the invention as described herein.

Computer system/server602may also communicate with one or more external devices640such as a keyboard, a pointing device, a display630, etc.; one or more devices that enable a user to interact with computer system/server602; and/or any devices (e.g., network card, modem, etc.) that enable computer system/server602to communicate with one or more other computing devices. Such communication can occur via Input/Output (I/O) interfaces620. Still yet, computer system/server602can communicate with one or more networks such as a local area network (LAN), a general wide area network (WAN), and/or a public network (e.g., the Internet) via network adapter650. As depicted, network adapter650communicates with the other components of computer system/server602via bus615. It should be understood that although not shown, other hardware and/or software components could be used in conjunction with computer system/server602. Examples include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.