Method and device for predicting financial data, electronic equipment and storage medium

By combining news events and historical financial data, utilizing event graphs to obtain background information and integrating feature data, the problem of insufficient accuracy in financial data prediction in time series analysis is solved, achieving higher prediction accuracy.

CN117033651BActive Publication Date: 2026-01-13CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310834188.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-07
Publication Date
2026-01-13
Estimated Expiration
2043-07-07

AI Technical Summary

Technical Problem

Existing financial data forecasting methods based on time series analysis often fail to meet accuracy requirements when faced with abnormal fluctuations.

Method used

By combining news event information and historical financial data, background event information is obtained through event graphs, feature data is extracted and integrated, and predictive models are used to predict financial data.

Benefits of technology

It improves the accuracy of financial data forecasting by enhancing the ability to predict fluctuations in financial data through the mining of rich information and multiple feature data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117033651B_ABST
    Figure CN117033651B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of financial data prediction method and device, electronic equipment and storage medium, belong to machine learning technical field.The method obtains the news event information of current time node and the historical financial data in a period of time before current time node;According to event graph, the background event information corresponding to news event information is obtained;The first feature data of news event information and the second feature data of background event information are extracted, the first feature data and the second feature data are fused, and the third feature data is obtained;The fourth feature data of historical financial data is extracted, and the fourth feature data and the third feature data are fused, and the fifth feature data is obtained;According to fifth feature data, the financial data after current time node is predicted by prediction model, and the first prediction result of financial data is obtained.The multiple feature data that influences financial data is mined to predict it, and the prediction accuracy of financial data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine learning technology, and in particular to a method and apparatus for predicting financial data, an electronic device, and a storage medium. Background Technology

[0002] Currently, with the development of artificial intelligence technology, more and more related applications are being developed, bringing numerous conveniences to people's work and study. Among these, the prediction of relevant financial data based on machine learning technology, such as predicting price fluctuations of funds and stocks, and predicting whether certain potential financial risks may occur, has a wide range of applications.

[0003] In related technologies, the prediction of financial data typically utilizes past financial data, using time-series information to predict the future trend of financial data. However, in reality, financial data is affected by various real-world events and inherently exhibits abnormal fluctuations. Therefore, simply analyzing and predicting financial data from a time-series perspective is insufficient to meet the required accuracy. Summary of the Invention

[0004] The main objective of this application is to provide a method, apparatus, electronic device, and storage medium for predicting financial data, aiming to improve the accuracy of financial data prediction.

[0005] To achieve the above objectives, a first aspect of this application proposes a method for predicting financial data, the method comprising:

[0006] Obtain news event information at the current time point and historical financial data for a period of time prior to the current time point;

[0007] Based on the event graph, obtain the background event information corresponding to the news event information;

[0008] Extract the first feature data of the news event information and the second feature data of the background event information, and fuse the first feature data and the second feature data to obtain the third feature data;

[0009] The fourth feature data of the historical financial data is extracted, and the fourth feature data and the third feature data are fused to obtain the fifth feature data;

[0010] Based on the fifth feature data, the financial data after the current time point is predicted using a prediction model to obtain the first prediction result of the financial data.

[0011] In some embodiments, the event graph includes several nodes and edges, where the nodes represent individual events and the edges represent the relationships between the events.

[0012] The step of obtaining background event information corresponding to the news event information based on the event graph includes:

[0013] Based on the events corresponding to the news event information, determine the target node in the event graph;

[0014] Find background nodes whose number of edges with the target node is less than a preset threshold.

[0015] The background event information is obtained based on the events represented by the background nodes.

[0016] In some embodiments, the extraction of the first feature data of the news event information includes:

[0017] The news event information is segmented into words to obtain word groups corresponding to the news event information, and the word feature data corresponding to each word in the word group is determined; wherein, the word group includes several words;

[0018] Based on the word feature data corresponding to each word in the phrase, the first feature data corresponding to the news event information is determined.

[0019] In some embodiments, the word feature data includes word embedding vectors; determining the word feature data corresponding to each word in the word group includes:

[0020] Map the words to a vector space to obtain the word embedding vectors corresponding to the words;

[0021] The step of determining the first feature data corresponding to the news event information based on the word feature data corresponding to each word in the phrase includes:

[0022] The word embedding vectors corresponding to each word in the phrase are summed to obtain the first vector;

[0023] The first vector is normalized to obtain the first feature data.

[0024] In some embodiments, fusing the first feature data and the second feature data to obtain the third feature data includes:

[0025] The first feature data and the second feature data are weighted and summed to obtain the third feature data;

