Method and device for predicting exchange rate of LSTM (Long Short Term Memory) network model based on wavelet transformation

By using a combination method of wavelet transform and LSTM network model in exchange rate prediction, the problem of low accuracy of exchange rate prediction in the prior art is solved, and more efficient exchange rate prediction is achieved, and prediction error is reduced.

CN119648403APending Publication Date: 2025-03-18AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411739028.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The prior art has a problem of low accuracy in exchange rate prediction. The feedforward neural network cannot effectively learn the correlation of foreign exchange rates as continuous data in time series, and it is highly dependent on the quality of the data set.

Method used

The LSTM network model based on wavelet transform is used to decompose the historical exchange rate data to reduce the non-stationary and nonlinear effects of the time series, and predict the decomposition sub-sequence through the LSTM network model, and finally obtain the exchange rate prediction data through wavelet transform synthesis.

Benefits of technology

It reduces exchange rate prediction errors, improves the accuracy of exchange rate prediction, and can learn and predict the non-stationary and non-linear characteristics of foreign exchange rates more effectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648403A_ABST
    Figure CN119648403A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an exchange rate prediction method and device of an LSTM network model based on wavelet transform, and is applied to the technical field of data processing. Performing normalization processing on the historical exchange rate data in the historical cycle time period to obtain historical exchange rate data; according to the non-stationary and non-linear characteristics of the foreign exchange rate, analyzing a time sequence of the normalized historical exchange rate data according to a wavelet transform expansion to obtain a plurality of decomposed subsequences, and reducing the influence of the non-stationary and non-linear characteristics of the time sequence of the historical exchange rate data on a prediction result; the LSTM network model obtains an initial prediction sequence based on the decomposed sub-sequence; and synthesizing the initial prediction sequence into a target prediction sequence according to a wavelet transform synthesis formula, and obtaining a prediction result, the target prediction sequence being exchange rate prediction data in the current period time period. Therefore, foreign exchange rate prediction is realized, exchange rate prediction errors are reduced, and exchange rate prediction accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and device for predicting exchange rates based on an LSTM network model based on wavelet transform. Background Art

[0002] Exchange rate is an important data in international financial and economic relations. Floating exchange rate dominates the world economic environment. The characteristics of exchange rate fluctuation are mainly due to the increase in frequency and scale. Analyzing the changes in exchange rates of international currencies can, to a certain extent, play an auxiliary role in related financial policies and help multinational companies avoid financial risks. Therefore, accurately predicting exchange rate price changes has become the focus of international financial markets.

[0003] Currently, deep learning and artificial intelligence are used to analyze historical exchange rate data in the international exchange rate market to predict exchange rates. Specifically,

[0004] Feedforward Neural Network (FNN) is used as a training model to learn the historical data of foreign exchange rates, so as to obtain a model and predict future foreign exchange rate changes. However, the information flow of the feedforward neural network can only be transmitted in a forward manner in the network, without feedback connection, and cannot effectively learn the correlation of foreign exchange rates as continuous data of time series. It has no memory, and the prediction results are highly random. In addition, the training data is simply input into the network for training. The data mode accepted by the network is single, and it is highly dependent on the quality of the data set. It can be seen that the existing technology has the problem of low exchange rate prediction accuracy. Summary of the invention

[0005] In view of this, the present application provides an exchange rate prediction method and device based on an LSTM network model based on wavelet transform, which decomposes the time series data of historical exchange rate data through wavelet transform, reduces the impact of the non-stationarity and nonlinearity of the time series on the LSTM network model, can predict non-stationary time series, reduce exchange rate prediction errors, and improve exchange rate prediction accuracy.

[0006] To solve the above problems, the technical solutions provided by this application are as follows:

[0007] In a first aspect, an embodiment of the present application provides an exchange rate prediction method based on an LSTM network model of wavelet transform, the exchange rate prediction method comprising:

[0008] Get historical exchange rate data between the first currency and the second currency during the historical period;

[0009] Normalizing the historical exchange rate data to obtain normalized historical exchange rate data;

[0010] Analyzing the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence;

[0011] Inputting the decomposed subsequence into a pre-built exchange rate prediction model to obtain an initial prediction sequence in the form of a decomposed subsequence output by the exchange rate prediction model, wherein the exchange rate prediction model is an LSTM network model;

[0012] The initial prediction sequence is synthesized into a target prediction sequence according to a wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data within the current cycle time period.

[0013] In a possible implementation, the exchange rate prediction model is trained by the following method:

[0014] Acquire an exchange rate training set and an exchange rate test set, wherein the exchange rate training set is historical exchange rate training data between a first currency and a second currency in a first continuous time period, and the exchange rate test set is historical exchange rate test data between the first currency and the second currency in a second continuous time period, wherein the second time period is a time period subsequent to the first time period;

[0015] Normalizing the exchange rate training set to obtain a normalized exchange rate training set;

[0016] Analyzing the normalized exchange rate training set using a wavelet transform expansion to obtain a training decomposition subsequence;

[0017] Inputting the training decomposition subsequence into the exchange rate prediction training model to obtain an initial prediction training sequence output by the exchange rate prediction training model;

[0018] The initial prediction training sequence is synthesized into a training prediction sequence according to a wavelet transform synthesis formula, wherein the training prediction sequence is exchange rate prediction data for a second time period;

[0019] Calculating a loss function based on the training prediction sequence and the exchange rate test set;

[0020] Optimizing the model parameters of the exchange rate prediction training model based on the loss function until the loss function converges;

[0021] The exchange rate prediction training model corresponding to the convergence of the loss function is used as the exchange rate prediction model.

[0022] In one possible implementation, before using the exchange rate prediction training model to process data, the method further includes:

