Method, device and equipment for predicting coal import quantity
Through autocorrelation analysis, partial autocorrelation analysis and Granger causal analysis, the time series characteristics of coal imports were screened out, and the prediction model was trained to make predictions, which solved the problem of prediction inaccurate caused by ignoring time correlation and time dependence in the existing technology, and achieved a more accurate prediction of coal imports.
Patent Information
- Application Number
- CN202411788191.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art ignores the time correlation of time series data and the time dependence of variables in the prediction of coal import volume, resulting in inaccurate prediction.
By obtaining historical data on coal imports, time series features are obtained using autocorrelation analysis and partial autocorrelation analysis, target features with prediction capabilities are screened through Granger causal analysis, and prediction models are trained based on these features.
The time correlation of coal import time series data is fully utilized to improve the accuracy of coal import forecasts.
Smart Images

Figure CN119988853A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of data processing technology, and in particular to a method, device and equipment for predicting coal import volume. Background Art
[0002] As an important energy source, accurate prediction of coal import volume is of great significance to national energy security and economic development. There are many factors that affect coal import volume, and it is crucial to select variables with predictive ability for coal import volume from a large number of influencing factors.
[0003] In the prior art, the selection of predictive variables is based on the Pearson correlation coefficient and the Spearman correlation coefficient to evaluate the correlation between two variables, and the stepwise regression method is used to select variables that contribute greatly to the prediction. Then, machine learning such as the decision tree method is used to evaluate the importance of the variables to screen the variables, and finally the selected variables are used to predict the coal import volume. When predicting the coal import volume, the existing method ignores the time correlation of the coal import volume data as time series data and the time dependence of the variables, resulting in inaccurate prediction of the coal import volume. Summary of the invention
[0004] The purpose of the present invention is to at least provide a method, device and equipment for predicting coal import volume, so as to solve the problem that the existing methods are inaccurate in predicting coal import volume.
[0005] To solve the above technical problems, at least one embodiment of the present application provides a method for predicting coal import volume, including:
[0006] Get historical data on coal imports;
[0007] Autocorrelation analysis and partial autocorrelation analysis are used to obtain the time series characteristics of coal import volume from the historical data of coal import volume;
[0008] Granger causality analysis is used to screen the time series characteristics of coal import volume, and the target features with predictive ability for coal import volume are screened out;
[0009] The coal import volume prediction model is trained based on the target features to obtain a trained coal import volume prediction model;
[0010] The coal import volume is predicted based on the trained coal import volume prediction model.
[0011] In some embodiments, the time series characteristics of coal import volume are obtained from the historical data of coal import volume by using autocorrelation analysis and partial autocorrelation analysis, including:
[0012] The autocorrelation function is used to determine the correlation between the coal import volume time series at different lags;
[0013] The partial autocorrelation function is used to determine the correlation of each lag period of the coal import volume time series.
[0014] In some embodiments, the time series characteristics of coal import volume are screened by Granger causality analysis, including:
[0015] Construct a regression model including the lag term of coal import volume and the lag term of time series characteristics;
[0016] When the performance of a regression model including a lag term of a time series feature is better than that of a regression model not including the lag term of the time series feature, the time series feature is determined as a target feature.
[0017] In some embodiments, the method further comprises:
[0018] The Grey Wolf Optimization Algorithm is used to adjust the hyperparameters of the coal import volume prediction model during the training process. The hyperparameters include the number of hidden layer units, learning rate, batch size, and number of training rounds.
[0019] In some embodiments, the method further comprises:
[0020] Genetic algorithm, particle swarm optimization algorithm or simulated annealing algorithm are used to adjust the hyperparameters of the coal import volume prediction model during the training process.
[0021] In some embodiments, the coal import volume prediction model is constructed based on a vector autoregression integrated moving average model and a long short-term memory model, and the weight of each time step of the long short-term memory model is adjusted using a self-attention mechanism.
[0022] In some embodiments, the coal import volume prediction model is constructed based on a vector autoregression integrated moving average model and a gated recurrent unit model.
[0023] At least one embodiment of the present application further provides a coal import volume prediction device, comprising:
[0024] The acquisition module is used to obtain the historical data of coal import volume;
[0025] An analysis module, for obtaining time series characteristics of coal import volume from historical data of coal import volume by using autocorrelation analysis and partial autocorrelation analysis;
[0026] The screening module is used to screen the time series characteristics of coal import volume through Granger causality analysis, and screen out the target characteristics that have the ability to predict coal import volume;
[0027] A training module, used for training the coal import volume prediction model based on target features to obtain a trained coal import volume prediction model;
[0028] The prediction module is used to predict the coal import volume based on the trained coal import volume prediction model.
[0029] At least one embodiment of the present application also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned coal import volume prediction method.
[0030] At least one embodiment of the present application further provides a computer-readable storage medium storing a computer program, which implements the above-mentioned coal import volume prediction method when executed by a processor.
[0031] The coal import volume prediction method, device and equipment provided by the embodiment of the present application obtains the historical data of coal import volume; uses autocorrelation analysis and partial autocorrelation analysis to obtain the time series characteristics of coal import volume from the historical data of coal import volume; performs feature screening on the time series characteristics of coal import volume through Granger causality analysis to screen out the target characteristics with the ability to predict coal import volume; trains the coal import volume prediction model based on the target characteristics to obtain the trained coal import volume prediction model; and predicts the coal import volume according to the trained coal import volume prediction model. The time correlation of the coal import volume time series data is fully utilized to improve the accuracy of the coal import volume prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] One or more embodiments are exemplarily described by the pictures in the corresponding drawings, and these exemplary descriptions do not constitute limitations on the embodiments.
[0033] Figure 1 A flow chart of a method for predicting coal import volume provided for one embodiment of the present application;
[0034] Figure 2 is a schematic diagram of a coal import volume prediction device provided by an embodiment of the present application;
[0035] Figure 3 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
[0036] Figure 4 A flowchart of a method for predicting coal import volume is provided for another embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, and to fully understand and implement how the present disclosure applies technical means to solve technical problems and achieve the corresponding technical effects, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the present disclosure, not all of the embodiments. The embodiments of the present disclosure and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure.
[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0039] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0040] In order to facilitate understanding of the embodiments of the present application, relevant technical terms involved in the present application are first introduced here.
[0041] Time series: A series of data points arranged in time order. Time series can be uniformly (e.g. hourly, daily) or unevenly sampled.
[0042] Machine Learning: Machine learning is a branch of artificial intelligence that involves the use of algorithms and statistical models to enable computer systems to perform specific tasks without explicit instructions. The core idea of machine learning is to learn patterns and regularities from data in order to make predictions or decisions.
[0043] Statistical regression: Statistical regression is a statistical method used to analyze the relationship between variables. It describes the relationship between one or more independent variables (independent variables) and the dependent variable (dependent variable) by establishing a mathematical model.
[0044] Correlation analysis: Correlation analysis is used to evaluate the strength and direction of the relationship between two or more variables. Commonly used correlation coefficients include Pearson correlation coefficient and Spearman rank correlation coefficient.
[0045] Statistical test: Statistical tests are used to determine whether sample data supports a hypothesis. Common statistical tests include t-test, chi-square test, and ANOVA.
[0046] Regression Analysis: Regression analysis is used to model the relationship between independent and dependent variables.
[0047] Feature Importance Screening: Feature importance screening is used to identify the features that have the greatest impact on model predictions. Tree models such as random forests can be used to assess feature importance.
[0048] Autocorrelation Analysis: Autocorrelation analysis is used to evaluate the correlation between current values and their past values in time series data.
[0049] Partial autocorrelation analysis: Partial autocorrelation analysis is used to evaluate the direct correlation between current values and past values, removing the influence of intermediate values.
[0050] Granger causality analysis: Granger causality analysis is used to determine whether one time series has predictive power for another time series.
[0051] Normalization: Normalization is a technique in data preprocessing, usually used to scale different features of data to the same range to make the data more comparable. In machine learning and data analysis, normalization can improve the training efficiency and prediction performance of the model.
[0052] VARIMA (Vector Autoregressive Integrated Moving Average): VARIMA is an extended time series model used to capture dependencies in multivariate time series data. It combines the characteristics of the Vector Autoregressive (VAR) model and the ARIMA model. The VARIMA model is particularly suitable for analyzing and predicting multivariate time series, and it can handle the interdependence and dynamic relationships between multiple time series.
[0053] Long Short-Term Memory (LSTM): LSTM is a special type of recurrent neural network (RNN) suitable for processing and predicting time series data. The forget gate determines which information will be discarded. It uses a sigmoid activation function to output a value between 0 and 1, indicating the degree of retention of each information. The input gate determines which new information will be stored in the cell state. It consists of two parts: a sigmoid activation function that determines which values will be updated, and a tanh activation function that generates new candidate values. The output gate determines which parts of the current cell state will be output to the next layer. It also uses a sigmoid activation function to control the output.
[0054] The self-attention mechanism is used to enhance the model's attention to important parts of the input data and is widely used in natural language processing and time series prediction. The input vector is the basis of the self-attention mechanism and is usually an embedded representation of a sequence. The query vector Q is generated from the input vector X through a linear transformation and is used to calculate the correlation with other input elements. The key vector K is also generated from the input vector X through a linear transformation. The value vector V is also generated from the input vector X through a linear transformation and contains information related to the query and the key. The attention weight is obtained by calculating the similarity between the query vector and the key vector (usually using the dot product). It is then normalized by the softmax function. The output vector is obtained by multiplying the attention weight with the value vector, representing the weighted sum of each element in the input sequence.
[0055] Gray Wolf Optimizer (GWO): GWO is an optimization algorithm based on swarm intelligence that simulates the hunting behavior of gray wolves.
[0056] Hyperparameters: In machine learning, hyperparameters are parameters that are set before model training, which are different from model parameters that are automatically learned during training (such as weights in linear regression). Hyperparameters have a significant impact on the performance of the model and the training process, and need to be tuned to select the best value.
[0057] There are many factors that affect the amount of coal imports. For example, foreign scholars believe that the price difference between coal at home and abroad is the main reason for international coal trade. In addition, gross domestic product (GDP) and its growth rate, oil and natural gas production, coal mining costs, international political environment, exchange rate fluctuations, domestic actual economic development needs, coal transportation costs, and whether mining technology is advanced or not are all factors that affect coal import trade. Existing methods for screening influencing factors for prediction mainly include correlation analysis, statistical tests, regression analysis, and feature importance screening. The research method of using influencing factors to predict coal imports is similar to the method of predicting indicators such as passenger and freight volume and demand. Domestic and foreign scholars mostly use time series-based prediction methods and machine learning methods to predict related indicators such as passenger and freight volume and demand.
[0058] The prediction of coal import volume in the prior art mainly includes two steps: screening prediction variables and making predictions based on the screened variables. Among them, screening prediction variables includes evaluating the correlation between two variables based on the Pearson correlation coefficient and the Spearman correlation coefficient, exploring the significant differences between the average values of multiple samples based on t-test, variance analysis, etc., iteratively adding or deleting white energy to select the variables that contribute most to the prediction by stepwise regression, and using machine learning such as decision tree methods to evaluate the importance score of variables to screen variables. Prediction research based on the screened variables includes prediction methods based on time series and machine learning methods to predict relevant indicators such as coal import volume. As scholars gradually realize that various models have their own unique advantages, a large number of combined prediction methods have emerged in recent years to integrate multiple models, such as combining multiple statistical learning models or combining statistical learning and machine learning models.
[0059] However, the existing technology ignores the analysis of the time correlation of the time series of the research object when analyzing the influencing factors of time series. In terms of influencing factor screening, although there are a wide range of influencing factor screening methods for the selection of coal import volume time series prediction features, methods such as correlation analysis, regression analysis, and decision tree models can usually only know whether there is a connection between variables, but cannot determine the direction and causality of this connection. Moreover, many methods such as correlation analysis and ordinary regression analysis usually ignore the lag effect in time series data and cannot make full use of the time dependence of variables for prediction. Although there are also some methods such as decision tree models and random forests that can process multivariate data, they are mainly used for variable selection and modeling, and cannot specifically deal with causal relationships in time series data. Faced with a large number of complex market influencing factors, it is crucial to screen out variables that have predictive capabilities for coal imports. Existing prediction models have limitations when dealing with multivariate and multi-dimensional data. For example, traditional time series models perform poorly when faced with nonlinear relationships and high-dimensional data, and more complex models, although they have advantages in dealing with nonlinearity and long-term dependence, have poor interpretability of results and it is difficult to clarify the specific impact mechanism of each factor. Although scholars have proposed many combined prediction problems for optimizing hyperparameters, how to design a complete and effective framework, from screening features with predictive capabilities to developing a reasonable combined prediction framework to integrating the features of each model, and finally verifying all aspects of the model to form a systematic scientific research method, is still a problem that should be explored in depth.
[0060] In order to solve the problems of unclear description of coal time series correlation, unreasonable screening of factors affecting coal import volume, and inaccurate coal import volume prediction model in the prior art, this application forms a scientific and complete system from time autocorrelation analysis, screening of influencing factors to the prediction of coal import volume, and provides a combined prediction method for coal import volume that takes into account complex market factors. It can not only screen out complex domestic and foreign market factors that have time series prediction capabilities for coal, but also build a combined model based on the combination of statistical learning, deep learning models, and parameter optimization algorithms, and finally achieve accurate prediction of coal import volume. The method provided by this application will be described in detail below through specific embodiments.
[0061] Embodiment 1:
[0062] Figure 1 The following is a flow chart of a method for predicting coal import volume provided by an embodiment of the present application. The method for predicting coal import volume provided by this embodiment can be applied to electronic devices with communication, computing and data storage capabilities. Figure 1 As shown, the coal import volume prediction method provided in this embodiment may include:
[0063] S101. Obtain historical data on coal import volume.
[0064] In this embodiment, the pre-stored historical data of coal import volume can be obtained from the storage device, or the historical data of coal import volume can be crawled in real time by crawler software. The historical data may include, for example, the historical import volume data of the past five years, and specifically may include the historical import volume of each month and the historical import volume of each year in the past five years.
[0065] S102. Use autocorrelation analysis and partial autocorrelation analysis to obtain the time series characteristics of coal import volume from the historical data of coal import volume.
[0066] In this embodiment, autocorrelation analysis and partial autocorrelation analysis are used to obtain the time series characteristics of coal import volume from the historical data of coal import volume, which may specifically include: using the autocorrelation function to determine the correlation between the coal import volume time series at different lag periods; using the partial autocorrelation function to determine the correlation between the coal import volume time series at each lag period.
[0067] It can be understood that the use of autocorrelation analysis and partial autocorrelation analysis can reveal the patterns and structures in the coal import volume time series data, help understand the inherent characteristics and relationships of coal import volume, and then build an appropriate time series model. The autocorrelation function (ACF) is used to determine the correlation between the coal import volume time series at different lag periods, revealing the periodicity and pattern of coal import volume. The value of the autocorrelation function is between [-1, 1], reflecting the degree of correlation between values at different periods. For the time series X t , its autocorrelation function ρ l Defined as:
[0068]
[0069] In the formula, ρ k represents the autocorrelation coefficient of lag k; X t is the value of the time series at time t; is the mean of the time series, and n is the length of the time series.
[0070] Partial autocorrelation is used to measure the pure correlation of the coal import volume time series at lag k, that is, the correlation excluding the influence of other lag periods. The partial autocorrelation function (PACF) is used to determine the pure correlation of each lag period in the coal import volume forecast, so as to determine how many lag terms are reasonable to introduce into the model. By analyzing the partial autocorrelation function graph (PACF graph), it is identified at what lag period the correlation begins to drop significantly, so as to determine the appropriate model order, and the Yule-Walker equation is used to estimate the partial autocorrelation coefficient of the model, which is defined as follows:
[0071]
[0072] S103. Granger causality analysis is used to screen the time series characteristics of coal import volume, and target features with predictive capabilities for coal import volume are screened out.
[0073] In this embodiment, the time series characteristics of coal import volume are screened by Granger causality analysis, which may specifically include: constructing a regression model including a lag term of coal import volume and a lag term of time series characteristics; when the performance of the regression model including the lag term of time series characteristics is better than that of the regression model not including the lag term of the time series characteristics, determining the time series characteristics as the target characteristics.
[0074] Granger causality test is used to determine whether the time series of complex market factors can be used to predict coal imports, thereby verifying whether there is a causal relationship between complex market factors and coal imports. Assuming time series X (such as domestic market coal prices) and Y (coal imports), first establish a regression model containing Y's own lag term and X's lag term:
[0075]
[0076] Where Y i-1 represents the lag term of Y, X t-j represents the lag term of X, ∈ t is the error term vector, α0 represents the constant term, α i and β j Represent the coefficients of the lag term of Y and the lag term of X. Use the F test to compare the model containing the lag term of X and the model without the lag term of X. If the model containing the lag term of X is significantly better than the model without it, then X is considered to be the Granger cause of Y.
[0077] S104. Training the coal import volume prediction model based on the target features to obtain a trained coal import volume prediction model.
[0078] The coal import volume prediction model in this embodiment can be a combination of the multivariate time series prediction statistical learning model VARIMA and the time series deep learning prediction model LSTM, and a self-attention mechanism is added to adjust the weight of each time step of LSTM to build a combined prediction framework.
[0079] S105. Predict the coal import volume according to the trained coal import volume prediction model.
[0080] After obtaining the trained coal import volume prediction model, the coal import volume can be predicted based on the trained coal import volume prediction model.
[0081] The coal import volume prediction method provided in this embodiment obtains historical data of coal import volume; uses autocorrelation analysis and partial autocorrelation analysis to obtain the time series characteristics of coal import volume from the historical data of coal import volume; performs feature screening on the time series characteristics of coal import volume through Granger causality analysis to screen out target features with prediction capabilities for coal import volume; trains a coal import volume prediction model based on the target features to obtain a trained coal import volume prediction model; and predicts coal import volume based on the trained coal import volume prediction model. The time correlation of the coal import volume time series data is fully utilized to improve the accuracy of coal import volume prediction.
[0082] Embodiment 2:
[0083] Based on the above embodiment, how to obtain a trained coal import volume prediction model will be further described in detail below.
[0084] The coal import volume prediction model in this embodiment can be constructed based on the vector autoregression integral moving average model and the long short-term memory model, and the weight of each time step of the long short-term memory model is adjusted by the self-attention mechanism. Alternatively, the coal import volume prediction model can also be constructed based on the vector autoregression integral moving average model and the gated recurrent unit model. GRU has fewer parameters than LSTM, so the training and prediction speed is usually faster. For resource-constrained systems or applications that require real-time prediction, GRU may be more suitable. Because the GRU model has fewer parameters, it usually requires less memory. In devices or environments with limited memory, using GRU can reduce memory usage and improve system efficiency. However, in some specific tasks, the performance of LSTM is significantly better than GRU. For example, in the time series prediction of coal import volume that requires very accurate prediction, LSTM may provide better prediction accuracy, so that enterprises can grasp the dynamic changes in the market. That is to say, when pursuing higher speed, the coal import volume prediction model is constructed based on the vector autoregression integral moving average model and the gated recurrent unit model; when pursuing higher prediction accuracy, the coal import volume prediction model is constructed based on the vector autoregression integral moving average model and the long short-term memory model.
[0085] Furthermore, in the process of training the coal import volume prediction model, the gray wolf optimization algorithm can be used to adjust the hyperparameters of the coal import volume prediction model so as to obtain the weights of the model corresponding to the best prediction performance, wherein the hyperparameters include the number of hidden layer units, the learning rate, the batch size and the number of training rounds. Optionally, a genetic algorithm, a particle swarm optimization algorithm or a simulated annealing algorithm can also be used to adjust the hyperparameters of the coal import volume prediction model during the training process.
[0086] The gray wolf optimization algorithm is used to adjust the hyperparameters of the coal import volume prediction model during the training process. Specifically, it includes three stages: searching for prey, surrounding prey, and attacking prey. In the gray wolf optimization algorithm, gray wolves are divided into four levels: α wolf, β wolf, δ wolf, and ω wolf. α wolf is the leader, β wolf and δ wolf assist δ wolf in making decisions, and ω wolf follows other gray wolves. The algorithm updates the position of the wolf pack and searches for the global optimal solution by simulating the behavior of gray wolves encircling prey. The main steps are as follows:
[0087] 1. Initialize the positions of the gray wolf group (i.e., the hyperparameter settings of each individual), including the positions of α wolf, β wolf, δ wolf, and ω wolf. Usually, the positions are randomly generated, corresponding to the current best, second best, and third best solutions, respectively.
[0088] 2. Calculate the fitness value corresponding to the position of each gray wolf (such as the Attention-LSTM performance on the validation set), and determine the α wolf, β wolf, and δ wolf based on the fitness value.
[0089] 3. Update the positions of other gray wolves based on the positions of α wolf, β wolf, and δ wolf.
[0090] 4. Repeat the fitness evaluation and position update steps until the termination condition is met (such as reaching the maximum number of iterations or meeting the preset accuracy).
[0091] The position update is based on the following formula:
[0092]
[0093] in, Indicates the current position of the gray wolf. and Respectively represent the positions of α wolf, β wolf, and δ wolf, and is a random vector. Further update position:
[0094]
[0095]
[0096] in, and is also a random variable. and The update formula is as follows:
[0097]
[0098] in, It decreases linearly from 2 to 0. is a random variable in [0,1].
[0099] After obtaining the optimal hyperparameters, it means that the combined prediction model has the weights corresponding to the best prediction performance. At this point, the combined prediction model has been constructed and the task of predicting coal import volume can be carried out.
[0100] Embodiment three:
[0101] Another embodiment of the present application relates to a coal import volume prediction device. The implementation details of the coal import volume prediction device of this embodiment are specifically described below. The following content is only for the convenience of understanding the implementation details provided, and is not necessary for the implementation of this solution. The schematic diagram of the coal import volume prediction device of this embodiment can be as follows Figure 2 As shown, it includes: an acquisition module 201, an analysis module 202, a screening module 203, a training module 204 and a prediction module 205.
[0102] At least one embodiment of the present application further provides a coal import volume prediction device, comprising:
[0103] An acquisition module 201 is used to acquire historical data of coal import volume;
[0104] An analysis module 202 is used to obtain time series characteristics of coal import volume from historical data of coal import volume by using autocorrelation analysis and partial autocorrelation analysis;
[0105] A screening module 203 is used to screen the time series characteristics of coal import volume through Granger causality analysis, and screen out target characteristics that have the ability to predict coal import volume;
[0106] A training module 204 is used to train the coal import volume prediction model based on the target features to obtain a trained coal import volume prediction model;
[0107] The prediction module 205 is used to predict the coal import volume according to the trained coal import volume prediction model.
[0108] The device of this embodiment can be used to perform Figure 1 The technical solution of the method embodiment shown has similar implementation principles and technical effects, which will not be repeated here.
[0109] In some optional implementations, the analysis module 202 is used to obtain the time series characteristics of the coal import volume from the historical data of the coal import volume by using autocorrelation analysis and partial autocorrelation analysis, which may specifically include:
[0110] The autocorrelation function is used to determine the correlation between the coal import volume time series at different lags;
[0111] The partial autocorrelation function is used to determine the correlation of each lag period of the coal import volume time series.
[0112] In some optional implementations, the screening module 203 is used to screen the time series characteristics of coal import volume through Granger causality analysis, which may specifically include:
[0113] Construct a regression model including the lag term of coal import volume and the lag term of time series characteristics;
[0114] When the performance of a regression model including a lag term of a time series feature is better than that of a regression model not including the lag term of the time series feature, the time series feature is determined as a target feature.
[0115] In some optional embodiments, the coal import volume prediction device may further include a first adjustment module (not shown in the figure), which is used to adjust the hyperparameters of the coal import volume prediction model during the training process using the Grey Wolf Optimization Algorithm, and the hyperparameters include the number of hidden layer units, learning rate, batch size and number of training rounds.
[0116] In some optional embodiments, the coal import volume prediction device may further include a second adjustment module (not shown in the figure) for adjusting the hyperparameters of the coal import volume prediction model during the training process using a genetic algorithm, a particle swarm optimization algorithm or a simulated annealing algorithm.
[0117] In some optional implementations, the coal import volume prediction model is constructed based on a vector autoregression integrated moving average model and a long short-term memory model, and the weight of each time step of the long short-term memory model is adjusted using a self-attention mechanism.
[0118] In some optional implementations, the coal import volume prediction model is constructed based on a vector autoregression integrated moving average model and a gated recurrent unit model.
[0119] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.
[0120] Embodiment 4:
[0121] Another embodiment of the present application relates to an electronic device, such as Figure 3 As shown, it includes: at least one processor 301; and a memory 302 that is communicatively connected to the at least one processor 301; wherein the memory 302 stores instructions that can be executed by the at least one processor 301, and the instructions are executed by the at least one processor 301 so that the at least one processor 301 can execute the coal import volume prediction method in the above-mentioned embodiments.
[0122] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor.
[0123] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory can be used to store data used by the processor when performing operations. The processor can include, but is not limited to, for example, one or more processors or microprocessors. Each processor can be an application specific integrated circuit (Application Specific Integrated Circuit, referred to as ASIC), a digital signal processor (Digital Signal Processor, referred to as DSP), a digital signal processing device (Digital Signal Processing Device, referred to as DSPD), a programmable logic device (Programmable Logic Device, referred to as PLD), a field programmable gate array (Field Programmable Gate Array, referred to as FPGA), a controller, a microcontroller, a microprocessor or other electronic components to implement the method in the above embodiment.
[0124] Embodiment five:
[0125] Based on the above embodiments, this embodiment provides a specific application example.
[0126] The present application provides a combined forecasting method for coal import volume that takes into account complex market factors, collects information about the coal market from multiple data sources, and constructs a combined forecasting model that takes into account complex market factors. Specifically, the following steps may be included:
[0127] Step 1: Use autocorrelation analysis and partial autocorrelation analysis to reveal the time series characteristics of coal imports.
[0128] Step 2: Use Granger causality test to screen out market factors that have the ability to predict coal import volume.
[0129] Step 3: Combine the multivariate time series prediction statistical learning model VARIMA with the time series deep learning prediction model LSTM, add a self-attention mechanism to adjust the weight of each time step of LSTM, and build a combined prediction framework.
[0130] Step 4: Use the Gray Wolf Optimization Algorithm to determine the optimal hyperparameter combination of the model during the training process to obtain the best model combination prediction model, and ultimately achieve accurate prediction of coal import volume.
[0131] The process of the combined forecasting method of coal import volume considering complex market factors proposed in this application is as follows: Figure 4 Each step will be described in detail below.
[0132] Step 1 may specifically include:
[0133] Autocorrelation analysis and partial autocorrelation analysis are used to reveal the patterns and structures in the coal import volume time series data, which helps to understand the inherent characteristics and relationships of coal import volume and then build an appropriate time series model. The autocorrelation function (ACF) is used to determine the correlation between the coal import volume time series at different lag periods, revealing the periodicity and pattern of coal import volume. The value of the autocorrelation function is between [-1, 1], reflecting the degree of correlation between values in different periods. For the time series X t , its autocorrelation function ρ k Defined as:
[0134]
[0135] In the formula, ρ k represents the autocorrelation coefficient of lag k; X t is the value of the time series at time t; is the mean of the time series, and n is the length of the time series.
[0136] Partial autocorrelation is used to measure the pure correlation of the coal import volume time series at lag k, that is, the correlation excluding the influence of other lag periods. The partial autocorrelation function (PACF) is used to determine the pure correlation of each lag period in the coal import volume forecast, so as to determine how many lag terms are reasonable to introduce into the model. By analyzing the partial autocorrelation function graph (PACF graph), it is identified at what lag period the correlation begins to drop significantly, so as to determine the appropriate model order, and the Yule-Walker equation is used to estimate the partial autocorrelation coefficient of the model, which is defined as follows:
[0137]
[0138] Step 2 may specifically include:
[0139] Granger causality test is used to determine whether the time series of complex market factors can be used to predict coal imports, thereby verifying whether there is a causal relationship between complex market factors and coal imports. Assuming time series X (such as domestic market coal prices) and Y (coal imports), first establish a regression model containing Y's own lag term and X's lag term:
[0140]
[0141] Where Y i-1 represents the lag term of Y, Xt-j represents the lag term of X, ∈ t is the error term vector, α0 represents the constant term, α i and β j Represent the coefficients of the lag term of Y and the lag term of X. Use the F test to compare the model containing the lag term of X and the model without the lag term of X. If the model containing the lag term of X is significantly better than the model without it, then X is considered to be the Granger cause of Y.
[0142] Step 3 may specifically include:
[0143] 1. Construct a VARIMA model as part of a combined framework.
[0144] As a multivariate time series model, the VARIMA model combines the characteristics of vector autoregression (VAR) and autoregressive integrated moving average (ARIMA). It is used for data sets with multiple related time series and can be used to model and predict the relationship between these time series. The coal import volume time series and the time series of multiple complex market factors are regarded as a system, in which the current value of each time series can be predicted by its own lagged value and the current value of other time series and their lagged values. For a system containing k variables, its VAR model form is:
[0145] Y t =A1y t-1 +A2y t-2 +…+A p y t-p +∈ t
[0146] Where Y t is a vector of k variables, representing the observed values at time t, while A1, A2, …, A p is a k×k coefficient matrix, ∈ t is the error term vector, assuming a Gaussian white noise process.
[0147] The ARIMA model is used for univariate time series modeling. Its form is:
[0148] Δ d y t =φ1Δ d y t-1 +φ2Δ d y t-2 +…+φ p Δ d y p-1 +θ1∈ t-1 +θ2∈ t-2 +…+θ q ∈ t-q +∈t
[0149] In the formula, Δ d represents the difference operation, which is used to make the time series stationary. i and θ j are the coefficients of the autoregressive and moving average parts respectively. ∈ t is the error term vector, assuming a Gaussian white noise process.
[0150] The VARIMA model is used to combine VAR and ARIMA to jointly model the coal import volume and the time series of multiple complex market factors.
[0151] Δ d Y t =A1Δ d Y t-1 +A2Δ d Y t-2 +…+A p Δ d Y p-1 +B1∈ t-1 +B2∈ t-2 +…+B q ∈ t-q +∈ t
[0152] In the formula, Δ d It means that each time series variable including coal import volume is differentiated to make it stable. i and B j Is a coefficient matrix, representing the coefficients of the autoregressive and moving average parts. ∈ t is the error term vector, assuming a Gaussian white noise process.
[0153] 2. Combine the Self-Attention mechanism and LSTM model as another part of the combined framework
[0154] First, LSTM is used to capture the dependencies in the time series data of coal import volume and influencing factors. The core of LSTM lies in its unique structure, which contains three gates (input gate, forget gate and output gate) and a cell state. Its forward propagation method is as follows:
[0155] f t =σ(W f [h t-1 , x t ]+b f )
[0156] i t =σ(W i [h t-1 , x t ]+bi
[0157]
[0158] o t =σ(W o [h t-1 , x t ]+b o )
[0159] h t =o t tanh(C t )
[0160] The forget gate determines how much of the cell state at the previous moment needs to be forgotten, t is the activation value of the forget gate, W f is the weight matrix of the forget gate, [h t-1 , x t ] refers to the previous hidden state h t-1 and the current input x t splicing, b f is the bias term of the forget gate. The input gate determines the impact of the current input on the cell state. The input gate consists of two parts: one determines the value of the update part, and the other determines the proportion of the update part. t is the activation value of the input gate, is the candidate cell state value, W i and W C is the corresponding weight matrix, b C and b i is the bias term. The cell state is updated according to the results of the forget gate and the input gate, C t is the updated cell state, C t-1 is the cell state of the previous state. The output gate determines the impact of the current cell state on the hidden state and generates output, o t The activation value of the output gate, h t is the hidden state (output) of the current state, W o is the weight matrix of the output gate, b o is the bias term.
[0161] The self-attention mechanism is a way to achieve information autocorrelation in neural networks. It calculates the correlation between input information and weights the importance of input data. In the prediction of coal import volume, the self-attention mechanism is used to dynamically adjust the output of LSTM according to the importance of different positions in the hidden state sequence of the input coal import volume output, which helps the combined prediction model to more effectively capture the key information in the input sequence and improve its performance in sequence modeling tasks. The calculation process is shown below.
[0162] h*(W Q , W K , W V )=(Q,K,V)
[0163]
[0164] W A =softmax(S(Q,K))
[0165] O=W A V
[0166] Where h represents the tensor concatenated from the output of each step of LSTM, {W Q , W K , W V} represents the weights for generating the query vector Q, the key vector K, and the value vector V, S(Q, K) represents the cosine similarity between the query vector Q and the key vector K, and W A represents the attention weight after the softmax operation, and O represents the output after the attention weight is adjusted.
[0167] 3. Combine the VARIMA part with the Attention-LSTM part output
[0168] Combining the VARIMA part with Attention-LSTM in an output-weighted manner, the formula is as follows:
[0169] y=W VARIMA y VARIMA +W SAL y SAL
[0170] In the formula, y represents the weighted output, y VARIMA and SAL Represents the output of the VARIMA part and the Attention-LSTM part, W VARIMA and W SAL Represent the weights of the results of the VARIMA part and the Attention-LSTM part respectively.
[0171] Step 4 may specifically include:
[0172] The hyperparameters of the Attention-LSTM part are adjusted during the training process based on the Gray Wolf Optimization Algorithm, including the number of hidden layer units, learning rate, batch size, and number of training rounds. The Gray Wolf Optimization Algorithm is a swarm intelligence optimization algorithm based on the social behavior of gray wolves. The algorithm simulates the hunting behavior of gray wolves in nature and is mainly divided into three stages: searching for prey, surrounding prey, and attacking prey.
[0173] In the gray wolf optimization algorithm, gray wolves are divided into four levels: α wolf, β wolf, δ wolf and ω wolf. α wolf is the leader, β wolf and δ wolf assist δ wolf in making decisions, and ω wolf follows other gray wolves. The algorithm updates the position of the wolf pack and finds the global optimal solution by simulating the behavior of gray wolves encircling prey. The main steps are as follows:
[0174] 1: Initialize the positions of the gray wolf group (i.e., the hyperparameter settings of each individual), including the positions of α wolf, β wolf, δ wolf, and ω wolf. Usually, the positions are randomly generated, corresponding to the current best, second best, and third best solutions, respectively.
[0175] 2: Calculate the fitness value corresponding to the position of each gray wolf (such as the Attention-LSTM performance on the validation set), and determine the α wolf, β wolf, and δ wolf based on the fitness value.
[0176] 3: Update the positions of other gray wolves based on the positions of α wolf, β wolf, and δ wolf.
[0177] 4: Repeat the fitness evaluation and position update steps until the termination condition is met (such as reaching the maximum number of iterations or meeting the preset accuracy).
[0178] The position update is based on the following formula:
[0179]
[0180] in, Indicates the current position of the gray wolf. and Respectively represent the positions of α wolf, β wolf, and δ wolf, and is a random vector. Further update position:
[0181]
[0182] in, and is also a random variable. and The update formula is as follows:
[0183]
[0184] in, It decreases linearly from 2 to 0. is a random variable in [0, 1].
[0185] After obtaining the optimal hyperparameters, it means that the combined prediction model has the weights corresponding to the best prediction performance. At this point, the combined prediction model has been constructed and the task of predicting coal import volume can be carried out.
[0186] In summary, the coal import volume prediction method provided in the present application screens and integrates the multi-source factors that affect the coal import volume time series from the complex market, specifically applies autocorrelation analysis and partial autocorrelation analysis to reveal the time series characteristics of coal import volume, and screens out market factors with predictive ability for coal import volume through Granger causality test; builds a reasonable and effective coal import volume prediction model and finds the optimal hyperparameters to achieve the highest prediction accuracy, specifically a prediction model VARIMA-Attention-LSTM-GWO constructed based on VARIMA, self-attention mechanism, LSTM and Grey Wolf Optimization Algorithm; thereby mastering the temporal autocorrelation of coal import volume and knowing the factors affecting its predictive ability, and realizing accurate prediction of coal import volume based on the screened complex market influencing factors and advanced and reasonable combination models.
[0187] On the basis of the above embodiment, in order to further improve the prediction speed of coal import volume, the gated recurrent unit (GRU) can also be used to replace LSTM for prediction. GRU is a variant structure of LSTM. Although the performance of GRU and LSTM is similar in many tasks, GRU has fewer parameters than LSTM, so the training and prediction speed is usually faster. For resource-constrained systems or applications that require real-time prediction, GRU may be more suitable. Since the GRU model has fewer parameters, it usually requires less memory. In devices or environments with limited memory, using GRU can reduce memory usage and improve system efficiency. However, in some specific tasks, the performance of LSTM is significantly better than GRU. For example, in the time series prediction of coal import volume that requires very precise prediction, LSTM may provide better prediction accuracy, so that enterprises can grasp the dynamic changes in the market.
[0188] It should be noted that the Grey Wolf Optimization Algorithm GWO can also be replaced by a genetic algorithm, a particle swarm optimization algorithm, or a simulated annealing algorithm. These optimization algorithms are all based on group search methods, that is, they explore the search space through a set of candidate solutions (individuals, particles, ants, etc.), which interact with each other during the search process and jointly find the optimal solution. In addition, these algorithms have global search capabilities, aiming to avoid local optimal solutions and find global optimal solutions. Specifically, a VARIMA-Attention-GRU-SSA prediction framework can be constructed. SSA uses foraging behavior and vigilance mechanisms to converge to the global optimal solution more quickly. Compared with GWO, SSA may find a better solution in fewer iterations. However, GWO is superior to the SSA method in terms of algorithm maturity, implementation simplicity, and parameter stability.
[0189] Embodiment six:
[0190] Another embodiment of the present application relates to a computer-readable storage medium storing a computer program. The computer program is executed by the processor to implement the above method embodiment. That is, those skilled in the art can understand that all or part of the steps in the above method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as: ROM), random access memory (Random Access Memory, referred to as: RAM), disk or optical disk and other media that can store program code.
[0191] The computer-readable storage medium may also store at least one computer executable program / instruction, which may be, for example, a computer-readable instruction. The computer-readable storage medium includes, but is not limited to, for example, a volatile memory and / or a non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The computer-readable storage medium may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device runs the computer-readable instructions stored on the computer-readable storage medium, the various methods described above may be performed.
[0192] In addition, the computer device may also include (but not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (eg, keyboard, mouse, speaker, etc.), etc.
[0193] The processor may communicate with external devices via an I / O bus via a wired or wireless network.
[0194] In one embodiment, the at least one computer executable instruction may also be compiled into or constitute a software product / computer program product, wherein one or more computer executable instructions are executed by a processor to perform the various functions and / or method steps in the embodiments described in the present technology.
[0195] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
[0196] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0197] It should be noted that in the present disclosure, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element limited by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0198] Although the embodiments disclosed in the present disclosure are as above, the above contents are only embodiments adopted for facilitating the understanding of the present disclosure and are not intended to limit the present disclosure. Any technician in the technical field to which the present disclosure belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present disclosure, but the scope of patent protection of the present disclosure shall still be subject to the scope defined in the attached claims.
Claims
1. A method for predicting coal import volume, characterized in that: include: Get historical data on coal imports; Using autocorrelation analysis and partial autocorrelation analysis to obtain the time series characteristics of coal import volume from the historical data of coal import volume; The time series characteristics of the coal import volume are screened by Granger causality analysis to select target characteristics that have the ability to predict the coal import volume; Training a coal import volume prediction model based on the target features to obtain a trained coal import volume prediction model; The coal import volume is predicted according to the trained coal import volume prediction model.
2. The method according to claim 1, characterized in that: The method of using autocorrelation analysis and partial autocorrelation analysis to obtain the time series characteristics of the coal import volume from the historical data of the coal import volume includes: The autocorrelation function is used to determine the correlation between the coal import volume time series at different lags; The partial autocorrelation function is used to determine the correlation of each lag period of the coal import volume time series.
3. The method according to claim 1, characterized in that The feature screening of the time series characteristics of the coal import volume by Granger causality analysis includes: Construct a regression model including the lag term of coal import volume and the lag term of time series characteristics; When the performance of a regression model including a lag term of a time series feature is better than that of a regression model not including the lag term of the time series feature, the time series feature is determined as a target feature.
4. The method according to claim 1, characterized in that: The method further comprises: The Grey Wolf Optimization Algorithm is used to adjust the hyperparameters of the coal import volume prediction model during the training process, and the hyperparameters include the number of hidden layer units, learning rate, batch size and number of training rounds.
5. The method according to claim 1, characterized in that The method further comprises: A genetic algorithm, a particle swarm optimization algorithm or a simulated annealing algorithm is used to adjust the hyperparameters of the coal import volume prediction model during the training process.
6. The method according to any one of claims 1 to 5, characterized in that The coal import volume prediction model is constructed based on a vector autoregression integrated moving average model and a long short-term memory model. The weight of each time step of the long short-term memory model is adjusted using a self-attention mechanism.
7. The method according to any one of claims 1 to 5, characterized in that The coal import volume prediction model is constructed based on a vector autoregression integrated moving average model and a gated recurrent unit model.
8. A coal import volume prediction device, characterized in that: include: The acquisition module is used to obtain the historical data of coal import volume; An analysis module, for obtaining time series characteristics of coal import volume from the historical data of coal import volume by using autocorrelation analysis and partial autocorrelation analysis; A screening module, for screening the time series characteristics of the coal import volume through Granger causality analysis, and screening out target characteristics with predictive capabilities for the coal import volume; A training module, used for training the coal import volume prediction model based on the target features to obtain a trained coal import volume prediction model; The prediction module is used to predict the coal import volume according to the trained coal import volume prediction model.
9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the coal import quantity prediction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the coal import volume prediction method according to any one of claims 1 to 7 is implemented.