[0026] Alternatively, the first feature data and the second feature data can be concatenated to obtain the third feature data.

[0027] In some embodiments, the prediction model is trained through the following steps:

[0028] Acquire batches of sample data and tags; the sample data includes sample news event information at a first time point and sample historical financial data corresponding to the sample news event information; the tags are used to characterize the increase or decrease trend or actual value of the sample financial data after the first time point;

[0029] Based on the event graph, obtain the sample background event information corresponding to the sample news event information;

[0030] Based on the sample news event information, sample background event information, and sample historical financial data, sample feature data is obtained;

[0031] Based on the sample feature data, the sample financial data after the first time point is predicted using an initialized prediction model to obtain a second prediction result for the sample financial data.

[0032] Based on the second prediction result and the label, determine the training loss value;

[0033] Based on the loss value, the parameters of the prediction model are updated to obtain the trained prediction model.

[0034] In some embodiments, the method further includes:

[0035] Based on the first prediction result, determine the magnitude of change in the financial data;

[0036] When the change exceeds a preset threshold, the news event information for the current time point is recorded.

[0037] To achieve the above objectives, a second aspect of this application provides a financial data prediction apparatus, the apparatus comprising:

[0038] The first acquisition unit is used to acquire news event information at the current time node and historical financial data for a period of time prior to the current time node;

[0039] The second acquisition unit is used to acquire background event information corresponding to the news event information based on the event graph;

[0040] The first extraction unit is used to extract the first feature data of the news event information and the second feature data of the background event information, and to fuse the first feature data and the second feature data to obtain the third feature data.

[0041] The second extraction unit is used to extract the fourth feature data of the historical financial data, and to fuse the fourth feature data and the third feature data to obtain the fifth feature data;

[0042] The processing unit is used to predict the financial data after the current time point based on the fifth feature data and through a prediction model to obtain the first prediction result of the financial data.

[0043] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.

[0044] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.

[0045] The financial data prediction method, apparatus, electronic device, and storage medium proposed in this application acquire news event information at the current time point and historical financial data for a period of time prior to the current time point; acquire background event information corresponding to the news event information based on an event graph; extract first feature data from the news event information and second feature data from the background event information, and fuse the first feature data and the second feature data to obtain third feature data; extract fourth feature data from the historical financial data, and fuse the fourth feature data and the third feature data to obtain fifth feature data; based on the fifth feature data, predict financial data after the current time point using a prediction model to obtain a first prediction result for the financial data. This application improves the accuracy of financial data prediction by mining multiple feature data affecting financial data through information-rich news event information and historical financial data. Attached Figure Description

[0046] Figure 1 This is a flowchart of a financial data prediction method provided in an embodiment of this application;

[0047] Figure 2 This is a schematic diagram of the structure of a prediction model provided in an embodiment of this application;

[0048] Figure 3 This is a flowchart of obtaining background event information provided in an embodiment of this application;

[0049] Figure 4 This is a flowchart illustrating the extraction of first feature data provided in an embodiment of this application;

[0050] Figure 5 This is a flowchart illustrating a training prediction model provided in an embodiment of this application;

[0051] Figure 6 This is a flowchart of recording news event information provided in an embodiment of this application;

[0052] Figure 7 This is a schematic diagram of the structure of the financial data prediction device provided in the embodiments of this application;

[0053] Figure 8 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0055] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0057] First, let's analyze some of the terms used in this application:

[0058] Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to have perception, reasoning, and decision-making capabilities. AI technology is a comprehensive discipline involving a wide range of fields, encompassing both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0059] Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence. Its applications span all areas of artificial intelligence. Machine learning (deep learning) typically includes techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0060] A graph is a data form composed of many nodes (also called vertices) connected to each other. Nodes can be entities such as people and organizations, and the connections between nodes (called edges) represent certain relationships (such as friendship or dependency relationships). A graph can have only one type of node and one type of edge (called a single graph), or it can have multiple types of nodes or multiple types of edges (called a heterogeneous graph). The edges in a graph can be directed edges (called a directed graph) or undirected edges (called an undirected graph).

[0061] Currently, with the development of artificial intelligence technology, more and more related applications are being developed, bringing numerous conveniences to people's work and study. Among these, the prediction of relevant financial data based on machine learning technology, such as predicting price fluctuations of funds and stocks, and predicting whether certain potential financial risks may occur, has a wide range of applications.