[0023] Initialize the parameters of the exchange rate prediction training model.

[0024] In a possible implementation, the wavelet transform expansion is:

[0025]

[0026] Among them, CWT(a,b) is the transformation result of continuous wavelet transform under scale parameter a and translation parameter b, x(t) is the given time series signal, is the scale and translation version of the wavelet function, a is the scale parameter used to control the frequency of the wavelet function, and b is the translation parameter used to control the position of the wavelet function on the time axis;

[0027] The wavelet transform synthesis formula is:

[0028]

[0029] Among them, C ψ is the normalized coefficient of the wavelet function ψ(t).

[0030] In a possible implementation manner, the historical exchange rate data includes a closing price and a transaction price of the first currency against the second currency.

[0031] In a second aspect, an embodiment of the present application provides an exchange rate prediction device based on an LSTM network model of wavelet transform, the exchange rate prediction device comprising:

[0032] An acquisition module, used to acquire historical exchange rate data between a first currency and a second currency within a historical period;

[0033] A normalization module, used for normalizing the historical exchange rate data to obtain normalized historical exchange rate data;

[0034] A wavelet transform module, used to analyze the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence;

[0035] A prediction module, used for inputting the decomposed subsequence into a pre-built exchange rate prediction model to obtain an initial prediction sequence in the form of decomposed subsequences output by the exchange rate prediction model, wherein the exchange rate prediction model is an LSTM network model;

[0036] The wavelet transform module is further used to synthesize the initial prediction sequence into a target prediction sequence according to a wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data within the current cycle time period.

[0037] In one possible implementation, the device further includes a model training module;

[0038] The model training module is used to train the exchange rate prediction model, including:

[0039] an acquisition submodule, configured to acquire an exchange rate training set and an exchange rate test set, wherein the exchange rate training set is historical exchange rate training data between a first currency and a second currency in a first continuous time period, and the exchange rate test set is historical exchange rate test data between the first currency and the second currency in a second continuous time period, wherein the second time period is a time period subsequent to the first time period;

[0040] A normalization submodule, used for normalizing the exchange rate training set to obtain a normalized exchange rate training set;

[0041] A wavelet transform submodule, used to analyze the normalized exchange rate training set using a wavelet transform expansion to obtain a training decomposition subsequence;

[0042] A prediction submodule, used for inputting the training decomposition subsequence into the exchange rate prediction training model to obtain an initial prediction training sequence output by the exchange rate prediction training model;

[0043] The wavelet transform submodule is further used to synthesize the initial prediction training sequence into a training prediction sequence according to the wavelet transform synthesis formula, wherein the training prediction sequence is the exchange rate prediction data for the second time period;

[0044] A calculation submodule, used for calculating a loss function based on the training prediction sequence and the exchange rate test set;

[0045] A parameter optimization submodule, used for optimizing the model parameters of the exchange rate prediction training model based on the loss function until the loss function converges;

[0046] A submodule is determined, which is used to use the exchange rate prediction training model corresponding to the convergence of the loss function as the exchange rate prediction model.

[0047] In a possible implementation, before executing the prediction submodule, the device further includes:

[0048] The initialization module is used to initialize the parameters of the exchange rate prediction training model.

[0049] In a possible implementation, the wavelet transform expansion is:

[0050]

[0051] Among them, CWT(a,b) is the transformation result of continuous wavelet transform under scale parameter a and translation parameter b, x(t) is the given time series signal, is the scale and translation version of the wavelet function, a is the scale parameter used to control the frequency of the wavelet function, and b is the translation parameter used to control the position of the wavelet function on the time axis;

[0052] The wavelet transform synthesis formula is:

[0053]

[0054] Among them, C ψ is the normalized coefficient of the wavelet function ψ(t).

[0055] In a possible implementation manner, the historical exchange rate data includes a closing price and a transaction price of the first currency against the second currency.

[0056] In a third aspect, an embodiment of the present application provides an exchange rate prediction device based on an LSTM network model of wavelet transform, the device comprising: a processor, a memory, and a system bus;

[0057] The processor and the memory are connected via the system bus;

[0058] The memory is used to store one or more programs, and the one or more programs include instructions. When the instructions are executed by the processor, the processor executes the exchange rate prediction method based on the LSTM network model based on wavelet transform described in the first aspect above.

[0059] In a fourth aspect, an embodiment of the present application provides a storage medium storing instructions, which, when executed by a computer, enables the computer to implement the exchange rate prediction method based on the LSTM network model based on wavelet transform described in the first aspect above.

[0060] It can be seen that this application has the following beneficial effects:

[0061] The embodiment of the present application provides an exchange rate prediction method based on an LSTM network model of wavelet transform, firstly, the historical exchange rate data between the first currency and the second currency in the historical period time period is obtained, the historical exchange rate data is normalized, and the normalized historical exchange rate data is obtained; secondly, the normalized historical exchange rate data is analyzed by using the wavelet transform expansion formula to obtain a decomposition subsequence; finally, the decomposition subsequence is input into a pre-constructed exchange rate prediction model to obtain an initial prediction sequence in the form of a decomposition subsequence output by the exchange rate prediction model, and the exchange rate prediction model is an LSTM network model; the initial prediction sequence is synthesized into a target prediction sequence according to the wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data in the current period time period. In this way, according to the non-stationary and nonlinear characteristics of the foreign exchange rate, the time series of the historical exchange rate data is expanded according to the wavelet transform to obtain a number of decomposition subsequences, reduce the non-stationary and nonlinear effects of the time series of the historical exchange rate data on the prediction results, predict the decomposition subsequence through the LSTM deep learning network model, and combine the subsequence prediction results into a target prediction sequence through the wavelet transform to obtain the prediction results, realize the foreign exchange rate prediction, reduce the exchange rate prediction error, and improve the accuracy of the exchange rate prediction.

