Fuel oil price prediction method
By introducing seasonal autoregressive comprehensive moving average model and exogenous variables in fuel oil price prediction, the problem that existing methods fail to effectively consider seasonal changes and external factors is solved, significantly improving the prediction accuracy and enhancing the model's reliance Great.
Patent Information
- Application Number
- CN202411582831.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-18
AI Technical Summary
The existing fuel oil price prediction methods fail to effectively consider seasonal trends and external influencing factors, resulting in insufficient prediction accuracy.
The seasonal autoregressive integrated moving average model (SARIMAX) combined with exogenous variables is used to construct a regression model through historical fuel oil prices, relevant parameter data and news scores to predict fuel oil prices.
It improves the accuracy of fuel oil price prediction, can capture various influencing factors more comprehensively, enhances the robustness of the model, and is suitable for price predictions in other energy markets.
Smart Images

Figure CN119477398A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of fuel oil price prediction, and in particular to a fuel oil price prediction method. Background Art
[0002] As an important part of the energy market, the price trend of low-sulfur fuel oil is closely related to the macroeconomic situation. By observing the price changes of low-sulfur fuel oil, we can indirectly understand the progress of global economic recovery, the level of industrial production activity, and the development of the transportation industry. For traders, accurate price forecasts can help them formulate reasonable production plans, procurement strategies and inventory levels, thereby optimizing resource allocation and reducing operating risks.
[0003] In current research, a variety of methods are used to predict oil prices, including time series analysis, artificial intelligence, hybrid models, and pattern recognition. For example, Zhao et al. used the autoregressive moving average (ARIMA) model to predict international crude oil prices, showing good results in short-term predictions. Wang Shuping et al. combined empirical mode decomposition (EMD) with ARIMA and BP models to predict the price of West Texas Intermediate (WTI) crude oil in the United States. The prediction effect of this combined model is better than that of the single ARIMA and BP models. Yang Jingling et al. used the combined model of complementary ensemble empirical mode decomposition (CEEMD) and Elman-Adaboost neural network to predict Brent crude oil prices and achieved high prediction accuracy. Yu Le'an et al. combined the pattern matching idea with deep learning to improve the accuracy of multi-period prediction of international oil prices. Wang et al. integrated artificial neural network (ANN), rule-based expert system (RES) and text mining (WTM) technology to develop a novel hybrid model for oil price prediction.
[0004] However, most of the above methods do not take into account the seasonal variation trend of oil prices. In order to improve the accuracy of the prediction, it is necessary to introduce seasonal variation factors into the model. In addition, the fluctuation of oil prices is not only affected by its own historical data, but also by various external factors such as the global economic situation, geopolitical events, and natural disasters. These factors are difficult to capture with a simple seasonal model. Therefore, the present invention uses a seasonal autoregressive integrated moving average model with exogenous variables (Seasonal Autoregressive Integrated Moving Average with Exogenous Variables, SARIMAX) to predict oil prices to better reflect these complex external influencing factors. Summary of the invention
[0005] In order to introduce external factors and seasonal variation factors into the model and improve the prediction accuracy of low-sulfur fuel oil, the present invention proposes a fuel oil price prediction method, comprising:
[0006] Obtain historical fuel oil prices, collect historical data of various parameters related to fuel oil prices, obtain historical news data related to fuel oil prices, and calculate news scores for each unit of time;
[0007] Use historical fuel oil prices, historical data of various parameters, and news scores in each unit time to construct a time series with the same unit time length to obtain the initial time series;
[0008] Perform data stabilization on the initial time series to obtain the target time series;
[0009] Construct a regression model, and generate an autocorrelation graph and a partial autocorrelation graph corresponding to the historical fuel oil price through the autocorrelation function and the partial autocorrelation function, and obtain the target parameter combination through the autocorrelation graph and the partial autocorrelation graph;
[0010] The sample length, i.e., the time span of the data in a training sample, is set, and the target time series is divided into a plurality of training samples and a plurality of test samples using the sample length as a unit to obtain a training set and a test set; the label of each training sample includes the fuel oil price at the prediction time point corresponding to the training sample;
[0011] Use the target parameter combination, training set and test set to train the regression model to obtain the target regression model;
[0012] The most recent historical relevant data before the time point to be predicted is obtained; the historical relevant data includes the historical fuel oil prices within the sample length, various parameter data related to the fuel oil prices, and news scores; the historical relevant data is used as the input of the model, and the target regression model is used to predict the fuel oil price corresponding to the time point to be predicted.
[0013] Furthermore, the various parameters related to fuel oil prices include:
[0014] West Texas Intermediate crude oil prices, Brent crude oil prices, Dubai crude oil prices, Australian coal prices, US natural gas prices, European natural gas prices and Japanese liquefied natural gas prices.
[0015] Further, the data contained in each data column in the initial time series is: historical data of a parameter category or news scores or historical fuel oil prices corresponding to each unit time;
[0016] The data stabilization process of the initial time series is performed to obtain the target time series, specifically:
[0017] Perform data stabilization processing on each data column in the initial time series, including:
[0018] Construct the ADF regression model corresponding to the current data column: Δyt = α+γy t-1 +∈ t ;
[0019] In the formula, y t Indicates the y value corresponding to time t in the data column. The y value represents the data in the data column. Δy t Represents y t The first difference of t-1 is the y value lagged by one period, γ is the autoregressive coefficient, α is the intercept term, ∈ t is a random disturbance term;
[0020] The parameters in the ADF regression model are estimated by the least squares method: the intercept term α and the autoregressive coefficient γ;
[0021] Calculate and output ADF statistics, P values and critical values using the estimated parameters through the ADF regression model;
[0022] Assume that the current data column has a unit root, determine whether the p-value is less than the critical value, and the t-value is greater than the critical value. If so, it means that the hypothesis is not true, and start data stabilization processing on the next data column. If not, perform difference processing on the current data column, and perform data stabilization processing on the data column after difference processing again until the hypothesis is not true.
[0023] Furthermore, the ADF regression model is used to calculate and output the ADF statistic, P value and critical value using the estimated parameters, specifically including:
[0024] Calculate the ADF statistic, i.e. the t-value: In the formula, is the estimated value of the autoregressive coefficient γ, represents the standard deviation of the autoregressive coefficient γ;
[0025] The estimated values of the autoregressive coefficients Calculate the P value using the t distribution;
[0026] The critical value is obtained using the preset confidence level through the ADF distribution table.
[0027] Furthermore, the said constructing a regression model, and generating an autocorrelation graph and a partial autocorrelation graph corresponding to the historical fuel oil price through the autocorrelation function and the partial autocorrelation function, and obtaining the target parameter combination through the autocorrelation graph and the partial autocorrelation graph, specifically includes:
[0028] Generate autocorrelation graph and partial autocorrelation graph corresponding to historical fuel oil prices through autocorrelation function and partial autocorrelation function;
[0029] Observe the autocorrelation diagram and partial autocorrelation diagram, and preliminarily determine the non-seasonal parameters (p, d, q) of the regression model according to the tailing or truncation of the autocorrelation coefficient and the partial autocorrelation coefficient; where q represents the moving average order, d represents the difference order, and p represents the autoregressive order; when the autocorrelation diagram is truncated after the kth order, q = k; when the partial autocorrelation diagram is truncated after the kth order, p = k; the unit time point of the historical fuel oil price corresponds to the order of the autocorrelation diagram and the partial autocorrelation diagram at the same time;
[0030] Observe the tailing or truncation of the autocorrelation coefficient and partial autocorrelation coefficient in units of seasonal cycle length to determine the seasonal parameters of the model (P, D, Q, S); where P represents the seasonal autoregressive order, D represents the seasonal difference, Q represents the seasonal moving average order, and S represents the seasonal cycle length;
[0031] The grid search method is used to traverse all combinations of non-seasonal parameters (p, d, q) and seasonal parameters (P, D, Q, S). For each combination, the regression model is trained using the training set and the corresponding AIC value is calculated. The combination with the lowest AIC value is selected as the target parameter combination.
[0032] Furthermore, the target parameter combination, the training set and the test set are used to train the regression model to obtain the target regression model, which specifically includes:
[0033] The regression model is trained by the training set, and after each round of training, the currently trained regression model is tested by the test set, and the mean absolute percentage error is calculated to determine whether the mean absolute percentage error is less than the set threshold. If so, the regression model obtained by the current round of training is set as the target regression model. If not, continue with the next round of training until the mean absolute percentage error is less than the set threshold.
[0034] Furthermore, a training sample includes one or more time points to be predicted;
[0035] When a training sample includes only one time point to be predicted, the calculation formula of the mean absolute percentage error is:
[0036]
[0037] In the formula, N represents the number of test samples in the test set, Y i Indicates the actual value of fuel oil price, Represents the predicted value of fuel oil price output by the regression model.
[0038] Furthermore, when a training sample includes multiple time points to be predicted, the calculation formula of the mean absolute percentage error is:
[0039]
[0040] In the formula, T represents the number of time points to be predicted corresponding to a test sample, represents the predicted value of the fuel oil price of the i-th test sample at the t-th predicted time point, Y i,t Represents the actual value of the fuel oil price of the i-th test sample at the t-th time point to be predicted.
[0041] Furthermore, the regression model is expressed as follows:
[0042]
[0043] In the formula, is the predicted value of the fuel oil price at the predicted time point output by the model; c is a constant; β n is the autoregressive coefficient; φ n is the moving average coefficient; η n is the coefficient of the exogenous variable; θ n is the seasonal autoregressive coefficient; n is the seasonal moving average coefficient; Y t-n represents the actual value of the fuel oil price at the time point tn; ε t-n represents the disturbance term at time point tn; r represents the number of exogenous variables; x nt represents the data value of the nth exogenous variable at time point t; Y t-sn The actual value of the fuel oil price at the trend autoregressive part at the t-sn time point; ε t-sn represents the disturbance term at the t-sn time point; ε t is the disturbance term at time t; p is the order of trend autoregression; q is the order of trend moving average; P is the order of seasonal trend autoregression; Q is the order of seasonal trend moving average; s is the length of seasonal cycle; the exogenous variables are various parameters and news scores related to fuel oil prices.
[0044] Furthermore, before the data stabilization process is performed on the initial time series, it also includes:
[0045] Standardize the data of each data column in the initial time series in turn;
[0046] The standardized formula expression is:
[0047]
[0048] In the formula, X represents the standardized data, x represents the data before standardization in the data column, std represents the standard deviation of the current data column, mean represents the mean value of the current data column, and x represents the standard deviation of the current data column.i represents the i-th data in the current data column, and n represents the number of data in the current data column.
[0049] Compared with the prior art, the present invention has at least the following beneficial effects:
[0050] (1) The present invention obtains a target time series by using historical fuel oil prices, historical data of various parameters, and news ratings within each unit time; constructs a regression model, and obtains a target parameter combination of the regression model through the historical fuel oil prices; sets a sample length, i.e., the time span of its data in a training sample, and divides the target time series into multiple training samples and multiple test samples with the sample length as a unit, to obtain a training set and a test set; trains a regression model using the target parameter combination, the training set, and the test set to obtain a target regression model; obtains the most recent historical relevant data before the time point to be predicted; the historical relevant data includes the historical fuel oil prices within the sample length, various parameter data related to the fuel oil prices, and news ratings; uses the historical relevant data as the input of the model, and uses the target regression model to predict the fuel oil price corresponding to the time point to be predicted, that is, the present invention uses exogenous variables, i.e., various parameter data related to the fuel oil prices, and news ratings as training data to train the regression model, thereby taking external influencing factors into consideration and improving the prediction accuracy of the oil price;
[0051] (2) The present invention generates an autocorrelation graph and a partial autocorrelation graph corresponding to the historical fuel oil price through the autocorrelation function and the partial autocorrelation function, and determines the non-seasonal parameters (p, d, q) and seasonal parameters (P, D, Q, S) of the regression model through the autocorrelation graph and the partial autocorrelation graph, thereby realizing the effective utilization of the seasonal variation trend of the fuel oil price and further improving the prediction accuracy of the oil price;
[0052] (3) By introducing various parameter data and news scores related to fuel oil prices as exogenous variables, the present invention can more comprehensively capture various factors affecting fuel oil prices. At the same time, by introducing news scores, it takes into account emergencies, significantly improving the accuracy of prediction;
[0053] (4) Traditional forecasting models often rely only on historical price data and are easily affected by market fluctuations. The present invention enhances the robustness of the model by combining multiple exogenous variables, so that it can maintain high forecasting performance in different market environments.
[0054] (5) The present invention is not only applicable to the prediction of fuel oil prices, but can also be extended to the price prediction of other energy markets, such as crude oil, natural gas, etc., and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1The figure is a flow chart of a fuel oil price forecasting method. DETAILED DESCRIPTION
[0056] The following are specific embodiments of the present invention and the accompanying drawings to further describe the technical solution of the present invention, but the present invention is not limited to these embodiments.
[0057] In order to introduce external factors and seasonal changes into the model and improve the prediction accuracy of low sulfur fuel oil, such as Figure 1 As shown, the present invention proposes a fuel oil price prediction method, comprising:
[0058] Obtain historical fuel oil prices, collect historical data of various parameters related to fuel oil prices, obtain historical news data related to fuel oil prices, and calculate the news score within each unit time (1 day);
[0059] In this embodiment, sentiment analysis is performed on each piece of news published on a daily basis to determine whether the news has a positive or negative impact on oil prices. This can usually be achieved through natural language processing technology, including using a pre-trained sentiment analysis model or a customized algorithm to evaluate the sentiment polarity of news texts.
[0060] Each piece of news is scored based on the results of sentiment analysis. If the impact of the news on oil prices is considered positive, a positive number is given as the score; if it is a negative impact, a negative number is given as the score. The specific numerical value of the score can vary depending on the intensity of the sentiment.
[0061] Set weights for different news. The weights may be determined based on factors such as the importance of the news, the authority of the source, the influence, etc. For example, important reports from well-known financial media may be given higher weights.
[0062] According to the set weights, the scores of all news on the day are calculated by weighted average. The calculation formula can be expressed as:
[0063]
[0064] Among them, the news score is the score of each news obtained based on sentiment analysis, and the news weight is the weight of the corresponding news.
[0065] The various parameters related to fuel oil prices include:
[0066] West Texas Intermediate crude oil prices, Brent crude oil prices, Dubai crude oil prices, Australian coal prices, US natural gas prices, European natural gas prices and Japanese liquefied natural gas prices.
[0067] Using historical fuel oil prices, historical data of various parameters, and news scores in each unit time, a time series with the same unit time length (in days) is constructed to obtain the initial time series;
[0068] Before the initial time series is subjected to data stabilization, it also includes:
[0069] 1. Standardize the data of each data column in the initial time series in turn;
[0070] The standardized formula expression is:
[0071]
[0072] In the formula, X represents the standardized data, x represents the data before standardization in the data column, std represents the standard deviation of the current data column, mean represents the mean value of the current data column, and x represents the standard deviation of the current data column. i represents the i-th data in the current data column, and n represents the number of data in the current data column.
[0073] 2. Data cleaning of the standardized initial time series
[0074] 1) Check missing values: First, confirm whether there are missing values in the initial time series. This can be achieved through specific functions in the programming language, such as the isnull() method provided by the Pandas library in Python, which can return a Boolean value matrix indicating which cells contain null values. In addition, in this embodiment, missing values can be filled using interpolation methods (such as linear interpolation).
[0075] 2) Index conversion to date format: If the timestamp in the initial time series is not in datetime format, it needs to be converted to datetime type. This can be done by parsing the timestamp in a string or other format and converting it into a datetime object. For example, in Python, you can use the pd.to_datetime() function to convert.
[0076] 3) Sort by date: Make sure all data records are arranged in chronological order, which is crucial for time series analysis.
[0077] 4) Calculate the interquartile range (IQR): IQR is the distance from the first quartile (Q1) to the third quartile (Q3), that is, IQR = Q3-Q1. This is an indicator of the trend in the initial time series and can be used to detect outliers. Calculating IQR can help identify extreme values that are beyond the normal range. Specifically:
[0078] The first quartile (Q1): refers to the value in the lower 25% position after sorting the initial time series from small to large. In other words, the data below Q1 accounts for 25% of the entire initial time series, while the data above Q1 accounts for 75%.
[0079] The third quartile (Q3): refers to the value in the upper 75% position. In other words, the data below Q3 accounts for 75% of the entire initial time series, while the data above Q3 only accounts for 25%.
[0080] The range between these two quartiles, i.e. Q3 minus Q1, is called the interquartile range (IQR), which is used to describe the range of the middle 50% of the data distribution. IQR is an important statistic used to identify outliers in the data. When a data point is lower than Q1-1.5*IQR or higher than Q3+1.5*IQR, the data point is usually considered an outlier. This method of identifying outliers is not affected by extreme values, so it is very useful in the data cleaning process.
[0081] 5) Remove outliers based on IQR: Identify outliers based on the upper and lower limits defined by IQR. Typically, data points below Q1-1.5*IQR or above Q3+1.5*IQR are considered outliers. You can create conditional logic to remove these outliers.
[0082] 6) Remove duplicate indexes: Check if there are duplicate timestamps or indexes and remove those duplicates. This can be achieved with the drop_duplicates() method, which allows you to remove rows with the same index or column values.
[0083] 7) Filling missing dates: If there are breakpoints in the time series (i.e., there is no data on some dates), you can insert these missing dates and fill the missing values using appropriate methods such as forward filling (ffill), backward filling (bfill), or interpolation.
[0084] Perform data stabilization on the initial time series to obtain the target time series;
[0085] The data contained in each data column in the initial time series is: historical data of a parameter category or news scores or historical fuel oil prices corresponding to each unit time;
[0086] The data stabilization process of the initial time series is performed to obtain the target time series, specifically:
[0087] Perform data stabilization processing on each data column in the initial time series, including:
[0088] Construct the ADF regression model corresponding to the current data column: Δy t =α+γy t-1 +∈ t ;
[0089] In the formula, y t Indicates the y value corresponding to time t in the data column. The y value represents the data in the data column. Δy t Represents y t The first difference of t-1 is the y value lagged by one period, γ is the autoregressive coefficient, α is the intercept term, ∈ t is a random disturbance term;
[0090] The parameters in the ADF regression model are estimated by the least squares method: the intercept term α and the autoregressive coefficient γ;
[0091] The ADF regression model uses the estimated parameters to calculate and output the ADF statistic, P value and critical value; specifically:
[0092] Calculate the ADF statistic, i.e. the t-value: In the formula, is the estimated value of the autoregressive coefficient γ, represents the standard deviation of the autoregressive coefficient γ;
[0093] The estimated values of the autoregressive coefficients Calculate the P value using the t distribution;
[0094] The critical value is obtained using the preset confidence level through the ADF distribution table.
[0095] Assume that the current data column has a unit root, determine whether the p-value is less than the critical value, and the t-value is greater than the critical value. If so, it means that the hypothesis is not true, and start data stabilization processing on the next data column. If not, perform difference processing on the current data column, and perform data stabilization processing on the data column after difference processing again until the hypothesis is not true.
[0096] An example of a target time series is shown below in a table (but the present invention is not limited to this example):
[0097]
[0098]
[0099] Construct a regression model, and generate autocorrelation graphs and partial autocorrelation graphs corresponding to historical fuel oil prices through autocorrelation functions and partial autocorrelation functions, and obtain target parameter combinations through autocorrelation graphs and partial autocorrelation graphs; specifically, include:
[0100] Generate autocorrelation graph and partial autocorrelation graph corresponding to historical fuel oil prices through autocorrelation function and partial autocorrelation function;
[0101] Observe the autocorrelation graph and the partial autocorrelation graph, and preliminarily determine the non-seasonal parameters (p, d, q) of the regression model according to the tailing or truncation of the autocorrelation coefficient and the partial autocorrelation coefficient; wherein q represents the moving average order, d represents the difference order (d=1 in this embodiment), and p represents the autoregressive order; when the autocorrelation graph is truncated after the kth order, q=k; when the partial autocorrelation graph is truncated after the kth order, p=k; the unit time point of the historical fuel oil price corresponds one-to-one to the order of the autocorrelation graph and the partial autocorrelation graph;
[0102] Specifically:
[0103] Assume that the autocorrelogram is truncated after the kth order: This means that after the kth order, the correlation between the series corresponding to the historical fuel oil price and itself at different lags is significantly weakened and close to zero. This usually means that there is a k-order moving average (MA) component. Therefore, if the autocorrelogram is truncated after the 3rd order, q=3 is usually selected.
[0104] Assume that the partial autocorrelogram is truncated after the kth order: This means that after the kth order, the partial autocorrelation of the series corresponding to the historical fuel oil price is significantly weakened and close to zero after excluding the influence of the intermediate lag period. This usually means that there is an autoregressive (AR) component of order k. Therefore, if the partial autocorrelogram is truncated after the 1st order, p = 1 is usually selected.
[0105] Observe the tailing or truncation of the autocorrelation coefficient and partial autocorrelation coefficient in units of seasonal cycle length to determine the seasonal parameters of the model (P, D, Q, S); where P represents the seasonal autoregressive order, D represents the seasonal difference, Q represents the seasonal moving average order, and S represents the seasonal cycle length;
[0106] Specifically, seasonal cycle length refers to the length of a recurring pattern in a time series. For example, for monthly data, a common seasonal cycle length is 12 months (there are 12 months in a year), and for quarterly data, the cycle length is 4 quarters. If the data is monthly, you will observe a cycle of 12 months or 24 months. If the data is quarterly, you will observe a cycle of 4 quarters or 8 quarters.
[0107] For example, look at the autocorrelogram with a seasonal cycle length of 12 months and look for significant truncation points. If the seasonal autocorrelogram is truncated after the 12th order, Q = S = 12 is usually chosen.
[0108] For example, look at the partial autocorrelogram with a seasonal period length of 12 months and look for significant truncation points. If the seasonal partial autocorrelogram is truncated after the first order, P = 1 is usually chosen.
[0109] For example, suppose the seasonal autocorrelogram is truncated after the 12th order and the seasonal partial autocorrelogram is truncated after the 1st order. Then:
[0110] Seasonal autocorrelations: truncated after the 12th order, indicating the possible presence of a 12th-order seasonal moving average (MA) component. Therefore, Q = 12 is selected.
[0111] Seasonal partial autocorrelation plot: truncated after the first order, indicating that there may be a first-order seasonal autoregressive (AR) component. Therefore, P=1 is selected.
[0112] In time series analysis, the length of the seasonal cycle (S) is usually known or determined based on the characteristics of the data. In the above assumption, the length of the seasonal cycle is 12 months (i.e., a one-year cycle), so S=12.
[0113] Assume that a seasonal difference is needed to remove the seasonal trend. This means that in order to make the series stationary, a seasonal difference is needed, then D = 1.
[0114] The grid search method is used to traverse all combinations of non-seasonal parameters (p, d, q) and seasonal parameters (P, D, Q, S). For each combination, the regression model is trained using the training set and the corresponding AIC value is calculated. The combination with the lowest AIC value is selected as the target parameter combination.
[0115] In this embodiment, the values of P, D, and Q parameters are (3, 1, 0); the values of p, q, and d are (3, 2, 1); and p+q+d≤10.
[0116] The sample length, i.e., the time span of the data in a training sample, is set, and the target time series is divided into a plurality of training samples and a plurality of test samples using the sample length as a unit to obtain a training set and a test set; the label of each training sample includes the fuel oil price at the prediction time point corresponding to the training sample;
[0117] It should be noted that, assuming that the time span of a training sample is 3 days, taking the data in Table 1 as an example, the data rows from 20240926 to 20240928 can constitute a training sample.
[0118] Use the target parameter combination, training set and test set to train the regression model to obtain the target regression model; specifically, it includes:
[0119] The regression model is trained by the training set, and after each round of training, the currently trained regression model is tested by the test set, and the mean absolute percentage error is calculated to determine whether the mean absolute percentage error is less than the set threshold. If so, the regression model obtained by the current round of training is set as the target regression model. If not, continue with the next round of training until the mean absolute percentage error is less than the set threshold.
[0120] A training sample includes one or more time points to be predicted; specifically, by setting the sample length of the training sample and the corresponding time point to be predicted, the input and output of the target regression model can be determined. For example, a training sample includes historical data for October 9, October 10, and October 11, 2024, and the labels include fuel oil prices at two time points to be predicted: the fuel oil prices on October 12 and October 13, 2024. Then, the trained target regression model will use the historical data of the last three days to predict the fuel oil prices for the next two days in actual use.
[0121] When a training sample includes only one time point to be predicted, the calculation formula of the mean absolute percentage error is:
[0122]
[0123] In the formula, N represents the number of test samples in the test set, Y i Indicates the actual value of fuel oil price, Represents the predicted value of fuel oil price output by the regression model.
[0124] When a training sample includes multiple time points to be predicted, the calculation formula of the mean absolute percentage error is:
[0125]
[0126] In the formula, T represents the number of time points to be predicted corresponding to a test sample, represents the predicted value of the fuel oil price of the i-th test sample at the t-th predicted time point, Y i,t Represents the actual value of the fuel oil price of the i-th test sample at the t-th time point to be predicted.
[0127] The formula expression of the regression model is:
[0128]
[0129] In the formula, is the predicted value of the fuel oil price at the predicted time point output by the model; c is a constant; β n is the autoregressive coefficient; φ n is the moving average coefficient; ηn is the coefficient of the exogenous variable; θ n is the seasonal autoregressive coefficient; n is the seasonal moving average coefficient; Y t-n represents the actual value of the fuel oil price at the time point tn; ε t-n represents the disturbance term at time point tn; r represents the number of exogenous variables; x nt represents the data value of the nth exogenous variable at time point t; Y t-sn The actual value of the fuel oil price at the trend autoregressive part at the t-sn time point; ε t-sn represents the disturbance term at the t-sn time point; ε T is the disturbance term at time t; p is the order of trend autoregression; q is the order of trend moving average; P is the order of seasonal trend autoregression; Q is the order of seasonal trend moving average; s is the length of seasonal cycle; the exogenous variables are various parameters and news scores related to fuel oil prices.
[0130] The most recent historical relevant data before the time point to be predicted is obtained; the historical relevant data includes the historical fuel oil prices within the sample length, various parameter data related to the fuel oil prices, and news scores; the historical relevant data is used as the input of the model, and the target regression model is used to predict the fuel oil price corresponding to the time point to be predicted.
[0131] The present invention obtains a target time series by using historical fuel oil prices, historical data of various parameters and news scores within each unit time; constructs a regression model, and obtains a target parameter combination of the regression model through the historical fuel oil prices; sets a sample length, i.e., the time span of its data in a training sample, and divides the target time series into multiple training samples and multiple test samples with the sample length as a unit to obtain a training set and a test set; trains the regression model using the target parameter combination, the training set and the test set to obtain a target regression model; obtains the most recent historical relevant data before a time point to be predicted; the historical relevant data includes historical fuel oil prices within the sample length, various parameter data related to the fuel oil price and news scores; uses the historical relevant data as the input of the model, and uses the target regression model to predict the fuel oil price corresponding to the time point to be predicted, that is, the present invention uses exogenous variables, i.e., various parameter data related to the fuel oil price and news scores as training data to train the regression model, thereby realizing the consideration of external influencing factors and improving the prediction accuracy of the oil price.
[0132] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0133] In addition, in the present invention, descriptions such as "first", "second", "one", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0134] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0135] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
Claims
1. A fuel oil price forecasting method, characterized in that: include: Obtain historical fuel oil prices, collect historical data of various parameters related to fuel oil prices, obtain historical news data related to fuel oil prices, and calculate news scores for each unit of time; Use historical fuel oil prices, historical data of various parameters, and news scores in each unit time to construct a time series with the same unit time length to obtain the initial time series; Perform data stabilization on the initial time series to obtain the target time series; Construct a regression model, and generate an autocorrelation graph and a partial autocorrelation graph corresponding to the historical fuel oil price through the autocorrelation function and the partial autocorrelation function, and obtain the target parameter combination through the autocorrelation graph and the partial autocorrelation graph; The sample length, i.e., the time span of the data in a training sample, is set, and the target time series is divided into a plurality of training samples and a plurality of test samples using the sample length as a unit to obtain a training set and a test set; the label of each training sample includes the fuel oil price at the prediction time point corresponding to the training sample; Use the target parameter combination, training set and test set to train the regression model to obtain the target regression model; The most recent historical relevant data before the time point to be predicted is obtained; the historical relevant data includes the historical fuel oil prices within the sample length, various parameter data related to the fuel oil prices, and news scores; the historical relevant data is used as the input of the model, and the target regression model is used to predict the fuel oil price corresponding to the time point to be predicted.
2. A fuel oil price prediction method according to claim 1, characterized in that: The various parameters related to fuel oil prices include: West Texas Intermediate crude oil prices, Brent crude oil prices, Dubai crude oil prices, Australian coal prices, US natural gas prices, European natural gas prices and Japanese liquefied natural gas prices.
3. A fuel oil price prediction method according to claim 2, characterized in that: The data contained in each data column in the initial time series is: historical data of a parameter category or news scores or historical fuel oil prices corresponding to each unit time; The data stabilization process of the initial time series is performed to obtain the target time series, specifically: Perform data stabilization processing on each data column in the initial time series, including: Construct the ADF regression model corresponding to the current data column: Δy t =α+γy t-1 +∈ t ; In the formula, y t Indicates the y value corresponding to time t in the data column. The y value represents the data in the data column. Δy t Represents y t The first difference of t-1 is the y value lagged by one period, γ is the autoregressive coefficient, α is the intercept term, ∈ t is a random disturbance term; The parameters in the ADF regression model are estimated by the least squares method: the intercept term α and the autoregressive coefficient γ; Calculate and output ADF statistics, P values and critical values using the estimated parameters through the ADF regression model; Assume that the current data column has a unit root, determine whether the p-value is less than the critical value, and the t-value is greater than the critical value. If so, it means that the hypothesis is not true, and start data stabilization processing on the next data column. If not, perform difference processing on the current data column, and perform data stabilization processing on the data column after difference processing again until the hypothesis is not true.
4. A fuel oil price prediction method according to claim 3, characterized in that: The ADF regression model is used to calculate and output the ADF statistic, P value and critical value using the estimated parameters, specifically including: Calculate the ADF statistic, i.e. the t-value: In the formula, is the estimated value of the autoregressive coefficient γ, represents the standard deviation of the autoregressive coefficient γ; The estimated values of the autoregressive coefficients Calculate the P value using the t distribution; The critical value is obtained using the preset confidence level through the ADF distribution table.
5. A fuel oil price prediction method according to claim 4, characterized in that: The step of constructing a regression model, generating an autocorrelation graph and a partial autocorrelation graph corresponding to the historical fuel oil price through an autocorrelation function and a partial autocorrelation function, and obtaining a target parameter combination through the autocorrelation graph and the partial autocorrelation graph specifically includes: Generate autocorrelation graph and partial autocorrelation graph corresponding to historical fuel oil prices through autocorrelation function and partial autocorrelation function; Observe the autocorrelation diagram and partial autocorrelation diagram, and preliminarily determine the non-seasonal parameters (p, d, q) of the regression model according to the tailing or truncation of the autocorrelation coefficient and the partial autocorrelation coefficient; where q represents the moving average order, d represents the difference order, and p represents the autoregressive order; when the autocorrelation diagram is truncated after the kth order, q = k; when the partial autocorrelation diagram is truncated after the kth order, p = k; the unit time point of the historical fuel oil price corresponds to the order of the autocorrelation diagram and the partial autocorrelation diagram at the same time; Observe the tailing or truncation of the autocorrelation coefficient and partial autocorrelation coefficient in units of seasonal cycle length to determine the seasonal parameters of the model (P, D, Q, S); where P represents the seasonal autoregressive order, D represents the seasonal difference, Q represents the seasonal moving average order, and S represents the seasonal cycle length; The grid search method is used to traverse all combinations of non-seasonal parameters (p, d, q) and seasonal parameters (P, D, Q, S). For each combination, the regression model is trained using the training set and the corresponding AIC value is calculated. The combination with the lowest AIC value is selected as the target parameter combination.
6. A fuel oil price prediction method according to claim 5, characterized in that: Use the target parameter combination, training set and test set to train the regression model to obtain the target regression model, including: The regression model is trained by the training set, and after each round of training, the currently trained regression model is tested by the test set, and the mean absolute percentage error is calculated to determine whether the mean absolute percentage error is less than the set threshold. If so, the regression model obtained by the current round of training is set as the target regression model. If not, continue with the next round of training until the mean absolute percentage error is less than the set threshold.
7. A fuel oil price prediction method according to claim 6, characterized in that: A training sample includes one or more time points to be predicted; When a training sample includes only one time point to be predicted, the calculation formula of the mean absolute percentage error is: In the formula, N represents the number of test samples in the test set, Y i Indicates the actual value of fuel oil price, Represents the predicted value of fuel oil price output by the regression model.
8. A fuel oil price prediction method according to claim 7, characterized in that: When a training sample includes multiple time points to be predicted, the calculation formula of the mean absolute percentage error is: In the formula, T represents the number of time points to be predicted corresponding to a test sample, represents the predicted value of the fuel oil price of the i-th test sample at the t-th predicted time point, Y i,t Represents the actual value of the fuel oil price of the i-th test sample at the t-th time point to be predicted.
9. A fuel oil price prediction method according to claim 8, characterized in that: The formula expression of the regression model is: In the formula, is the predicted value of the fuel oil price at the predicted time point output by the model; c is a constant; β n is the autoregressive coefficient; φ n is the moving average coefficient; η n is the coefficient of the exogenous variable; θ n is the seasonal autoregressive coefficient; n is the seasonal moving average coefficient; Y t-n represents the actual value of the fuel oil price at the time point tn; ε t-n represents the disturbance term at time point tn; r represents the number of exogenous variables; x nt represents the data value of the nth exogenous variable at time point t; Y t-sn The actual value of the fuel oil price at the trend autoregressive part at the t-sn time point; ε t-sn represents the disturbance term at the t-sn time point; ε T is the disturbance term at time t; p is the order of trend autoregression; q is the order of trend moving average; P is the order of seasonal trend autoregression; Q is the order of seasonal trend moving average; s is the length of seasonal cycle; the exogenous variables are various parameters and news scores related to fuel oil prices.
10. A fuel oil price prediction method according to claim 3, characterized in that: Before the initial time series is subjected to data stabilization, it also includes: Standardize the data of each data column in the initial time series in turn; The standardized formula expression is: In the formula, X represents the standardized data, x represents the data before standardization in the data column, std represents the standard deviation of the current data column, mean represents the mean value of the current data column, and x represents the standard deviation of the current data column. i represents the i-th data in the current data column, and n represents the number of data in the current data column.