[0062] In related technologies, the prediction of financial data typically utilizes past financial data, using time-series information to predict the future trend of financial data. However, in reality, financial data is affected by various real-world events and inherently exhibits abnormal fluctuations. Therefore, simply analyzing and predicting financial data from a time-series perspective is insufficient to meet the required accuracy.

[0063] Based on this, embodiments of this application provide a method, apparatus, electronic device, and storage medium for predicting financial data. The method acquires news event information at the current time point and historical financial data from a period prior to the current time point; obtains background event information corresponding to the news event information based on an event graph; extracts first feature data from the news event information and second feature data from the background event information, and fuses the first and second feature data to obtain third feature data; extracts fourth feature data from the historical financial data, and fuses the fourth and third feature data to obtain fifth feature data; and predicts financial data after the current time point using a prediction model based on the fifth feature data to obtain a first prediction result for the financial data. This application improves the accuracy of financial data prediction by mining multiple feature data affecting financial data through information-rich news event information and historical financial data.

[0064] The methods provided in this application embodiment can be executed in various scenarios in the financial field. For example, in some embodiments, the financial data can be price data of stocks, funds, etc., and the prices of these stocks over a future period can be predicted by executing the methods in this application embodiment. In other embodiments, the financial data can be certain indicator data, such as click-through rate data of certain advertisements, and their values ​​over a future period can be predicted by executing the methods in this application embodiment. It is understood that, facing various specific application tasks, the methods provided in this application embodiment can all use machine learning technology to build and train corresponding prediction models, and then use the trained prediction models to predict financial data, thereby obtaining the prediction results corresponding to the financial data.

[0065] The financial data prediction method, apparatus, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the financial data prediction method in this application is described.

[0066] The financial data prediction method provided in this application relates to the field of machine learning technology. This method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the financial data prediction method, but is not limited to the above forms.

[0067] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0068] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards of the relevant countries and regions. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirects to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data for the proper functioning of the embodiments of this application obtained.

[0069] Figure 1 This is an optional flowchart of the financial data prediction method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S105.

[0070] Step S101: Obtain news event information at the current time point and historical financial data for a period of time prior to the current time point;

[0071] In this step, when it is necessary to predict financial data, news event information at the current time point can be obtained, and financial data from a period prior to the current time point can be obtained simultaneously, recorded as historical financial data. It should be noted that the current time point can be the moment when the prediction method begins. When obtaining news event information at the current time point, it can be obtained by crawling relevant news websites; this application does not impose any restrictions on this. For example, in some embodiments, several pieces of information with high current popularity rankings can be selected from a certain news website to obtain news event information; in other embodiments, the most popular information can be selected from multiple news websites, and the information from each news website can be integrated to obtain news event information. In this application's embodiments, when predicting financial data, the impact of current hot events on the fluctuation of financial data is considered, which can improve the accuracy of the predicted results.

[0072] In this step, it should be noted that there is no restriction on the time period preceding the current time point when acquiring historical financial data. Of course, it is understandable that due to the inertia of financial data changes over time, in order to improve the ability of historical financial data to reflect the characteristics of future financial data, historical financial data as close as possible to the current time point can be selected. For example, assuming the current time point is 3 PM on January 3rd, financial data from an earlier time point to 3 PM on January 3rd can be acquired as historical financial data. In this embodiment, there is no limit to the amount of historical financial data. Generally speaking, the larger the amount of historical financial data, the higher the accuracy of the prediction results for subsequent financial data. However, an increase in data volume will also lead to increased costs and hardware resource consumption. Those skilled in the art can set the appropriate amount of data according to actual needs when implementing the method provided in this application.

[0073] It should be noted that the news event information and historical financial data in the embodiments of this application can be collected locally on the terminal device or server, or obtained from other electronic devices and computer systems through data transmission interface or remote communication transmission. This application does not impose any restrictions on this.

[0074] Step S102: Obtain the background event information corresponding to the news event information based on the event graph;

[0075] In this step, for the acquired news event information, background event information related to it can be obtained through an event graph. Specifically, in this embodiment, an event graph is a data format that lists events and their relationships. An event graph includes several nodes, where each node represents an event, and edges exist between nodes, representing the relationship between the two connected nodes. For example, assuming there is an edge between node A and node B, and the relationship represented by this edge is causal, it can be determined that the events corresponding to nodes A and B have a causal relationship. Furthermore, the edges in the event graph can also have pointers, which can be used to distinguish which event is the cause and which event is the corresponding result. Of course, it is understood that in this embodiment, the types of relationships represented by the edges in the event graph are not limited to causal relationships; for example, they can also include similarity relationships, sequential relationships, etc., which are not limited in this application.