[0062] The embodiment of the present application also provides a device corresponding to the above method, which has the same beneficial effects as the above method. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are some implementation methods of the present invention, and for ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0064] Figure 1 A flow chart of an exchange rate prediction method based on an LSTM network model of wavelet transform provided in an embodiment of the present application;

[0065] Figure 2 A schematic diagram of a training process of an exchange rate prediction model provided in an embodiment of the present application;

[0066] Figure 3 A schematic diagram of a wavelet exchange and LSTM operation structure provided in an embodiment of the present application;

[0067] Figure 4 A schematic diagram of a recursive module in an LSTM network model provided in an embodiment of the present application;

[0068] Figure 5 A schematic diagram of another exchange rate prediction model training process provided in an embodiment of the present application;

[0069] Figure 6 A schematic diagram of the structure of an exchange rate prediction device based on an LSTM network model of wavelet transform provided in an embodiment of the present application;

[0070] Figure 7 A schematic diagram of the structure of an exchange rate prediction device based on an LSTM network model of wavelet transform provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0072] In this application, the terms "comprises", "comprising" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0073] The prior art patent CN112037063A proposes the generation and use of an exchange rate prediction model. The method for generating the exchange rate prediction model includes: after obtaining training data and the actual exchange rate corresponding to the training data, first inputting the training data into a feedforward neural network FNN to obtain a predicted exchange rate corresponding to the training data output by the neural network model; then updating the feedforward neural network model according to the difference between the actual exchange rate corresponding to the training data and the predicted exchange rate corresponding to the training data, and continuing training until a stop condition is reached, generating an exchange rate prediction model according to the neural network model, so that the exchange rate prediction model can accurately represent the nonlinear changes in the exchange rate, thereby making the predicted exchange rate predicted by the exchange rate prediction model more consistent with the actual change law of the exchange rate.

[0074] The aforementioned method uses a feedforward neural network FNN as a training model to learn the historical data of foreign exchange rates, thereby obtaining a model and predicting future foreign exchange rate changes. However, the information flow of the feedforward neural network can only be transmitted in a forward manner in the network, without feedback connection, and cannot effectively learn the correlation of foreign exchange rates as continuous data of time series. It has no memory and the prediction results are highly random. In addition, the training data is simply input into the network for training, and the data mode accepted by the network is single, which is highly dependent on the quality of the data set. It can be seen that the existing technology has the problem of low exchange rate prediction accuracy.

[0075] In summary, the embodiment of the present application provides an exchange rate prediction method and device based on the LSTM network model of wavelet transform, firstly, the historical exchange rate data between the first currency and the second currency in the historical period time period is obtained, and the historical exchange rate data is normalized to obtain the normalized historical exchange rate data; secondly, the normalized historical exchange rate data is analyzed by using the wavelet transform expansion formula to obtain the decomposition subsequence; finally, the decomposition subsequence is input into the pre-constructed exchange rate prediction model to obtain the initial prediction sequence in the form of the decomposition subsequence output by the exchange rate prediction model, and the exchange rate prediction model is the LSTM network model; the initial prediction sequence is synthesized into a target prediction sequence according to the wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data in the current period time period. In this way, according to the non-stationary and nonlinear characteristics of the foreign exchange rate, the time series of the historical exchange rate data is expanded according to the wavelet transform to obtain several decomposition subsequences, reduce the non-stationary and nonlinear effects of the time series of the historical exchange rate data on the prediction results, predict the decomposition subsequence through the LSTM deep learning network model, and combine the subsequence prediction results into the target prediction sequence through the wavelet transform to obtain the prediction results, realize the foreign exchange rate prediction, reduce the exchange rate prediction error, and improve the accuracy of the exchange rate prediction.

[0076] In order to facilitate understanding of the technical solution provided in the embodiment of the present application, the exchange rate prediction method and device based on the LSTM network model based on wavelet transform provided in the embodiment of the present application will be described below in conjunction with the accompanying drawings.

[0077] First, the terms used in the embodiments of the present application are explained.

[0078] Time series: In statistical research, a set of random variables X1, X2, ..., X1 are often arranged in time series. t To represent a time series of random events, abbreviated as {X t ,t∈T}. Use x1,x2,...,x t ,... represents the n ordered observations of the time series of the random event, which is called the observation sequence with a sequence length of n. tAlso called x1,x2,...,x t , an implementation of...

[0079] Foreign exchange rate: The rate at which one currency is exchanged for another. It represents the value of one currency relative to another in the international market. Foreign exchange rates are usually expressed as the rate at which one country's currency is exchanged for another country's currency, such as how many Japanese yen are exchanged for 1 US dollar. Foreign exchange rates can be used as a time series because they change over time.

[0080] Deep learning is a machine learning method that can mimic the structure and function of the human brain and learn and understand complex data through multi-layer neural networks. Deep learning can automatically learn features and patterns from data, and then use these features and patterns to perform tasks such as classification, recognition, and prediction. Deep learning has achieved great success in image recognition, time series prediction, natural language processing, and other fields.

[0081] Time series forecasting: It is to derive the future trend of the sequence by analyzing historical exchange rate data, which involves continuous forecasting (such as numerical forecasting, range estimation) and discrete forecasting (such as event forecasting).

[0082] Feedforward neural network is one of the most basic artificial neural network models and one of the most common models in deep learning. Its information flow can only be transmitted in the network in a forward manner, without feedback connection. Feedforward neural network consists of input layer, hidden layer (can have multiple) and output layer. The input layer receives the original input data, and the hidden layer and output layer pass the calculation results through layers. Each neuron receives the input from the previous layer, and after weighted summation, it is nonlinearly mapped through the activation function, and then the result is passed to the next layer.

