CN114186646A - Block chain abnormal transaction identification method and device, storage medium and electronic equipment - Google Patents
Block chain abnormal transaction identification method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN114186646A CN114186646A CN202210139400.5A CN202210139400A CN114186646A CN 114186646 A CN114186646 A CN 114186646A CN 202210139400 A CN202210139400 A CN 202210139400A CN 114186646 A CN114186646 A CN 114186646A
- Authority
- CN
- China
- Prior art keywords
- transaction
- data
- identification
- transaction data
- blockchain
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/243—Classification techniques relating to the number of classes
- G06F18/24323—Tree-organised classifiers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2415—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
- G06F18/24155—Bayesian classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Abstract
The invention provides a method and a device for identifying abnormal transactions of a block chain, a storage medium and electronic equipment, wherein the method comprises the following steps: responding to the transaction identification instruction, and acquiring blockchain transaction data to be identified; identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data. By applying the method provided by the embodiment of the invention, the transaction data to be recognized is recognized through the transaction recognition model obtained by training the training sample set, so that the recognition accuracy of the transaction data can be effectively improved.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a method and a device for identifying abnormal transactions of a block chain, a storage medium and electronic equipment.
Background
With the development of computer science and technology, more and more users perform online transactions, for example, transactions can be performed through a blockchain, which brings great convenience to the users.
In the prior art, abnormal transactions are usually identified by setting rule strategies, quantitative indexes and other modes, however, manual intervention is usually required by adopting such modes, diversified risks cannot be coped with, and the identification accuracy of abnormal transaction data of a block chain is low.
Disclosure of Invention
The invention aims to provide a block chain abnormal transaction identification method, which can improve the identification accuracy of transaction data.
The invention also provides a device for identifying abnormal transactions of the block chain, which is used for ensuring the realization and the application of the method in practice.
A blockchain abnormal transaction identification method comprises the following steps:
responding to the transaction identification instruction, and acquiring blockchain transaction data to be identified;
identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
Optionally, the above method, where the identifying the to-be-identified blockchain transaction data to obtain the identification result of the blockchain transaction data includes:
processing the block chain transaction data by using each decision sub-tree model in the transaction identification model to obtain a decision result output by each decision sub-tree;
and voting by using a voting module in the transaction identification model based on the decision result output by each decision sub-tree to obtain the identification result of the blockchain transaction data.
Optionally, the method for obtaining the transaction identification model by training with a training sample set includes:
acquiring a training sample set;
training by applying a preset random forest algorithm based on preset initial parameters and the training sample set to obtain a random forest model, wherein the random forest model comprises a plurality of decision subtrees;
and taking the random forest model as a transaction identification model.
Optionally, the method, after obtaining the random forest model by applying a preset random forest algorithm and training based on preset initial parameters and the training sample set, further includes:
and optimizing the parameters of the random forest model by using a preset Bayesian optimization algorithm.
In the foregoing method, optionally, after obtaining the identification result of the blockchain transaction data, the method further includes:
and under the condition that the identification result of the blockchain transaction data represents that the blockchain transaction data is abnormal transaction data, generating alarm information of the blockchain transaction data, and outputting the alarm information.
A blockchain abnormal transaction identification apparatus comprising:
the acquisition unit is used for responding to the transaction identification instruction and acquiring the block chain transaction data to be identified;
the identification unit is used for identifying the blockchain transaction data by utilizing a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by utilizing a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
The above apparatus, optionally, the identification unit includes:
the processing subunit is configured to utilize each decision sub-tree model in the transaction identification model to respectively process the block chain transaction data, so as to obtain a decision result output by each decision sub-tree;
and the voting subunit is used for voting based on the decision result output by each decision sub-tree by using a voting module in the transaction identification model to obtain the identification result of the block chain transaction data.
The above apparatus, optionally, the identification unit includes:
the acquisition subunit is used for acquiring a training sample set;
the training subunit is used for applying a preset random forest algorithm to obtain a random forest model based on preset initial parameters and training of the training sample set, and the random forest model comprises a plurality of decision-making subtrees;
and the execution subunit is used for taking the random forest model as a transaction identification model.
A storage medium, comprising storage instructions, wherein when the instructions are executed, a device in which the storage medium is located is controlled to execute the above block chain abnormal transaction identification method.
An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the blockchain exception transaction identification method as described above.
Compared with the prior art, the invention has the following advantages:
the invention provides a method and a device for identifying abnormal transactions of a block chain, a storage medium and electronic equipment, wherein the method comprises the following steps: responding to the transaction identification instruction, and acquiring blockchain transaction data to be identified; identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data. By applying the method provided by the embodiment of the invention, the transaction identification model obtained by training the training sample set is used for identifying the block chain transaction data to be identified, so that the identification accuracy of the block chain transaction data can be effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for identifying abnormal transactions in a blockchain according to the present invention;
FIG. 2 is a flow chart of a process for obtaining an identification of blockchain transaction data in accordance with the present invention;
FIG. 3 is a flowchart of a process for obtaining a transaction identification model by training with a training sample set according to the present invention;
FIG. 4 is a flow chart of a process for constructing a transaction identification model according to the present invention;
FIG. 5 is a flow chart of a process for constructing a random forest model according to the present invention;
fig. 6 is a schematic structural diagram of a blockchain abnormal transaction identification apparatus according to the present invention;
fig. 7 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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.
In this application, 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.
The embodiment of the invention provides a method for identifying abnormal transactions of a block chain, which can be applied to electronic equipment, wherein the electronic equipment can be a block chain node, and a flow chart of the method is shown in fig. 1 and specifically comprises the following steps:
s101: and responding to the transaction identification instruction, and acquiring the blockchain transaction data to be identified.
In this embodiment, the blockchain transaction data may be transaction data generated during a blockchain transaction, and the blockchain transaction data may include local information such as a timestamp, an amount of money, a transaction fee, and the like, and aggregation information of neighboring nodes.
S102: identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
In this embodiment, the transaction identification model may include a preset number of weak learners, the weak learners may be decision trees, the blockchain transaction data may be input into the transaction identification model, each weak learner processes the blockchain transaction data, the identification result may be obtained by voting according to the output of each weak learner, and the identification accuracy of the transaction identification model satisfies a preset accuracy threshold.
Optionally, the transaction sample data provided with the first tag may be historical blockchain transaction data of a legal type, the transaction sample data provided with the second tag may be historical blockchain transaction data of an illegal type, and optionally, the training sample set further includes transaction sample data provided with a third tag, and the type of the transaction sample data to which the third tag represents is unknown.
The transaction identification result can represent the type of the blockchain transaction data, and the type can be a normal type or an abnormal type.
By applying the method provided by the embodiment of the invention, the transaction identification model obtained by training the training sample set is used for identifying the block chain transaction data to be identified, so that the identification accuracy of the block chain transaction data can be effectively improved.
In an embodiment of the invention, based on the implementation process, optionally, the identifying the blockchain transaction data by using the identification to obtain the identification result of the blockchain transaction data is as shown in fig. 2, where the identifying includes:
s201: and processing the block chain transaction data by using each decision sub-tree in the transaction identification model to obtain a decision result output by each decision sub-tree.
In this embodiment, the decision result output by each sub-decision may indicate that the type of the blockchain transaction data is a normal type or an abnormal type.
S202: and voting by using a voting module in the transaction identification model based on the decision result output by each decision sub-tree to obtain the identification result of the blockchain transaction data.
In this embodiment, one feasible way of voting based on the decision result output by each decision sub-tree by using the voting module in the transaction identification model is as follows: determining a first number of decision results characterized as being of a normal type and a second number of decision results characterized as being of an abnormal type; comparing the first number with the second number; determining that the identification result of the blockchain transaction data is a normal type under the condition that the first quantity is larger than the second quantity, namely that the blockchain transaction data is legal transaction data; and under the condition that the second quantity is larger than the first quantity, determining that the identification result of the block chain transaction data is of an abnormal type, namely the block chain transaction data is illegal transaction data.
In an embodiment provided by the present invention, based on the implementation process, optionally, the transaction identification model is obtained by training with a training sample set, as shown in fig. 3, specifically including:
s301: a training sample set is obtained.
In this embodiment, the training sample set may be obtained by sampling the original data set based on a hierarchical sampling algorithm, and the influence of a large difference between positive and negative sample data is eliminated by using the advantages of the hierarchical sampling algorithm, so that the recognition performance of the transaction recognition model can be effectively improved.
Specifically, the original data set may be layered according to entity types of samples in the original data set, where the entity types may include a legal entity and an illegal entity; after layering, calculating the number of samples of each layer, thereby dividing an original data set into a training set and a testing set, specifically as follows:
optionally, N is the total number of units,is the unit number of the ith layer, n is the total number of samples,is the ith layer sample number.
S302: and training by applying a preset random forest algorithm based on preset initial parameters and the training sample set to obtain a random forest model, wherein the random forest model comprises a plurality of decision subtrees.
In this embodiment, the initial parameters may include the number of the decision trees and the maximum depth, and the process of obtaining the random forest model by applying a preset random forest algorithm based on the preset initial parameters and training of the training sample set may be as follows:
determining a root node, acquiring a data set D from a training sample set, and determining a Gini coefficient threshold and a minimum sample number threshold;
the data set of the current processing node is D, if the number of samples is less than a threshold value, a decision sub-tree is returned, and the recursion of the current node is stopped;
calculating the Gini coefficient of the data set D, if the Gini coefficient is smaller than a threshold value, returning to a decision sub-tree, and stopping the recursion of the current node, wherein the Gini coefficient formula is as follows:
wherein, p (x)i) Is class xiThe probability of occurrence, n, is the number of classifications.
Optionally, under the condition of the feature a, the Gini coefficient of the data set D is defined as:
selecting the smallest Gini coefficient from the Gini coefficients calculated by all the characteristics, and dividing the data set D into D according to the characteristics A and the demarcation point a of the smallest Gini coefficient1And D2Two parts, simultaneously generating the two parts respectively as D1And D2The data set comprises a left child node and a right child node; and recursively splitting the newly generated child nodes according to the steps to generate a decision sub-tree, wherein the characteristics can be transaction sample data in the data set D.
And taking each decision sub-tree as a weak learner, outputting a decision result, and finally outputting a recognition result according to a majority voting principle.
S303: and taking the random forest model as a transaction identification model.
By applying the method provided by the embodiment of the invention, the transaction identification model can be quickly obtained.
In an embodiment provided by the present invention, based on the foregoing implementation process, optionally, after the applying a preset random forest algorithm to obtain a random forest model based on preset initial parameters and training of the training sample set, the method further includes:
and optimizing the parameters of the random forest model by using a preset Bayesian optimization algorithm.
In the embodiment of the present invention, random forest model parameters including the initial number of decision trees and the maximum depth may be initialized, and model optimization is performed by using a bayesian optimization algorithm to obtain optimal characteristic parameters, that is, the optimal number of preset decision trees n _ estimators and the maximum depth max _ depth, where the bayesian optimization algorithm is as follows:
the Bayesian optimization is divided into two parts: updating the prior probability agent model and selecting the optimal hyper-parameter combination according to the acquisition function.
(1) Constructing a Bayesian optimization objective function:
wherein the content of the first and second substances,the optimal hyperparameter determined for the Bayesian optimization, w, is a group of hyperparameter combinations, which may be [ n _ estimators, max _ depth [ ], among]I.e. the number of trees and the maximum depth of the decision sub-tree, W is the hyperparametric space,may be a precision ratio.
(2) A hyper-parametric observation data set DiInputting the hyper-parametric optimization objective function g (w) into a Gaussian regression process to obtainBayes optimization of the prior probability model of the objective function:
wherein D isiFor a given observation data set, a human is usually the same as the model training data set, N (. quadrature.) is a standard normal distribution, gi+1For the objective function of the next iteration,is the mean value of the objective function for the next iteration,is the target function variance for the next iteration.
(3) Calculating the next observation point w by adopting EI as an acquisition function based on the prior probability distribution obtained in the step (2)i+1=argmax EI (wi|Di) Wherein w isi+1Is the observation point of the next iteration;
wherein, V*For the current value of the optimum function,is a standard normal distribution probability density function.
(4) According to the observation point w obtained in the last stepi+1G (w) is calculatedi+1) Updating the observation data set。
(5) And (4) repeating the steps (2) to (4) until the requirement of the objective function value is met, stopping iteration and outputting the optimal hyper-parameter combination.
Adjusting parameters and outputting a model according to the predicted result AUC coefficient, wherein the AUC coefficient is the area of an ROC curve, and the horizontal and vertical axes of the ROC curve are FPR and TPR:
wherein FP is false positive rate, TN is true negative rate, TP is true positive rate, FN is false negative rate.
By applying the method provided by the embodiment of the invention, parameter adjustment optimization is carried out on the random forest model based on a Bayesian optimization mode, the fitting capability of each decision tree is improved, and the false positive rate is reduced under the condition of not increasing the false negative rate. Bayesian optimization is added on the basis of a random forest algorithm, and hyper-parameters can be automatically adjusted, so that the effect of intelligently obtaining an optimal model is achieved.
In an embodiment of the present invention, based on the implementation process, optionally, after obtaining the identification result of the blockchain transaction data, the method further includes:
and under the condition that the identification result of the blockchain transaction data represents that the blockchain transaction data is abnormal transaction data, generating alarm information of the blockchain transaction data, and outputting the alarm information.
In the embodiment of the invention, the identification result can be displayed on a preset display interface.
The method for identifying abnormal transactions of a blockchain provided by the embodiment of the invention can be applied to various fields, for example, can be applied to identification of transaction data of the blockchain, as shown in fig. 4, which is a flow chart of a construction process of a transaction identification model provided by the embodiment of the invention, an original data set of the blockchain transaction can be obtained first, wherein the original data set comprises transaction sample data provided with a first tag, transaction sample data provided with a second tag and transaction sample data provided with a third tag; the transaction sample data may include local information such as a timestamp, amount of money, transaction fee, and the like, as well as aggregated information of neighboring nodes. Wherein the original data set may have been previously entered by the user. After the original data set is obtained, the original data set can be divided into a training set and a testing set according to a hierarchical sampling principle, model training is carried out by utilizing the training set to obtain a transaction identification model, the transaction identification model comprises a plurality of weak learners, the weak learners can be decision subtrees, voting can be carried out according to the output of each weak learner, and the voting result is used as the identification result of the transaction identification model and is output.
In this embodiment, the transaction recognition model may be a random forest model, and parameters of the random forest model may be optimized by using a bayesian optimization algorithm, specifically, as shown in fig. 5, a flow chart of a construction process of the random forest model provided in the embodiment of the present invention may obtain raw data, perform hierarchical sampling on the raw data to obtain a training sample set and a test set, input the training sample set into the random forest model for training, and adjust the parameters by using the bayesian optimization algorithm to obtain an optimal model.
In some embodiments, the data to be predicted may be input into the trained optimal model, and the recognition result may be output.
Optionally, the blockchain transaction data to be identified is daily blockchain transaction data for which exception detection is desired, for example, the blockchain transaction data may be transaction data generated by a blockchain transaction currency platform such as an ethernet shop; the trained transaction recognition model comprises a plurality of weak learners, namely a plurality of decision subtrees, if each decision result output by the learner is output, voting is carried out according to each decision result, and the result with a large number of votes is the final recognition result of the transaction data.
By applying the method provided by the embodiment of the invention, because the random forest model has extremely excellent performance on the two-classification problem, abnormal transactions can be accurately identified by using the adjusted and optimized random forest model to identify the block chain transaction data, and the Bayesian optimization algorithm can automatically determine the optimal parameters of the prediction model according to the data of different input conditions, so that the intelligent identification of the block chain abnormal transactions is realized, and the requirements of actual engineering are met.
Corresponding to the method described in fig. 1, an embodiment of the present invention further provides a device for identifying a blockchain abnormal transaction, which is used to implement the method in fig. 1 specifically, and the device for identifying a blockchain abnormal transaction provided in an embodiment of the present invention may be applied to an electronic device, and a schematic structural diagram of the device is shown in fig. 6, and specifically includes:
the acquiring unit 601 is configured to respond to a transaction identification instruction and acquire blockchain transaction data to be identified;
the identifying unit 602 is configured to identify the blockchain transaction data by using a transaction identification model, and obtain an identification result of the blockchain transaction data, where the transaction identification model is obtained by using a training sample set, and the training sample set includes transaction sample data provided with a first tag and transaction sample data provided with a second tag; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
In an embodiment provided by the present invention, based on the above scheme, optionally, the identifying unit 602 includes:
the processing subunit is configured to utilize each decision sub-tree model in the transaction identification model to respectively process the block chain transaction data, so as to obtain a decision result output by each decision sub-tree;
and the voting subunit is used for voting based on the decision result output by each decision sub-tree by using a voting module in the transaction identification model to obtain the identification result of the block chain transaction data.
In an embodiment provided by the present invention, based on the above scheme, optionally, the identifying unit 602 includes:
the acquisition subunit is used for acquiring a training sample set;
the training subunit is used for applying a preset random forest algorithm to obtain a random forest model based on preset initial parameters and training of the training sample set, and the random forest model comprises a plurality of decision-making subtrees;
and the execution subunit is used for taking the random forest model as a transaction identification model.
In an embodiment provided by the present invention, based on the above scheme, optionally, the device for identifying abnormal transactions of a block chain further includes: an optimization unit;
and the optimization unit is used for optimizing the parameters of the random forest model by applying a preset Bayesian optimization algorithm.
In an embodiment provided by the present invention, based on the above scheme, optionally, the device for identifying abnormal transactions of a block chain further includes: an alarm unit;
and the alarm unit is used for generating alarm information of the blockchain transaction data and outputting the alarm information under the condition that the identification result of the blockchain transaction data represents that the blockchain transaction data is abnormal transaction data.
The specific principle and the execution process of each unit and each module in the device for identifying abnormal transactions of a block chain disclosed in the embodiment of the present invention are the same as those of the method for identifying abnormal transactions of a block chain disclosed in the embodiment of the present invention, and reference may be made to corresponding parts in the method for identifying abnormal transactions of a block chain provided in the embodiment of the present invention, which are not described herein again.
The embodiment of the present invention further provides a storage medium, where the storage medium includes a stored instruction, where when the instruction runs, a device where the storage medium is located is controlled to execute the above blockchain abnormal transaction identification method, where the blockchain abnormal transaction identification method includes:
responding to the transaction identification instruction, and acquiring blockchain transaction data to be identified;
identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
Optionally, the above method, where the identifying the to-be-identified blockchain transaction data to obtain the identification result of the blockchain transaction data includes:
processing the block chain transaction data by using each decision sub-tree model in the transaction identification model to obtain a decision result output by each decision sub-tree;
and voting by using a voting module in the transaction identification model based on the decision result output by each decision sub-tree to obtain the identification result of the blockchain transaction data.
Optionally, the method for obtaining the transaction identification model by training with a training sample set includes:
acquiring a training sample set;
training by applying a preset random forest algorithm based on preset initial parameters and the training sample set to obtain a random forest model, wherein the random forest model comprises a plurality of decision subtrees;
and taking the random forest model as a transaction identification model.
Optionally, the method, after obtaining the random forest model by applying a preset random forest algorithm and training based on preset initial parameters and the training sample set, further includes:
and optimizing the parameters of the random forest model by using a preset Bayesian optimization algorithm.
In the foregoing method, optionally, after obtaining the identification result of the blockchain transaction data, the method further includes:
and under the condition that the identification result of the blockchain transaction data represents that the transaction data is abnormal transaction data, generating alarm information of the blockchain transaction data, and outputting the alarm information.
An electronic device is provided in an embodiment of the present invention, and its structural diagram is shown in fig. 7, which specifically includes a memory 701 and one or more instructions 702, where the one or more instructions 702 are stored in the memory 701, and are configured to be executed by one or more processors 703 to perform the following operations according to the one or more instructions 702:
responding to the transaction identification instruction, and acquiring blockchain transaction data to be identified;
identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically 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.
Finally, it should also be 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.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in a plurality of software and/or hardware when implementing the invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The method for identifying abnormal transactions of a block chain provided by the invention is described in detail above, a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the above embodiment is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A blockchain abnormal transaction identification method is characterized by comprising the following steps:
responding to the transaction identification instruction, and acquiring blockchain transaction data to be identified;
identifying the blockchain transaction data by using a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by training by using a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
2. The method according to claim 1, wherein the obtaining the identification result of the blockchain transaction data by identifying the blockchain transaction data to be identified comprises:
processing the block chain transaction data by using each decision sub-tree model in the transaction identification model to obtain a decision result output by each decision sub-tree;
and voting by using a voting module in the transaction identification model based on the decision result output by each decision sub-tree to obtain the identification result of the blockchain transaction data.
3. The method of claim 1, wherein training the transaction recognition model using a training sample set comprises:
acquiring a training sample set;
training by applying a preset random forest algorithm based on preset initial parameters and the training sample set to obtain a random forest model, wherein the random forest model comprises a plurality of decision subtrees;
and taking the random forest model as a transaction identification model.
4. The method of claim 3, wherein after the applying the preset random forest algorithm to obtain the random forest model based on the preset initial parameters and the training sample set, the method further comprises:
and optimizing the parameters of the random forest model by using a preset Bayesian optimization algorithm.
5. The method of claim 1, wherein after obtaining the identification of the blockchain transaction data, further comprising:
and under the condition that the identification result of the blockchain transaction data represents that the blockchain transaction data is abnormal transaction data, generating alarm information of the blockchain transaction data, and outputting the alarm information.
6. A blockchain abnormal transaction identification apparatus, comprising:
the acquisition unit is used for responding to the transaction identification instruction and acquiring the block chain transaction data to be identified;
the identification unit is used for identifying the blockchain transaction data by utilizing a transaction identification model to obtain an identification result of the blockchain transaction data, wherein the transaction identification model is obtained by utilizing a training sample set, and the training sample set comprises transaction sample data provided with a first label and transaction sample data provided with a second label; the first label represents that the transaction sample data to which the first label belongs is normal transaction data, and the second label represents that the transaction sample data to which the second label belongs is abnormal transaction data.
7. The apparatus of claim 6, wherein the identification unit comprises:
the processing subunit is configured to utilize each decision sub-tree model in the transaction identification model to respectively process the block chain transaction data, so as to obtain a decision result output by each decision sub-tree;
and the voting subunit is used for voting based on the decision result output by each decision sub-tree by using a voting module in the transaction identification model to obtain the identification result of the block chain transaction data.
8. The apparatus of claim 6, wherein the identification unit comprises:
the acquisition subunit is used for acquiring a training sample set;
the training subunit is used for applying a preset random forest algorithm to obtain a random forest model based on preset initial parameters and training of the training sample set, and the random forest model comprises a plurality of decision-making subtrees;
and the execution subunit is used for taking the random forest model as a transaction identification model.
9. A storage medium, characterized in that the storage medium comprises a storage instruction, wherein when the instruction runs, a device in which the storage medium is located is controlled to execute the blockchain abnormal transaction identification method according to any one of claims 1 to 5.
10. An electronic device comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the blockchain exception transaction identification method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210139400.5A CN114186646A (en) | 2022-02-15 | 2022-02-15 | Block chain abnormal transaction identification method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210139400.5A CN114186646A (en) | 2022-02-15 | 2022-02-15 | Block chain abnormal transaction identification method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114186646A true CN114186646A (en) | 2022-03-15 |
Family
ID=80545988
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210139400.5A Pending CN114186646A (en) | 2022-02-15 | 2022-02-15 | Block chain abnormal transaction identification method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114186646A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114943309A (en) * | 2022-07-21 | 2022-08-26 | 人民法院信息技术服务中心 | Method for constructing abnormity diagnosis model of block chain and abnormity diagnosis method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110363534A (en) * | 2019-06-28 | 2019-10-22 | 阿里巴巴集团控股有限公司 | The method and device traded extremely for identification |
CN111340493A (en) * | 2020-03-04 | 2020-06-26 | 江苏大学 | Multi-dimensional distributed abnormal transaction behavior detection method |
CN111667267A (en) * | 2020-05-29 | 2020-09-15 | 中国工商银行股份有限公司 | Block chain transaction risk identification method and device |
CN112307472A (en) * | 2020-11-03 | 2021-02-02 | 平安科技(深圳)有限公司 | Abnormal user identification method and device based on intelligent decision and computer equipment |
EP3905165A1 (en) * | 2018-12-27 | 2021-11-03 | Hefei Dappworks Technology Co., Ltd. | Data processing method and apparatus for block chain |
-
2022
- 2022-02-15 CN CN202210139400.5A patent/CN114186646A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3905165A1 (en) * | 2018-12-27 | 2021-11-03 | Hefei Dappworks Technology Co., Ltd. | Data processing method and apparatus for block chain |
CN110363534A (en) * | 2019-06-28 | 2019-10-22 | 阿里巴巴集团控股有限公司 | The method and device traded extremely for identification |
CN111340493A (en) * | 2020-03-04 | 2020-06-26 | 江苏大学 | Multi-dimensional distributed abnormal transaction behavior detection method |
CN111667267A (en) * | 2020-05-29 | 2020-09-15 | 中国工商银行股份有限公司 | Block chain transaction risk identification method and device |
CN112307472A (en) * | 2020-11-03 | 2021-02-02 | 平安科技(深圳)有限公司 | Abnormal user identification method and device based on intelligent decision and computer equipment |
Non-Patent Citations (2)
Title |
---|
人民银行重庆营管部金融科技研究组: "基于人工智能的监管科技应用探索", 《当代金融研究》 * |
郝苗苗 等: "基于中文微博的情绪分类与预测方法", 《计算机应用》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114943309A (en) * | 2022-07-21 | 2022-08-26 | 人民法院信息技术服务中心 | Method for constructing abnormity diagnosis model of block chain and abnormity diagnosis method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110390408B (en) | Transaction object prediction method and device | |
CN110717535B (en) | Automatic modeling method and system based on data analysis processing system | |
CN109766454A (en) | A kind of investor's classification method, device, equipment and medium | |
CN111653274B (en) | Wake-up word recognition method, device and storage medium | |
JP6172317B2 (en) | Method and apparatus for mixed model selection | |
CN110634060A (en) | User credit risk assessment method, system, device and storage medium | |
CN112751345A (en) | LSTM and phase trajectory based electric power system low-frequency oscillation mode identification method | |
CN109255389B (en) | Equipment evaluation method, device, equipment and readable storage medium | |
CN113330462A (en) | Neural network training using soft nearest neighbor loss | |
Villa et al. | A continuous time bayesian network classifier for intraday fx prediction | |
CN108304568B (en) | Real estate public expectation big data processing method and system | |
CN114186646A (en) | Block chain abnormal transaction identification method and device, storage medium and electronic equipment | |
CN117312562A (en) | Training method, device, equipment and storage medium of content auditing model | |
CN116485185A (en) | Enterprise risk analysis system and method based on comparison data | |
Kotenko et al. | Formation of Indicators for Assessing Technical Reliability of Information Security Systems | |
CN115391523A (en) | Wind power plant multi-source heterogeneous data processing method and device | |
CN114820074A (en) | Target user group prediction model construction method based on machine learning | |
CN112528015B (en) | Method and device for judging rumor in message interactive transmission | |
CN110309285B (en) | Automatic question answering method, device, electronic equipment and storage medium | |
Zhang et al. | A combinational QoS-prediction approach based on RBF neural network | |
Wang et al. | Advantages of Combining Factorization Machine with Elman Neural Network for Volatility Forecasting of Stock Market | |
CN114118526A (en) | Enterprise risk prediction method, device, equipment and storage medium | |
CN114282875A (en) | Flow approval certainty rule and semantic self-learning combined judgment method and device | |
Shukla et al. | Sentiment analysis of international relations with artificial intelligence | |
CN112463964A (en) | Text classification and model training method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20220315 |
|
RJ01 | Rejection of invention patent application after publication |