[0076] In this step, based on the event graph, other event information similar to the news event information can be obtained, such as other event information that caused the news event information, or other event information related to the news event information. This other event information is recorded as background event information. It is understood that, in this embodiment, obtaining background event information based on the event graph is beneficial for fully supplementing and improving the cause and effect of the news event information, making the news event information more informative, thus facilitating the analysis of its potential impact on financial data and improving the accuracy of subsequent financial data predictions.

[0077] Step S103: Extract the first feature data of the news event information and the second feature data of the background event information, and fuse the first feature data and the second feature data to obtain the third feature data;

[0078] In this step, after obtaining news event information and background event information, feature data of the two types of information can be extracted. Specifically, the feature data corresponding to the news event information is recorded as the first feature data, and the feature data corresponding to the background event information is recorded as the second feature data.

[0079] Specifically, the collected news event information and background event information are generally in text format. Therefore, in some embodiments, relevant text encoders can be used to extract feature data from the news event information and background event information, such as BERT (Bidirectional Encoder Representation from Transformers) and its derivative models. Of course, the specific encoder structure used in this application embodiment is not limited.

[0080] In this step, after obtaining the first feature data and the second feature data, the first feature data and the second feature data can be fused to obtain the third feature data. Here, the feature fusion method for the first feature data and the second feature data can include data concatenation, data weighting, etc., and this application does not impose specific limitations on this. In the embodiments of this application, the data structure of each feature data can be any one of numerical values, vectors, matrices, or tensors.

[0081] Step S104: Extract the fourth feature data from the historical financial data, and fuse the fourth feature data and the third feature data to obtain the fifth feature data;

[0082] In this step, when predicting financial data, we also extract characteristic data from historical financial data, denoted as the fourth characteristic data. It's understandable that historical financial data reflects the numerical information of financial data over past periods, thus helping to uncover the numerical characteristics of the financial data, such as fluctuation patterns and approximate data ranges. Subsequently, when predicting future financial data based on the fourth characteristic data, the accuracy of the prediction results can be improved.

[0083] Specifically, historical financial data is generally collected in a sequential format. For example, in some embodiments, the collected historical financial data may be financial data corresponding to several time points prior to the current time point. Arranging these financial data in chronological order according to their corresponding time points yields historical financial data in a sequential format. In this application embodiment, when extracting the fourth feature data, a model structure adept at handling sequential data can be used. For instance, in some embodiments, a recurrent neural network (RNN) can be employed, such as the commonly used Long Short-Term Memory (LSTM) network. Of course, it is understood that the above model structure can be flexibly adjusted as needed, and this application does not impose any limitations on it.

[0084] In this step, after obtaining the fourth feature data, the fourth feature data and the third feature data are further fused to obtain the fifth feature data. Similarly, the feature fusion method for the fourth feature data and the third feature data can include data concatenation, data weighting, etc., and this application does not impose specific limitations on this.

[0085] Step S105: Based on the fifth feature data, predict the financial data after the current time point using a prediction model to obtain the first prediction result of the financial data.

[0086] In this step, after obtaining the fifth feature data, the financial data after the current time point can be predicted using a prediction model to obtain the first prediction result of the financial data. It should be noted that the types of machine learning tasks can include classification prediction and regression prediction. Therefore, in this application embodiment, when predicting financial data, in some embodiments, it can be regarded as a classification task, predicting whether the value of future financial data will increase or decrease; in other embodiments, it can be regarded as a regression task, predicting the specific value of future financial data. This application does not limit this. Of course, the output form of the first prediction result can also be different for different task types. For example, when it is necessary to predict whether the value of future financial data will increase or decrease, the first prediction result can output two values, such as 0 or 1. When the first prediction result is 0, it indicates that the value of future financial data is predicted to decrease; conversely, when the first prediction result is 1, it indicates that the value of future financial data is predicted to increase. When predicting the specific value of future financial data, the value of the first prediction result can represent the value of the future financial data.

[0087] Specifically, refer to Figure 2 , Figure 2 The diagram shows a structural schematic of a prediction model provided in an embodiment of this application. This prediction model can be used to perform classification and prediction tasks of financial data. Figure 2 The prediction model in this application includes model units for extracting various feature data. Specifically, for news event information and background event information, the MacBERT architecture is used to extract and fuse their feature data to obtain the third feature data. For historical financial data, a recurrent neural network is used to extract its fourth feature data, which is then fused with the third feature data to obtain the fifth feature data. Next, the prediction model in this embodiment uses linear layers and a sigmoid function as classifiers. Here, the number of linear layers in the prediction model is not specifically limited. Since the output data of a typical linear layer can range from negative infinity to positive infinity, a sigmoid function is added after the linear layers in this embodiment. This function transforms the values ​​of the linear layers into values ​​between 0 and 1, thus ensuring the output results conform to the range constraints of probability values ​​and facilitating conversion into corresponding classification results. A threshold of 0.5 can generally be used. If the probability of an increase in the financial data corresponding to a certain input sample is greater than 0.5, the first prediction result for that input sample can be considered to belong to the increasing category; otherwise, it belongs to the decreasing category.