[0083] Recurrent Neural Network (RNN) is a neural network model for processing sequence data. Unlike traditional feedforward neural networks, RNN has memory and recurrent connections, which enable it to better process data with temporal dependencies. The main feature of RNN is the introduction of recurrent connections between hidden layers, which allows the network to accept the output of the previous moment as the input of the current moment. This recurrent connection allows RNN to keep a memory of previous information when processing sequence data and incorporate this information into the current calculation.

[0084] Long Short-Term Memory Neural Networks (LSTM) is a type of RNN, which is gradually improved on the basis of RNN. It is the basis of many deep learning models today, and learning sequence dependencies is one of its important properties.

[0085] Wavelet Transform (WT) is a signal processing technique that can decompose a signal into components of different scales, thereby simultaneously capturing the time and frequency characteristics of the signal. Wavelet transform can help understand the local characteristics of a signal, analyze non-stationary signals, and has a wide range of applications in compression and denoising. Wavelet transform has important applications in signal processing, image processing, financial analysis, and other fields.

[0086] Random noise refers to the random fluctuations in time series that are irregular and difficult to predict. Random noise usually represents random errors or unpredictable changes in data and does not contain any systematic patterns. Random noise may interfere with the results of time series analysis and reduce the accuracy of predictions. Therefore, when conducting time series analysis, it is necessary to consider how to deal with random noise to improve the effectiveness of the analysis.

[0087] The stationarity of a time series refers to the fact that the statistical characteristics of the series remain unchanged over time. Strong stationarity requires that the mean, variance, and autocorrelation function of the series remain unchanged over time; weak stationarity requires that the mean and autocorrelation function of the series remain unchanged over time. Stationarity is one of the prerequisites for time series analysis. Stationary series are easier to build models, make predictions, and perform statistical inferences, so stationarity is usually an important assumption in time series analysis.

[0088] See also Figure 1 , Figure 1 A flow chart of a method for predicting exchange rates based on an LSTM network model of wavelet transform provided in an embodiment of the present application. The method for predicting exchange rates based on an LSTM network model of wavelet transform can be applied to a server or system, which is not limited in the embodiment of the present application and can be selected according to actual needs. The method specifically includes S101-S105.

[0089] S101: Acquire historical exchange rate data between a first currency and a second currency within a historical period.

[0090] Foreign exchange rates change every trading day, and the exchange rate changes are generally recorded in the database to form a series of time series data. By analyzing the time series of foreign exchange rate data, we can understand the fluctuations in currency values, predict future trends, and make risk management and investment decisions. Therefore, foreign exchange rates can be studied and analyzed as time series.

[0091] First, historical exchange rate data generated in a previous historical period of the forecast period can be obtained from the database. The historical exchange rate data can include a closing price and a transaction price of the first currency against the second currency.

[0092] For example, the closing exchange rates of the U.S. dollar against the RMB, the euro, the British pound, and the Swiss franc over a continuous period of time and the transaction prices of bulk futures are selected as historical exchange rate data, and the exchange rate data for the current period is predicted based on the historical exchange rate data.

[0093] S102: normalizing the historical exchange rate data to obtain normalized historical exchange rate data.

[0094] Due to the large gap in the distribution of time series data, the prediction effect cannot be optimized. The use of normalization or standardization methods can map the time series data to a certain area, which can effectively improve the model operation time. It is of great significance to achieve the task of effectively predicting time series through neural networks.

[0095] Normalization is to scale the data to the data range of [0,1]. Common normalization methods include minimum and maximum scaling and feature scaling. Min-max scaling subtracts the minimum value from the original data and divides it by the difference between the maximum and minimum values, so that the data is mapped between 0 and 1. Feature scaling is to subtract the mean of the feature from the original data and divide it by the standard deviation of the feature, so that the mean of the data is 0 and the variance is 1. The embodiments of the present application do not limit the normalization method and can be selected according to actual needs.

[0096] The historical exchange rate data collected above are normalized, and the normalized historical exchange rate data are analyzed.

[0097] S103: Analyze the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence.

[0098] Wavelet transform is a time-frequency analysis method that can analyze signals in the time and frequency domains. It can provide good resolution in the time domain and frequency domain. Wavelet transform can provide multi-scale analysis capabilities and can capture the high-frequency, low-frequency and medium-frequency components of the signal at the same time. In time series analysis, fluctuation information of different scales may contain different important features. Wavelet transform can better understand and describe the time-frequency characteristics of time series data. At the same time, time series data is usually non-stationary, that is, the statistical characteristics of the signal change over time. Wavelet transform can analyze the frequency components of the signal at different time scales, is suitable for time-frequency analysis of non-stationary signals, and can better capture the instantaneous characteristics and frequency changes of the signal.

[0099] In order to reduce the impact of the non-stationary and non-linear characteristics of foreign exchange rates on the exchange rate prediction model, the embodiment of the present application can use wavelet transform to expand the historical exchange rate data to obtain a number of decomposition sub-sequences.

[0100] Wavelet transform uses wavelet basis functions to decompose and reconstruct signals, where wavelet basis functions are localized, finite-length functions. Wavelet basis functions have the characteristics of both time domain and frequency domain scales, and can better adapt to the temporal changes of signals in the time domain.

[0101] Wavelet transform can include expansion and synthesis. Based on a given time series signal x(t), the wavelet transform expansion can be expressed as the following formula (1):

[0102]

[0103] Among them, CWT(a,b) is the transformation result of continuous wavelet transform under scale parameter a and translation parameter b, x(t) is the given time series signal, is the scale and translation version of the wavelet function, a is the scale parameter used to control the frequency of the wavelet function, and b is the translation parameter used to control the position of the wavelet function on the time axis.

