Disclosure of Invention
In view of the above, an embodiment of the present invention provides a financial pneumatic control system and a financial pneumatic control method based on a block chain and public sentiment, and aims to automatically monitor financial public sentiment. The specific technical scheme is as follows:
in a first aspect of embodiments of the present invention, a financial wind control system based on a blockchain and public sentiment is provided, where the financial wind control system includes a public sentiment collection module and a blockchain network, the blockchain network includes a plurality of node devices, and the public sentiment collection module is in communication connection with a specified node device of the plurality of node devices;
wherein, public opinion collection module is used for: detecting the number of newly added comments in a target website every a preset time length, and judging whether the number of the newly added comments exceeds a preset threshold value, wherein the target website is a pre-designated website related to finance; under the condition that the number of the newly added comments does not exceed a preset threshold value, ending the public opinion monitoring process in the current period; under the condition that the number of newly added comments exceeds a preset threshold value, obtaining popular comments from the newly added comments, and determining word vectors of the popular comments;
public opinion collection module still is used for: signing the word vector by using a private key of the self to obtain a signed word vector, and submitting the signed word vector to a specified node device in the block chain network;
the designated node device of the blockchain network is configured to: after receiving the signed word vector, broadcasting the signed word vector to each node device in the block chain network;
each node device of the blockchain network is configured to: after receiving the signed word vector, performing signature verification on the signed word vector by using a public key of the public opinion acquisition module, and inputting the word vector into a pre-trained BP neural network for detecting public opinions under the condition that the signature verification is passed to obtain a detection result output by the BP neural network, wherein the higher the numerical value of the detection result is, the higher the public opinion risk is represented;
each node device of the blockchain network is further configured to: after the detection result is obtained, determining a numerical interval to which the detection result belongs, and determining the public opinion risk degree as the public opinion risk degree corresponding to the numerical interval;
the node devices of the block chain network mutually identify the public opinion risk degrees determined by the node devices, and for the node devices which do not pass the common identification, the node devices automatically start an offline process to quit the block chain network; and for the appointed node equipment passing the consensus, the appointed node equipment sends the determined public opinion risk degree to the terminal equipment of the administrator.
In a second aspect of the embodiments of the present invention, there is provided a financial wind control method based on blockchain and public sentiment, the method being applied to a blockchain network, the method including:
after receiving the signed word vector sent by the public opinion acquisition module, the appointed equipment of the block chain network broadcasts the signed word vector to each node equipment in the block chain network;
after receiving the signed word vector, each node device of the block chain network utilizes a public key of the public opinion acquisition module to carry out signature verification on the signed word vector, and under the condition that the signature verification is passed, the word vector is input into a pre-trained BP neural network for detecting public opinions to obtain a detection result output by the BP neural network, wherein the higher the numerical value of the detection result is, the higher the public opinion risk is;
after each node device of the block chain network obtains the detection result, determining a numerical interval to which the detection result belongs, and determining the public opinion risk degree as the public opinion risk degree corresponding to the numerical interval;
the node devices of the block chain network mutually identify the public opinion risk degrees determined by the node devices, and for the node devices which do not pass the common identification, the node devices automatically start an offline process to quit the block chain network; for the appointed node equipment which passes the consensus, the appointed node equipment sends the determined public opinion risk degree to the terminal equipment of the administrator;
the public opinion acquisition module obtains the signed word vector in the following mode: detecting the number of newly added comments in a target website every a preset time length, and judging whether the number of the newly added comments exceeds a preset threshold value, wherein the target website is a pre-designated website related to finance; under the condition that the number of the newly added comments does not exceed a preset threshold value, ending the public opinion monitoring process in the current period; under the condition that the number of newly added comments exceeds a preset threshold value, obtaining popular comments from the newly added comments, and determining word vectors of the popular comments; and signing the word vector by using a private key of the word vector to obtain the signed word vector.
In the invention, a public opinion acquisition module is used for monitoring a target website related to finance, simultaneously acquiring popular comments in the target website, and converting the popular comments into word vectors, thereby realizing the automatic acquisition of public opinions. And under the condition that the number of newly added comments does not exceed a preset threshold value, namely under the condition that no major public sentiment is generated, ending the public sentiment monitoring flow in the current period; and when the number of the newly added comments exceeds a preset threshold value, namely when major public opinions are generated, the public opinion monitoring process in the current period is continued. Therefore, the computing resources can be efficiently utilized, and the excessive consumption of the computing resources under the condition that no great public opinion appears is avoided.
In addition, the public opinion collection module submits the word vectors to the block chain network, and the word vectors are processed through the block chain network so as to obtain the public opinion risk degree. A plurality of node equipment in the block chain network can be known to public opinion risk degree each other to deposit the evidence to public opinion risk degree through knowing, and prevent that public opinion risk degree from being tampered with.
In addition, in consideration of the instability of the BP neural network, although different node devices store the same BP neural network and input the same word vector, the detection results output by the respective BP neural networks may have slight differences. In order to avoid that all node devices cannot pass the consensus due to small difference of detection results, the detection results are mapped to the numerical range, so that the detection results are mapped to the public opinion risk degree corresponding to the numerical range, and finally the public opinion risk degree is subjected to consensus, so that the consensus passing rate can be improved.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
With the development of financial science and technology and internet technology, more and more investors tend to collect information such as macroscopic economic policies, enterprise management conditions, stock market trends and the like by means of the internet, and express their own opinions and moods on financial investment by means of the internet. Considering that the financial industry has an extremely important influence on the economic safety of the country, for this reason, the regulatory body needs to supervise the financial industry in multiple dimensions. However, since public opinion information is usually difficult to collect and mostly text information, it is difficult to automatically determine financial risk status according to public opinion.
In view of the above, the present invention provides a financial wind control system and a financial wind control method based on block chains and public sentiments through the following embodiments, aiming at automatically monitoring financial public sentiments.
Referring to fig. 1, fig. 1 is a schematic diagram of a financial wind control system based on block chains and public sentiments according to an embodiment of the present invention. As shown in fig. 1, the financial wind control system includes a public opinion collecting module and a block chain network. The block chain network comprises a plurality of node devices, and the public opinion acquisition module is in communication connection with the designated node devices in the node devices.
In specific implementation, the designated node equipment may be manually designated in advance, and the designated node equipment may be multiple, and when a certain designated node equipment is down or exits from the blockchain network (i.e., is offline), the designated node equipment may be switched to another designated node equipment to be in communication connection with the public opinion acquisition module.
As shown in fig. 1, the public opinion collection module is used for: detecting the number of newly added comments in a target website every a preset time length, and judging whether the number of the newly added comments exceeds a preset threshold value, wherein the target website is a pre-designated website related to finance; under the condition that the number of the newly added comments does not exceed a preset threshold value, ending the public opinion monitoring process in the current period; and under the condition that the number of the newly added comments exceeds a preset threshold value, obtaining popular comments from the newly added comments, and determining word vectors of the popular comments. To simplify the drawing, fig. 1 only briefly shows the case where the number of newly added comments exceeds a preset threshold.
For the sake of understanding, it is assumed that the target website is a financial forum, and the preset time period is 24 hours, and the preset threshold is 1000. The public opinion collecting module can count the total number of newly added comments (namely the number of newly added comments) in the forum in the last 24 hours at 12 am every day. If the total number of the newly added comments does not exceed 1000, the fact that the past 24 hours do not generate significant public sentiment is shown, and therefore, the follow-up public sentiment analysis can not be continuously performed. On the other hand, if the total number of newly added comments exceeds 1000, it indicates that significant public sentiment is generated within the past 24 hours, so that in order to prevent and control the financial public sentiment risk, it is necessary to perform the subsequent public sentiment analysis.
Optionally, in some specific embodiments, the public opinion collecting module is specifically configured to, when obtaining popular comments from newly-added comments: for each newly added comment, determining a word vector of the newly added comment; respectively calculating vector distance between the word vector and each other word vector according to each word vector, and if the vector distance is smaller than a preset distance, determining the word vector and the other word vector as similar word vectors; and finally, determining newly-added comments with the most similar word vectors as popular comments according to the number of the similar word vectors of each word vector.
For the sake of understanding, it is assumed that the number of newly added comments is 1200, and 1000 are over the preset threshold. Then, the public opinion collecting module inputs each new comment in the 1200 new comments into a word vector model (for example, a word2vec model), so as to obtain a word vector generated for the new comment by the word vector model.
Then, the public opinion collection module calculates vector distances between each word vector and the rest 1199 word vectors respectively to obtain 1199 vector distances. Then, it is determined how many of the 1199 vector distances are smaller than the preset distance. If the distance between N vectors is smaller than the preset distance, the word vector has N similar word vectors. Through the steps, the number of similar word vectors in each word vector can be determined.
Assuming that the 206 th word vector has the most similar word vectors in the 1200 word vectors, the newly added comment corresponding to the 206 th word vector is determined as the popular comment.
As shown in fig. 1, the public opinion collection module is further configured to: and signing the word vector by using a private key of the self to obtain a signed word vector, and submitting the signed word vector to a specified node device in the block chain network.
As shown in fig. 1, the designated node device of the blockchain network is configured to: and after receiving the signed word vector, broadcasting the signed word vector to each node device in the block chain network.
As shown in fig. 1, each node device of the blockchain network is configured to: after the signed word vector is received, signature verification is carried out on the signed word vector by using a public key of the public opinion acquisition module, and under the condition that the signature verification is passed, the word vector is input into a pre-trained BP neural network for detecting public opinions to obtain a detection result output by the BP neural network, wherein the higher the numerical value of the detection result is, the higher the public opinion risk is. It should be noted that, in order to simplify the drawing, only a part of the nodes performing the above steps is briefly shown in fig. 1. It will be appreciated that in practice each node within the blockchain network will need to perform the steps described above.
As shown in fig. 1, each node device of the blockchain network is further configured to: after the detection result is obtained, determining a numerical interval to which the detection result belongs, and determining the public opinion risk degree as the public opinion risk degree corresponding to the numerical interval.
Optionally, in some specific embodiments, each node device of the blockchain network is preset with a numerical interval table of public opinion risk degrees, where the numerical interval table includes a plurality of numerical intervals and a public opinion risk degree corresponding to each numerical interval; wherein, the higher the value in the value interval is, the higher the public opinion risk degree corresponding to the value interval is.
For convenience of understanding, each node device is preset with a numerical interval table of public opinion risk degrees shown in table 1, for example.
Table 1 public opinion risk degree value interval table
Interval of values
|
Public opinion risk degree
|
[0,0.3)
|
Low risk
|
[0.3,0.7)
|
Middle risk
|
[0.7,1]
|
High risk |
Assuming that after a certain node of the block chain network inputs a word vector into a BP neural network for detecting public sentiment, the detection result output by the BP neural network is 0.83, and since 0.83 belongs to the interval [0.7,1], the node determines the public sentiment risk degree "high risk" corresponding to the interval [0.7,1] as the actual public sentiment risk degree.
Further, assuming that after another node of the block chain network inputs the word vector into the BP neural network for detecting public sentiment, the detection result output by the BP neural network is 0.81, and since 0.81 belongs to the interval [0.7,1], the node also determines the public sentiment risk degree "high risk" corresponding to the interval [0.7,1] as the actual public sentiment risk degree.
As can be seen from the above examples, in the present invention, in consideration of the instability of the BP neural network, although different node devices store the same BP neural network and input the same word vector, the detection results output by the respective BP neural networks may have slight differences. In order to avoid that all node devices cannot pass the consensus due to small difference of detection results, the detection results are mapped to the numerical range, so that the detection results are mapped to the public opinion risk degree corresponding to the numerical range, and finally the public opinion risk degree is subjected to consensus, so that the consensus passing rate can be improved.
As shown in fig. 1, a plurality of node devices in a blockchain network mutually identify the public opinion risk degrees determined by the node devices, and for a node device that fails to pass the identification, the node device automatically starts a offline process to exit the blockchain network; and for the appointed node equipment passing the consensus, the appointed node equipment sends the determined public opinion risk degree to the terminal equipment of the administrator. To simplify the drawing, fig. 1 only schematically illustrates a process of making consensus among some nodes.
In a specific implementation, each node device of the block chain network broadcasts the public opinion risk degree determined by itself to other node devices after determining the public opinion risk degree, and meanwhile, the node also receives the public opinion risk degree broadcasted by other node devices. The node equipment compares the public opinion risk degree determined by the node equipment with the public opinion risk degrees determined by other node equipment one by one, and if the public opinion risk degree determined by the node equipment is consistent with the public opinion risk degree of the node equipment exceeding 51%, the node equipment determines that the node equipment passes consensus. Otherwise, the node device determines that the node device does not pass the consensus.
If a node device determines that the node device does not pass the consensus, the node device can automatically start an offline process to exit the blockchain network. If the appointed node equipment determines that the appointed node equipment passes the consensus, the appointed node equipment actively sends the public opinion risk degree determined by the appointed node equipment to the terminal equipment of the administrator.
As previously mentioned, the BP neural network is considered to have instability. In order to avoid the node being offline as much as possible due to the instability of the BP neural network, optionally, in some embodiments, when the node devices of the blockchain network do not pass the consensus, a numerical interval corresponding to the consensus public opinion risk degree may be determined first, and then the detection result obtained by the node devices may be compared with the numerical interval; if the difference between the detection result and the nearest endpoint value does not exceed the preset difference, the node equipment does not start the offline process, and the public opinion risk degree determined by the node equipment is adjusted to be the public opinion risk degree passing through consensus; and if the difference between the detection result and the nearest endpoint value exceeds a preset difference, the node equipment automatically starts the offline process.
For ease of understanding, assume for example that the preset difference is 0.05. Further, assume that after a certain node device inputs a word vector into the BP neural network, the detection result output by the BP neural network is equal to 0.68, and therefore the public opinion risk degree mapped by the node device is a medium risk. However, the node apparatus receives the public opinion risk degree of other node apparatuses as high risk in large part, and thus the node apparatus determines that it does not pass the consensus itself. In response to this, the node apparatus first determines that the high risk is a degree of public opinion risk by consensus, and determines that its corresponding numerical range is [0.7,1 ]. Since the detection result of the node device itself is 0.68, the endpoint value closest to 0.68 in the interval [0.7,1] is 0.7. Again, since the difference between 0.7 and 0.68 is equal to 0.02, the preset difference of 0.05 is not exceeded. Therefore, the node device does not start the offline process, and the node device adjusts the public opinion risk degree determined by the node device from the middle risk degree to the high risk degree, and records the public opinion risk degree from the middle risk degree to the high risk degree to the self account book database.
Optionally, in some embodiments, the BP neural network for detecting public sentiment is trained by: collecting a plurality of sample comments, configuring a financial public opinion risk score for each sample comment, and determining a sample word vector of each sample comment; for each sample comment, inputting a sample word vector corresponding to the sample comment into a preset BP (back propagation) neural network to obtain a detection result output by the BP neural network, calculating a difference value between the detection result and a financial public opinion risk score of the sample comment, and taking the difference value as a loss value to update the BP neural network; and determining the BP neural network after multiple rounds of training as the BP neural network for detecting public sentiment.
For ease of understanding, assume, by way of example, that 500 sample reviews were gathered. Each sample review may then be manually configured with a financial opinion risk score. For example, 150 configured financial public opinion risk scores in 500 sample reviews are equal to 0.15, another 150 configured financial public opinion risk scores are equal to 0.85, and the remaining 200 configured financial public opinion risk scores are equal to 0.50.
And then determining a sample word vector of each sample comment aiming at each sample comment, and inputting the sample word vector into a preset BP neural network to obtain a detection result output by the BP neural network. And calculating the absolute value between the detection result and the financial public opinion risk score of the sample comment. And finally, the calculated absolute value is used as a loss value and is propagated reversely in the BP neural network, so that the BP neural network is updated and trained.
Through the mode, the 500 sample comments are sequentially utilized to train the BP neural network, and finally the trained BP neural network is obtained and can be used for detecting public sentiment.
Based on the same inventive concept, the invention also provides a financial wind control method based on the block chain and the public sentiment. Referring to fig. 2, fig. 2 is a flowchart of a financial pneumatic control method based on block chains and public sentiments according to an embodiment of the present invention. It should be noted that the financial wind control method shown in fig. 2 may be cross-referenced with the financial wind control system shown in fig. 1.
The financial wind control method shown in fig. 2 is applied to a block chain network, and as shown in fig. 2, the financial wind control method includes the following steps:
step S21: after receiving the signed word vector sent by the public opinion acquisition module, the appointed equipment of the block chain network broadcasts the signed word vector to each node equipment in the block chain network.
Step S22: after receiving the signed word vector, each node device of the block chain network utilizes the public key of the public opinion acquisition module to perform signature verification on the signed word vector, and inputs the word vector into a pre-trained BP neural network for detecting public opinions under the condition that the signature verification is passed, so as to obtain a detection result output by the BP neural network, wherein the higher the numerical value of the detection result is, the higher the public opinion risk is.
Step S23: after obtaining the detection result, each node device of the block chain network determines a numerical interval to which the detection result belongs, so that the public opinion risk degree is determined as the public opinion risk degree corresponding to the numerical interval.
Step S24: the node devices of the block chain network mutually identify the public opinion risk degrees determined by the node devices, and for the node devices which do not pass the common identification, the node devices automatically start an offline process to quit the block chain network; and for the appointed node equipment passing the consensus, the appointed node equipment sends the determined public opinion risk degree to the terminal equipment of the administrator.
The public opinion acquisition module obtains the signed word vector in the following mode: detecting the number of newly added comments in a target website every a preset time length, and judging whether the number of the newly added comments exceeds a preset threshold value, wherein the target website is a pre-designated website related to finance; under the condition that the number of the newly added comments does not exceed a preset threshold value, ending the public opinion monitoring process in the current period; under the condition that the number of newly added comments exceeds a preset threshold value, obtaining popular comments from the newly added comments, and determining word vectors of the popular comments; and signing the word vector by using a private key of the word vector to obtain the signed word vector.
Optionally, in some specific embodiments, the public opinion collecting module, when obtaining popular comments from newly-added comments, includes: for each newly added comment, determining a word vector of the newly added comment; respectively calculating vector distance between the word vector and each other word vector according to each word vector, and if the vector distance is smaller than a preset distance, determining the word vector and the other word vector as similar word vectors; and finally, determining newly-added comments with the most similar word vectors as popular comments according to the number of the similar word vectors of each word vector.
Optionally, in some specific embodiments, each node device of the blockchain network presets a numerical interval table of public opinion risk degrees, where the numerical interval table includes a plurality of numerical intervals and a public opinion risk degree corresponding to each numerical interval; wherein, the higher the value in the value interval is, the higher the public opinion risk degree corresponding to the value interval is.
Optionally, in some specific embodiments, when the step S24 is executed, for a node device that fails to pass the consensus, the node device automatically starts a logoff process, which specifically includes the following sub-steps:
substep S24-1: under the condition that the node equipment of the block chain network does not pass the consensus, firstly, a numerical interval corresponding to the consensus public opinion risk degree is determined, and then the detection result obtained by the node equipment is compared with the numerical interval.
Substep S24-2: and if the difference between the detection result and the nearest endpoint value does not exceed the preset difference, the node equipment does not start the offline process, and adjusts the self-determined public opinion risk degree into the public opinion risk degree passing through consensus.
Substep S24-3: and if the difference between the detection result and the nearest endpoint value exceeds a preset difference, the node equipment automatically starts the offline process.
Optionally, in some embodiments, the BP neural network for detecting public sentiment is trained by: collecting a plurality of sample comments, configuring a financial public opinion risk score for each sample comment, and determining a sample word vector of each sample comment; for each sample comment, inputting a sample word vector corresponding to the sample comment into a preset BP (back propagation) neural network to obtain a detection result output by the BP neural network, calculating a difference value between the detection result and a financial public opinion risk score of the sample comment, and taking the difference value as a loss value to update the BP neural network; and determining the BP neural network after multiple rounds of training as the BP neural network for detecting public sentiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.