[0088] Specifically, please refer to Figure 3 In some embodiments, obtaining the background event information corresponding to the news event information based on the event graph includes:

[0089] Step S301: Determine the target node in the event graph based on the event corresponding to the news event information;

[0090] Step S302: Find background nodes whose number of edges with the target node is less than a preset threshold.

[0091] Step S303: Obtain the background event information based on the event represented by the background node.

[0092] In this embodiment, when obtaining background event information corresponding to news event information based on an event graph, firstly, the node representing the event can be determined in the event graph based on the event corresponding to the news event information, and denoted as the target node. Then, it can be understood that another node connected to the target node by an edge that has a connection relationship with the target node is also associated with the target node and can be considered as background event information of the news event information. In this embodiment, the other node connected to the target node by an edge that has a connection relationship with the target node can be denoted as the background node. It should be noted that nodes further connected to the background node through other edges may also have a certain correlation with the news event information, and therefore can also be used as background nodes providing background event information. In other words, the fewer edges traversed by the path between each node in the event graph and the target node, the stronger the correlation between the node and the target node.

[0093] In this embodiment, a preset threshold number can be set, for example, to 2. Then, background nodes whose number of edges with the target node is less than the preset threshold number are searched. This allows for the identification of background nodes strongly correlated with the events corresponding to the target node. The information of the events corresponding to these background nodes can then be used as the acquired background event information. It is understood that the background event information obtained in this way can more efficiently and accurately improve news event information, enhancing the amount and completeness of event information, thereby improving the accuracy of financial data prediction.

[0094] Specifically, please refer to Figure 4 In some embodiments, the extraction of the first feature data of the news event information includes:

[0095] Step S401: Perform word segmentation on the news event information to obtain word groups corresponding to the news event information, and determine the word feature data corresponding to each word in the word group; wherein, the word group includes several words;

[0096] Step S402: Determine the first feature data corresponding to the news event information based on the word feature data corresponding to each word in the phrase.

[0097] In this embodiment of the application, when extracting the first feature data of news event information, it is understood that news event information itself is generally text information, which is composed of words, and words are the most basic unit in natural language processing technology. Therefore, in this embodiment of the application, the first feature data corresponding to the news event information can be determined based on each word in the news event information.

[0098] Specifically, in this embodiment, the news event information can first be segmented into words to obtain multiple words that make up the news event information. These words are then recorded as a word group, with each news event information corresponding to a word group. Specifically, in this embodiment, various word segmentation algorithms can be used. For example, in some embodiments, a dictionary-based word segmentation algorithm can be used, first segmenting the news event information into words according to a dictionary, and then finding the optimal combination of words. In some embodiments, a character-based word segmentation algorithm can also be used, first segmenting the news event information into individual characters, then combining the characters into words, and finding the optimal combination. In this embodiment, after obtaining the word group corresponding to each statement, the first statement feature data corresponding to the statement can be determined based on the word feature data corresponding to each word in the word group.

[0099] In the embodiments of this application, word feature data is a data form used to represent words, and its data structure can also be any one of numerical values, vectors, matrices, tensors, etc. For example, in some embodiments, numerical values can be used to represent each word. For example, the numerical value "1" can be used to represent the Chinese word "我 (I)". In some embodiments, a dictionary can be established for all the words in the corpus, and then each word in the dictionary can be represented by a one-hot vector. For example, if there are 1000 words in the dictionary, the dimension of the one-hot vector is 1000. The corresponding one-hot vectors can be assigned to each word according to the order in which the words appear in the dictionary. For example, if the word "我" is the first word in the dictionary, the one-hot vector corresponding to "我" can be represented as (1, 0, 0...0, 0), where the first element in the vector is 1 and the remaining 999 elements are 0. In some embodiments, in order to reduce the dimension of the vector representing words, word embedding vectors can also be used to represent words. Word embedding vectors can be obtained by mapping the words in the dictionary to a vector space with a unified lower dimension. The strategies for generating such mappings include neural networks, dimensionality reduction of word co-occurrence matrices, probability models, and interpretable knowledge base methods, etc. For example, taking the use of a neural network to obtain word embedding vectors as an example, a trained word2vec (word to vector) model can be used to map to obtain the word embedding vectors of each word in the dictionary. Compared with the aforementioned one-hot vectors, word embedding vectors also have certain semantic representativeness, that is, words with similar semantics are also relatively close in the vector space, so they are more widely used. Of course, the above implementation manners are only used to illustrate the determination method of word feature data in this application, and the actual implementation process is not limited to the above specific examples.