[0104] The wavelet transform synthesis formula of the time series signal x(t) can be expressed as the following formula (2):

[0105]

[0106] Among them, C ψ is the normalized coefficient of the wavelet function ψ(t).

[0107] The expansion formula represents the wavelet coefficients of the signal x(t) at different scales and translations, and the characteristic components of the signal at different frequencies and time scales can be obtained. The synthesis formula is the process of reconstructing the signal back to the original signal by inverse transforming the wavelet coefficients and the wavelet function. By selecting appropriate wavelet basis functions and scale parameters, it can better adapt to different types of time series data.

[0108] It should be noted that, when performing multivariate decomposition of exchange rate data, in addition to wavelet transform, other similar signal transformation methods can also be used to achieve multivariate decomposition of data. The decomposition algorithm used in the embodiment of the present application is not limited to wavelet transform, but can also be Fourier transform, etc.

[0109] S104: Inputting the decomposed subsequence into a pre-built exchange rate prediction model to obtain an initial prediction sequence in the form of a decomposed subsequence output by the exchange rate prediction model, wherein the exchange rate prediction model is an LSTM network model.

[0110] In the embodiment of the present application, a pre-built exchange rate prediction model is used to perform exchange rate prediction, and the exchange rate prediction model can be an LSTM network model.

[0111] The historical exchange rate data of the foreign exchange rate to be predicted can be input into the exchange rate prediction model after wavelet transform decomposition to obtain an initial prediction sequence in the form of wavelet transform decomposition subsequences, and then synthesized according to the wavelet transform synthesis formula to obtain the target prediction sequence.

[0112] The embodiment of the present application provides a specific process for training the exchange rate prediction model, please see below.

[0113] S105: synthesizing the initial prediction sequence into a target prediction sequence according to a wavelet transform synthesis formula, wherein the target prediction sequence is exchange rate prediction data within a current cycle time period.

[0114] The initial prediction sequence is reconstructed back to the original signal using the wavelet transform synthesis formula, that is, the target prediction sequence is reconstructed, and the target prediction sequence is the exchange rate prediction data x_pre(t) in the current cycle time period.

[0115] Based on the contents of the above steps S101-S105, it can be known that the historical exchange rate data between the first currency and the second currency in the historical period time period is obtained, and the historical exchange rate data is normalized to obtain the normalized historical exchange rate data; the normalized historical exchange rate data is analyzed by using the wavelet transform expansion formula to obtain the decomposition subsequence; the decomposition subsequence is input into the pre-constructed exchange rate prediction model to obtain the initial prediction sequence in the form of the decomposition subsequence output by the exchange rate prediction model, and the exchange rate prediction model is an LSTM network model; the initial prediction sequence is synthesized into a target prediction sequence according to the wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data in the current period time period. In this way, according to the non-stationary and nonlinear characteristics of the foreign exchange rate, the time series of the historical exchange rate data is expanded according to the wavelet transform to obtain several decomposition subsequences, reduce the influence of the non-stationary and nonlinear time series of the historical exchange rate data on the prediction results, predict the decomposition subsequence through the LSTM deep learning network model, and combine the subsequence prediction results into the target prediction sequence through the wavelet transform to obtain the prediction results, realize the foreign exchange rate prediction, reduce the exchange rate prediction error, and improve the accuracy of the exchange rate prediction.

[0116] The specific process of training an exchange rate prediction model provided in an embodiment of the present application is described below.

[0117] See also Figure 2 , Figure 2 A schematic diagram of a training process of an exchange rate prediction model provided in an embodiment of the present application. The model training process includes data collection and preprocessing, wavelet transform expansion, construction and training of LSTM network model, and wavelet transform synthesis.

[0118] In one possible implementation, the exchange rate prediction model is trained by the following method:

[0119] First, obtain an exchange rate training set and an exchange rate test set. The exchange rate training set is the historical exchange rate training data between the first currency and the second currency in a first continuous time period, and the exchange rate test set is the historical exchange rate test data between the first currency and the second currency in a second continuous time period. The second time period is the period after the first time period.

[0120] Secondly, the exchange rate training set is normalized to obtain a normalized exchange rate training set; the normalized exchange rate training set is analyzed using a wavelet transform expansion to obtain a training decomposition subsequence. The training decomposition subsequence is input into an exchange rate prediction training model to obtain an initial prediction training sequence output by the exchange rate prediction training model; the initial prediction training sequence is synthesized into a training prediction sequence according to a wavelet transform synthesis formula, and the training prediction sequence is the exchange rate prediction data for the second time period;

[0121] Finally, the loss function is calculated based on the training prediction sequence and the exchange rate test set; the model parameters of the exchange rate prediction training model are optimized based on the loss function until the loss function converges; the exchange rate prediction training model corresponding to the convergence of the loss function is used as the exchange rate prediction model.

[0122] Select historical exchange rate data within a continuous period of time from the database as model training data. The continuous period of time can be defined as a first continuous time period, and the historical exchange rate data within the first continuous time period is used as an exchange rate training set for model training, which can represent the historical exchange rate training data between the first currency and the second currency. At the same time, select the same type of data within a continuous period of time after the first continuous time period as an exchange rate test set, and the historical exchange rate data included in the exchange rate test set is the real exchange rate prediction verification data.

[0123] After the exchange rate test set is normalized, the normalized exchange rate training set can be input into the exchange rate prediction training model after wavelet exchange decomposition.

[0124] The first step in pre-constructing a neural network prediction model is data pre-processing. Among the various forms of data pre-processing methods used in the field of time series, normalization and standardization are the most commonly used, and the final prediction effect will also vary depending on the processor. Normalization and standardization methods can map time series data to a certain area, effectively reducing the time it takes to build a neural network. However, due to the large gap in the distribution of time series data, the prediction effect cannot be optimized, which is of great significance for achieving the task of effectively predicting time series through neural networks. In the embodiment of the present application, the normalization method is selected to pre-process the exchange rate training set, and the normalized exchange rate training set is used as the model input data.

[0125] In one possible implementation, before using the exchange rate prediction training model to process data, the parameters of the exchange rate prediction training model are initialized.

[0126] The exchange rate prediction training model can be an LSTM network model. First, the parameters of the LSTM network model are initialized, including weights and biases. For a given input sequence, that is, the normalized exchange rate training set, the output of the LSTM network model is calculated through forward propagation. During the forward propagation process, the LSTM network model calculates the hidden state and output of the current time step based on the current input and the hidden state of the previous time step, that is, the LSTM network model outputs the initial prediction training sequence.

[0127] See also Figure 3 , Figure 3 A schematic diagram of a wavelet exchange and LSTM operation structure provided for an embodiment of the present application. The foreign exchange rate data in the exchange rate training set is first decomposed by wavelet transform to obtain a training decomposition subsequence characterized as a multi-scale, and the training decomposition subsequence is sent to the LSTM network model to be trained for training to obtain an initial prediction training sequence in the form of a wavelet transformed training decomposition subsequence, and then the initial prediction training sequence is synthesized into a training prediction sequence according to the wavelet transform synthesis formula, and the training prediction sequence is the exchange rate prediction data for the second time period.

[0128] LSTM is designed as a continuous chain structure, see Figure 4 , Figure 4 A schematic diagram of a recursive module in an LSTM network model provided in an embodiment of the present application. Each recursive module is composed of four layers of neural networks connected to each other in a special way. The transmission between neurons has different weights. The figure shows the operations of point multiplication and point addition, and shows the content representing different steps of training, which together constitute the forget gate and memory unit.

[0129] The output training prediction sequence is compared with the exchange rate test set to calculate the loss function. Commonly used loss functions include Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Mean Absolute Error (MAE) and cross entropy loss, etc. Loss functions are used to measure the prediction performance indicators of the model.

[0130] Use the back-propagation algorithm to calculate the gradient of the loss function to the network parameters. Use the gradient descent algorithm or other optimization algorithms to update the LSTM network model parameters to reduce the loss function. Repeat forward propagation, loss calculation, back-propagation, and parameter update until the pre-set stop condition is reached, such as reaching the maximum number of iterations or the loss function converges. The above training process can also be found in Figure 5 , Figure 5 A schematic diagram of another exchange rate prediction model training process provided in an embodiment of the present application.

[0131] Through the above steps, the LSTM network model can learn model parameters suitable for specific tasks on the training data, so that it can predict and classify unseen sequence data.

[0132] In another embodiment of the present application, the exchange rate training set can be used to train an initial exchange rate prediction model, and the historical exchange rate data of the next continuous time period corresponding to the exchange rate test set is used as the real exchange rate prediction verification data. The exchange rate test set is normalized and decomposed by the wavelet transform expansion formula, and then input into the trained initial exchange rate prediction model for calculation to obtain an initial prediction verification sequence; the initial prediction verification sequence is synthesized into a verification prediction sequence according to the wavelet transform synthesis formula, and the loss function is calculated based on the verification prediction exchange rate and the real exchange rate prediction verification data, and the parameters of the initial exchange rate prediction model are adjusted based on the loss function.

[0133] Traditional time series prediction methods, such as the moving average method and the ARMA method, use a single model to pay more attention to local information, process a small amount of data, and have strong assumptions about the stationarity of the time series. The statistical characteristics of foreign exchange rates change over time, and it is difficult to ensure the stationarity of the data in actual situations. The embodiment of the present application uses deep learning to pay more attention to global information, and can process a large amount of data without limiting the assumption of stationarity. The introduction of wavelet transform can convert time series into multi-scale subsequences, which has obvious advantages in processing noisy and non-stationary data. The introduced LSTM network model is cleverly designed to enable it to have the ability to memorize data and learn feature correlation.

[0134] The embodiment of the present application first expands the original exchange rate time series according to the non-stationary and non-linear characteristics of the foreign exchange rate according to the wavelet transform to obtain several sub-sequences, reducing the impact of the non-stationary statistical characteristics of the original sequence on the model, and then trains and predicts the sub-sequences through several LSTM network models, and combines the sub-sequence prediction results through the wavelet transform formula to obtain the final prediction result. The model learns the deeper characteristics of the sequence, and retains the optimal parameters for subsequent sequence prediction training, realizes foreign exchange rate prediction, and reduces exchange rate prediction errors.

[0135] The foreign exchange rate prediction method combining wavelet transform and LSTM network model disclosed in the embodiment of the present application constructs a complete set of foreign exchange rate prediction processes including but not limited to data division, data processing, wavelet transform, network construction, network training, prediction model generation, and prediction result synthesis from top to bottom from the multivariate construction of foreign exchange rate historical data. The foreign exchange rate data is decomposed at multiple scales using wavelet transform, which breaks the stability assumption limit of historical data in general foreign exchange rate prediction, and actually considers the non-stationary statistical characteristics of foreign exchange rate, which is more in line with the actual situation.

[0136] The above-mentioned embodiment of the present application provides an exchange rate prediction method based on the above-mentioned LSTM network model based on wavelet transform. Next, an exchange rate prediction device based on the LSTM network model based on wavelet transform provided in the embodiment of the present application is described, which is used to perform the above-mentioned Figure 1 The function of the exchange rate prediction device based on the LSTM network model of wavelet transform is explained. The structural diagram of the exchange rate prediction device based on the LSTM network model of wavelet transform is shown in FIG. Figure 6 As shown, it includes an acquisition module 601 , a normalization module 602 , a wavelet transformation module 603 and a prediction module 604 .