[0100] In the embodiments of this application, after obtaining the word feature data corresponding to each word in the phrase, the first feature data corresponding to the news event information can be determined. For example, the word feature data can be weighted or concatenated to obtain the first feature data. In some embodiments, for example, the word feature data includes word embedding vectors, and the word embedding vectors can be obtained by mapping words to a vector space. When determining the first feature data, the word embedding vectors corresponding to each word in the phrase can be accumulated to obtain the first vector. For the convenience of standardization and data processing, the first vector can be normalized and used as the first feature data. The normalization method here can be to limit the norm of the first vector to a specific value. For example, each element in the first vector can be scaled proportionally so that the norm of the first vector is 1.

[0101] It should be noted that in the field of machine learning, the model generally needs to be trained and tuned before being put into use. Therefore, in the embodiments of this application, a training method for the above sentence classification model is also provided. Specifically, please refer to Figure 5In some embodiments, the prediction model is trained through the following steps:

[0102] Step S501: Obtain batch of sample data and tags; the sample data includes sample news event information at the first time point and sample historical financial data corresponding to the sample news event information; the tags are used to characterize the increase or decrease trend or actual value of the sample financial data after the first time point.

[0103] Step S502: Based on the event graph, obtain the sample background event information corresponding to the sample news event information;

[0104] Step S503: Obtain sample feature data based on the sample news event information, sample background event information, and sample historical financial data;

[0105] Step S504: Based on the sample feature data, predict the sample financial data after the first time node using the initialized prediction model to obtain the second prediction result of the sample financial data.

[0106] Step S505: Determine the training loss value based on the second prediction result and the label;

[0107] Step S506: Update the parameters of the prediction model according to the loss value to obtain the trained prediction model.

[0108] In this embodiment, when training the prediction model, a batch of sample data and labels can be obtained. Here, the sample data may include sample news event information at a first time point and the corresponding historical financial data. The label is used to characterize the increase or decrease trend or actual value of the sample financial data after the first time point. When the task type is a classification task, the label is used to characterize the increase or decrease trend of the financial data; when the task type is a regression task, the label is used to characterize the actual value of the financial data. After obtaining the sample data, the sample background event information corresponding to the sample news event information can be obtained based on the event graph. Then, the sample feature data can be obtained by fusing the sample news event information, sample background event information, and sample historical financial data. The specific implementation process of this process is similar to the aforementioned prediction process and will not be elaborated here. After obtaining the sample feature data, the initialized prediction model can be used to predict the sample financial data after the first time point to obtain the prediction result corresponding to the sample financial data, which is denoted as the second prediction result.

[0109] In this embodiment, the accuracy of the prediction model can be determined based on the second prediction result and the label. Specifically, the deviation between the second prediction result and the label can be determined to obtain the training loss value. After obtaining the loss value, the accuracy of the prediction model can be evaluated based on the magnitude of the loss value, so as to perform backpropagation training on the prediction model, update its internal relevant parameters, and thus obtain a trained prediction model.

[0110] Specifically, for machine learning models, the accuracy of their predictions can be measured by a loss function. The loss function is defined on a single training data point and measures the prediction error of that data point. Specifically, the loss value is determined by the label of that single training data point and the model's prediction result for that data. However, in actual training, a training dataset contains many data points. Therefore, a cost function is generally used to measure the overall error of the training dataset. The cost function is defined on the entire training dataset and calculates the average prediction error of all training data points, providing a better measure of the model's prediction performance. For general machine learning models, the aforementioned cost function, plus a regularization term to measure model complexity, forms the training objective function. Based on this objective function, the loss value of the entire training dataset can be calculated. Many types of loss functions are commonly used, such as 0-1 loss, squared loss, absolute loss, logarithmic loss, and cross-entropy loss, which will not be elaborated upon here.

[0111] Specifically, please refer to Figure 6 In some embodiments, the method further includes:

[0112] Step S601: Determine the magnitude of change in the financial data based on the first prediction result;