[0137] in,

[0138] An acquisition module 601 is used to acquire historical exchange rate data between a first currency and a second currency in a historical period;

[0139] A normalization module 602, configured to perform normalization processing on the historical exchange rate data to obtain normalized historical exchange rate data;

[0140] A wavelet transform module 603 is used to analyze the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence;

[0141] A prediction module 604 is used to input the decomposed subsequence into a pre-built exchange rate prediction model to obtain an initial prediction sequence in the form of decomposed subsequences output by the exchange rate prediction model, wherein the exchange rate prediction model is an LSTM network model;

[0142] The wavelet transform module 603 is further used to synthesize the initial prediction sequence into a target prediction sequence according to a wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data within the current cycle time period.

[0143] In one possible implementation, the device further includes a model training module;

[0144] The model training module is used to train the exchange rate prediction model, including:

[0145] an acquisition submodule, configured to acquire an exchange rate training set and an exchange rate test set, wherein the exchange rate training set is historical exchange rate training data between a first currency and a second currency in a first continuous time period, and the exchange rate test set is historical exchange rate test data between the first currency and the second currency in a second continuous time period, wherein the second time period is a time period subsequent to the first time period;

[0146] A normalization submodule, used for normalizing the exchange rate training set to obtain a normalized exchange rate training set;

[0147] A wavelet transform submodule, used to analyze the normalized exchange rate training set using a wavelet transform expansion to obtain a training decomposition subsequence;

[0148] A prediction submodule, used for inputting the training decomposition subsequence into the exchange rate prediction training model to obtain an initial prediction training sequence output by the exchange rate prediction training model;

[0149] The wavelet transform submodule is further used to synthesize the initial prediction training sequence into a training prediction sequence according to the wavelet transform synthesis formula, wherein the training prediction sequence is the exchange rate prediction data for the second time period;

[0150] A calculation submodule, used for calculating a loss function based on the training prediction sequence and the exchange rate test set;

[0151] A parameter optimization submodule, used for optimizing the model parameters of the exchange rate prediction training model based on the loss function until the loss function converges;

[0152] A submodule is determined, which is used to use the exchange rate prediction training model corresponding to the convergence of the loss function as the exchange rate prediction model.

[0153] In a possible implementation, before executing the prediction submodule 604, the apparatus further includes:

[0154] The initialization module is used to initialize the parameters of the exchange rate prediction training model.

[0155] In a possible implementation, the wavelet transform expansion is:

[0156]

[0157] Among them, CWT(a,b) is the transformation result of continuous wavelet transform under scale parameter a and translation parameter b, x(t) is the given time series signal, is the scale and translation version of the wavelet function, a is the scale parameter used to control the frequency of the wavelet function, and b is the translation parameter used to control the position of the wavelet function on the time axis;

[0158] The wavelet transform synthesis formula is:

[0159]

[0160] Among them, C ψ is the normalized coefficient of the wavelet function ψ(t).

[0161] In a possible implementation manner, the historical exchange rate data includes a closing price and a transaction price of the first currency against the second currency.

[0162] The embodiment of the present application provides an exchange rate prediction device based on an LSTM network model of wavelet transform, including an acquisition module, a normalization module, a wavelet transform module and a prediction module. The acquisition module is used to obtain historical exchange rate data between a first currency and a second currency within a historical period time period. The normalization module is used to normalize the historical exchange rate data to obtain normalized historical exchange rate data. The wavelet transform module is used to analyze the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence. The prediction module is used to input the decomposition subsequence into a pre-constructed exchange rate prediction model to obtain an initial prediction sequence in the form of a decomposition subsequence output by the exchange rate prediction model, and the exchange rate prediction model is an LSTM network model. The wavelet transform module is also used to synthesize the initial prediction sequence into a target prediction sequence according to a wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data within the current period time period. In this way, according to the non-stationary and nonlinear characteristics of foreign exchange rates, the time series of historical exchange rate data is expanded according to wavelet transform to obtain several decomposition sub-sequences, reducing the impact of the non-stationary and nonlinear time series of historical exchange rate data on the prediction results. The decomposition sub-sequences are predicted through the LSTM deep learning network model, and the sub-sequence prediction results are combined into the target prediction sequence through wavelet transform to obtain the prediction results, realize foreign exchange rate prediction, reduce the exchange rate prediction error, and improve the accuracy of exchange rate prediction.

[0163] Based on the above method embodiment, a method for predicting exchange rates based on a LSTM network model of wavelet transform is provided. The present application embodiment also provides a device for predicting exchange rates based on a LSTM network model of wavelet transform. Figure 7 , the device includes: a processor, a memory, and a system bus;

[0164] The processor and the memory are connected via the system bus;

[0165] The memory is used to store one or more programs, and the one or more programs include instructions. When the instructions are executed by the processor, the processor executes the exchange rate prediction method based on the LSTM network model based on wavelet transform described in any of the above embodiments.

[0166] Based on the exchange rate prediction method of the LSTM network model based on wavelet transform provided in the above method embodiment, the embodiment of the present application also provides a storage medium, which stores instructions. When the instructions are executed by a computer, the computer implements the exchange rate prediction method of the LSTM network model based on wavelet transform described in the first aspect above.

[0167] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0168] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0169] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for predicting exchange rates based on an LSTM network model using wavelet transform, characterized in that: The exchange rate prediction method comprises: Get historical exchange rate data between the first currency and the second currency during the historical period; Normalizing the historical exchange rate data to obtain normalized historical exchange rate data; Analyzing the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence; Inputting the decomposed subsequence into a pre-built exchange rate prediction model to obtain an initial prediction sequence in the form of a decomposed subsequence output by the exchange rate prediction model, wherein the exchange rate prediction model is an LSTM network model; The initial prediction sequence is synthesized into a target prediction sequence according to a wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data within the current cycle time period.

2. The exchange rate prediction method according to claim 1, characterized in that: The exchange rate prediction model is trained by the following method: Acquire an exchange rate training set and an exchange rate test set, wherein the exchange rate training set is historical exchange rate training data between a first currency and a second currency in a first continuous time period, and the exchange rate test set is historical exchange rate test data between the first currency and the second currency in a second continuous time period, wherein the second time period is a time period subsequent to the first time period; Normalizing the exchange rate training set to obtain a normalized exchange rate training set; Analyzing the normalized exchange rate training set using a wavelet transform expansion to obtain a training decomposition subsequence; Inputting the training decomposition subsequence into the exchange rate prediction training model to obtain an initial prediction training sequence output by the exchange rate prediction training model; The initial prediction training sequence is synthesized into a training prediction sequence according to a wavelet transform synthesis formula, wherein the training prediction sequence is exchange rate prediction data for a second time period; Calculating a loss function based on the training prediction sequence and the exchange rate test set; Optimizing the model parameters of the exchange rate prediction training model based on the loss function until the loss function converges; The exchange rate prediction training model corresponding to the convergence of the loss function is used as the exchange rate prediction model.

3. The exchange rate prediction method according to claim 2, characterized in that: Before using the exchange rate prediction training model to process data, the method further includes: Initialize the parameters of the exchange rate prediction training model.

4. The exchange rate prediction method according to any one of claims 1 to 2, characterized in that: The wavelet transform expansion is: Among them, CWT(a,b) is the transformation result of continuous wavelet transform under scale parameter a and translation parameter b, x(t) is the given time series signal, is the scale and translation version of the wavelet function, a is the scale parameter used to control the frequency of the wavelet function, and b is the translation parameter used to control the position of the wavelet function on the time axis; The wavelet transform synthesis formula is: Among them, C ψ is the normalized coefficient of the wavelet function ψ(t).

5. The exchange rate prediction method according to claim 1, characterized in that: The historical exchange rate data includes a closing price and a transaction price of the first currency against the second currency.

6. An exchange rate prediction device based on an LSTM network model of wavelet transform, characterized in that: The exchange rate prediction device comprises: An acquisition module, used to acquire historical exchange rate data between a first currency and a second currency within a historical period; A normalization module, used for normalizing the historical exchange rate data to obtain normalized historical exchange rate data; A wavelet transform module, used to analyze the normalized historical exchange rate data using a wavelet transform expansion to obtain a decomposition subsequence; A prediction module, used for inputting the decomposed subsequence into a pre-built exchange rate prediction model to obtain an initial prediction sequence in the form of decomposed subsequences output by the exchange rate prediction model, wherein the exchange rate prediction model is an LSTM network model; The wavelet transform module is further used to synthesize the initial prediction sequence into a target prediction sequence according to a wavelet transform synthesis formula, and the target prediction sequence is the exchange rate prediction data within the current cycle time period.

7. The exchange rate prediction device according to claim 6, characterized in that: The device also includes a model training module; The model training module is used to train the exchange rate prediction model, including: an acquisition submodule, configured to acquire an exchange rate training set and an exchange rate test set, wherein the exchange rate training set is historical exchange rate training data between a first currency and a second currency in a first continuous time period, and the exchange rate test set is historical exchange rate test data between the first currency and the second currency in a second continuous time period, wherein the second time period is a time period subsequent to the first time period; A normalization submodule, used for normalizing the exchange rate training set to obtain a normalized exchange rate training set; A wavelet transform submodule, used to analyze the normalized exchange rate training set using a wavelet transform expansion to obtain a training decomposition subsequence; A prediction submodule, used for inputting the training decomposition subsequence into the exchange rate prediction training model to obtain an initial prediction training sequence output by the exchange rate prediction training model; The wavelet transform submodule is further used to synthesize the initial prediction training sequence into a training prediction sequence according to the wavelet transform synthesis formula, wherein the training prediction sequence is the exchange rate prediction data for the second time period; A calculation submodule, used for calculating a loss function based on the training prediction sequence and the exchange rate test set; A parameter optimization submodule, used for optimizing the model parameters of the exchange rate prediction training model based on the loss function until the loss function converges; A submodule is determined, which is used to use the exchange rate prediction training model corresponding to the convergence of the loss function as the exchange rate prediction model.

8. The exchange rate prediction device according to claim 7, characterized in that: Before executing the prediction submodule, the device further includes: The initialization module is used to initialize the parameters of the exchange rate prediction training model.

9. The exchange rate prediction device according to any one of claims 6 to 7, characterized in that: The wavelet transform expansion is: Among them, CWT(a,b) is the transformation result of continuous wavelet transform under scale parameter a and translation parameter b, x(t) is the given time series signal, is the scale and translation version of the wavelet function, a is the scale parameter used to control the frequency of the wavelet function, and b is the translation parameter used to control the position of the wavelet function on the time axis; The wavelet transform synthesis formula is: Among them, C ψ is the normalized coefficient of the wavelet function ψ(t).

10. The exchange rate prediction device according to claim 6, characterized in that: The historical exchange rate data includes a closing price and a transaction price of the first currency against the second currency.

Citation Information

Cited By

  • Dynamic space-time cross fusion economic prediction system and method based on graph attention and event response LSTM

    CN121391355A