[0113] Step S602: When the change amplitude is greater than a preset amplitude threshold, record the news event information at the current time node.

[0114] In this embodiment of the application, specifically for numerical prediction types, when financial data experiences significant fluctuations, it is also possible to record trending news at that time for subsequent analysis of the causes of financial data fluctuations. Specifically, the magnitude of change in financial data can be determined based on the first prediction result, for example, by comparing it with financial data at the current time point to determine the percentage change. Then, the magnitude of change is compared with a preset magnitude threshold; when the magnitude of change exceeds the preset threshold, news event information at the current time point can be recorded.

[0115] Please see Figure 7This application also provides a financial data prediction apparatus that can implement the above-mentioned financial data prediction method. The apparatus includes:

[0116] The first acquisition unit is used to acquire news event information at the current time node and historical financial data for a period of time prior to the current time node;

[0117] The second acquisition unit is used to acquire background event information corresponding to the news event information based on the event graph;

[0118] The first extraction unit is used to extract the first feature data of the news event information and the second feature data of the background event information, and to fuse the first feature data and the second feature data to obtain the third feature data.

[0119] The second extraction unit is used to extract the fourth feature data of the historical financial data, and to fuse the fourth feature data and the third feature data to obtain the fifth feature data;

[0120] The processing unit is used to predict the financial data after the current time point based on the fifth feature data and through a prediction model to obtain the first prediction result of the financial data.

[0121] It is understandable that, such as Figure 1 The content of the financial data prediction method embodiments shown is applicable to the financial data prediction device embodiments, and the specific functions implemented by the financial data prediction device embodiments are the same as those shown. Figure 1 The method for predicting financial data shown is the same as the embodiment described above, and the beneficial effects achieved are the same as those described above. Figure 1 The beneficial effects achieved by the financial data prediction method embodiment shown are also the same.

[0122] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned method for predicting financial data. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0123] Please see Figure 8 , Figure 8 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:

[0124] The processor 801 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0125] The memory 802 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 802 and is called by the processor 801 to execute the financial data prediction method of the embodiments of this application.

[0126] The 803 input / output interface is used to implement information input and output.

[0127] The communication interface 804 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0128] Bus 805 transmits information between various components of the device (e.g., processor 801, memory 802, input / output interface 803, and communication interface 804);

[0129] The processor 801, memory 802, input / output interface 803, and communication interface 804 are connected to each other within the device via bus 805.

[0130] It is understandable that, such as Figure 1 The content of the financial data prediction method embodiments shown is applicable to the embodiments of this electronic device, and the specific functions implemented by the embodiments of this electronic device are the same as those shown. Figure 1 The method for predicting financial data shown is the same as the embodiment described above, and the beneficial effects achieved are the same as those described above. Figure 1 The beneficial effects achieved by the financial data prediction method embodiment shown are also the same.

[0131] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for predicting financial data.

[0132] Similarly, it is understandable that, as Figure 1 The content of the financial data prediction method embodiments shown is applicable to the embodiments of this computer-readable storage medium. The specific functions implemented by the embodiments of this computer-readable storage medium are the same as those shown below. Figure 1 The method for predicting financial data shown is the same as the embodiment described above, and the beneficial effects achieved are the same as those described above. Figure 1 The beneficial effects achieved by the financial data prediction method embodiment shown are also the same.

[0133] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0134] The financial data prediction method, device, electronic device, and storage medium provided in this application acquire news event information at the current time point and historical financial data from a period prior to the current time point; acquire background event information corresponding to the news event information based on an event graph; extract first feature data from the news event information and second feature data from the background event information, and fuse the first feature data and the second feature data to obtain third feature data; extract fourth feature data from the historical financial data, and fuse the fourth feature data and the third feature data to obtain fifth feature data; and predict financial data after the current time point using a prediction model based on the fifth feature data to obtain a first prediction result for the financial data. This application improves the accuracy of financial data prediction by mining multiple feature data that influence financial data through information-rich news event information and historical financial data.

[0135] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0136] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0137] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this application are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.

[0138] Furthermore, although this application is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding this application. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional technology for an engineer. Therefore, those skilled in the art can implement the application set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of this application, which is determined by the full scope of the appended claims and their equivalents.

[0139] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0140] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable storage medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0141] More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable storage media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0142] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0143] In the foregoing description of this specification, the references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0144] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

[0145] The above is a detailed description of the preferred embodiments of this application, but this application is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.

Claims

1. A method of predicting financial data, characterized by, The method comprises: obtaining news event information of a current time node and historical financial data within a period of time before the current time node; obtaining background event information corresponding to the news event information according to an event graph; extracting first feature data of the news event information and second feature data of the background event information, fusing the first feature data and the second feature data to obtain third feature data; extracting fourth feature data of the historical financial data, and fusing the fourth feature data and the third feature data to obtain fifth feature data; predicting financial data after the current time node through a prediction model according to the fifth feature data to obtain a first prediction result of the financial data; the first feature data of the news event information comprises: performing word segmentation on the news event information to obtain word groups corresponding to the news event information, and determining word feature data corresponding to each word in the word groups; wherein the word groups comprise a plurality of words; determining the first feature data corresponding to the news event information according to the word feature data corresponding to each word in the word groups; the prediction model is obtained through the following steps: obtaining a batch of sample data and labels; the sample data comprises sample news event information of a first time node and sample historical financial data corresponding to the sample news event information; the labels are used to represent the increasing or decreasing trend or actual value of sample financial data after the first time node; obtaining sample background event information corresponding to the sample news event information according to an event graph; obtaining sample feature data according to the sample news event information, sample background event information and sample historical financial data; predicting sample financial data after the first time node through an initialized prediction model according to the sample feature data to obtain a second prediction result of the sample financial data; determining a loss value of training according to the second prediction result and the labels; updating parameters of the prediction model according to the loss value to obtain a trained prediction model.

2. The method of claim 1, wherein, The event graph comprises a plurality of nodes and edges, the nodes are used to represent events, and the edges are used to represent the association relationship between events; obtaining background event information corresponding to the news event information according to an event graph comprises: determining a target node in the event graph according to an event corresponding to the news event information; finding a background node whose number of edges with the target node is less than a preset number threshold; obtaining the background event information according to an event represented by the background node.

3. The method as claimed in claim 1, wherein, The word feature data comprises a word embedding vector; determining the word feature data corresponding to each word in the word groups comprises: mapping the word to a vector space to obtain a word embedding vector corresponding to the word; determining the first feature data corresponding to the news event information according to the word feature data corresponding to each word in the word groups comprises: accumulating the word embedding vectors corresponding to each word in the word groups to obtain a first vector; normalizing the first vector to obtain the first feature data.

4. The method of claim 1, wherein, The fusing the first feature data and the second feature data to obtain third feature data comprises: performing weighted summation on the first feature data and the second feature data to obtain third feature data; or, splicing the first feature data and the second feature data to obtain third feature data.

5. The method of claim 1, wherein, The method further comprises: determining a change amplitude of the financial data according to the first prediction result; when the change amplitude is greater than a preset amplitude threshold, recording news event information of a current time node.

6. A financial data prediction device characterized by comprising: The device comprises: a first obtaining unit configured to obtain news event information of a current time node and historical financial data within a period of time before the current time node; a second obtaining unit configured to obtain background event information corresponding to the news event information according to an event graph; a first extracting unit configured to extract first feature data of the news event information and second feature data of the background event information, and fuse the first feature data and the second feature data to obtain third feature data; a second extracting unit configured to extract fourth feature data of the historical financial data, and fuse the fourth feature data and the third feature data to obtain fifth feature data; a processing unit configured to predict financial data after the current time node according to the fifth feature data through a prediction model to obtain a first prediction result of the financial data; The first extracting unit is specifically configured to: perform word segmentation processing on the news event information to obtain word groups corresponding to the news event information, and determine word feature data corresponding to each word in the word groups; wherein the word groups comprise a plurality of words; determine first feature data corresponding to the news event information according to the word feature data corresponding to each word in the word groups; The prediction model is obtained through the following steps: obtain a batch of sample data and labels; the sample data comprises sample news event information of a first time node and sample historical financial data corresponding to the sample news event information; the labels are used to represent an increase / decrease trend or an actual value of sample financial data after the first time node; obtain sample background event information corresponding to the sample news event information according to an event graph; obtain sample feature data according to the sample news event information, sample background event information and sample historical financial data; predict sample financial data after the first time node through an initialized prediction model according to the sample feature data to obtain a second prediction result of the sample financial data; determine a loss value of training according to the second prediction result and the labels; update parameters of the prediction model according to the loss value to obtain a trained prediction model.

7. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the financial data prediction method in any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising: The computer program, when executed by a processor, implements the method of claim 1 to 5 for the prediction of financial data.

Citation Information

Patent Citations

  • Stock market trend prediction method and device, computer equipment and storage medium

    CN110489631A

  • Financial risk prediction method and device based on time domain information and storage medium

    CN111681091A