A method for detecting multimodal data anomalies in blockchain
By representing the sparse projection matrix of multimodal data in the blockchain and constructing multimodal graphs, combined with the hypersphere objective function, the problem of accuracy and low efficiency of multimodal data detection in the blockchain is solved, and the correct Efficient abnormality detection of multimodal data ensures the security of the blockchain system.
Patent Information
- Application Number
- CN202410935056.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-12
AI Technical Summary
When the prior art is used in blockchain for multimodal data abnormality detection, it can only ensure the detection accuracy of single modal data, and cannot guarantee the detection accuracy of all modal data, and the detection efficiency is low, so it cannot guarantee the zone. The accuracy and system security of blockchain multimodal data.
By acquiring different modal data sets, the projection matrix of each modal data set is sparsely represented by the L21 norm, the sparse projection matrix term is constructed, and the multi-modal graph regular term is constructed based on the nearest neighbor similarity graph matrix and the semantic similarity matrix. Combining the hyperspheric radius and distribution entropy penalty term, a hyperspheric objective function is constructed, and a multimodal data anomaly detection model is obtained to realize the detection of multimodal data in the blockchain.
The abnormal detection of various modal data in the blockchain is realized, which reduces the detection cost and complexity, significantly improves the accuracy and efficiency of abnormal detection of multimodal data, and ensures the security of the blockchain system.
Smart Images

Figure CN118468346B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain data detection, and in particular to a blockchain multimodal data anomaly detection method. Background Art
[0002] Blockchain technology has been widely used in finance, supply chain management, copyright protection, identity authentication, and sharing economy due to its decentralization, transparency, and immutability. With the rapid development of blockchain technology, more and more application scenarios have begun to focus on the storage and processing of multimodal data. Multimodal data refers to data from different sources, formats, or types, such as text, images, and audio. It has important application value in many fields such as financial sharing assessment, medical record management, and IoT device communication.
[0003] Although blockchain can ensure the immutability of data, the existing technology lacks an effective data verification mechanism, that is, before the data is uploaded to the chain, it is impossible to conduct comprehensive and in-depth analysis and verification of multimodal data, which leads to the writing of abnormal data, erroneous data or forged data, affecting the overall quality of blockchain data and system performance, and further misleading the decision-making system that relies on blockchain data, affecting the accuracy and efficiency of related applications. For example, in the financial field, erroneous transaction data may lead to erroneous credit assessments, and in the medical field, inaccurate medical record data may affect the diagnosis of the disease and the choice of treatment options. Therefore, how to design a mechanism that can effectively verify the accuracy and reliability of multimodal data to effectively identify and prevent abnormal data, erroneous data or forged data from being written to the blockchain is an urgent problem to be solved.
[0004] The prior art usually uses support vector data description (SVDD) to detect anomalies in data. Based on the condition that normal data samples in the training set are located inside the hypersphere after being mapped by the projection matrix, while abnormal data samples are located outside the hypersphere after being mapped by the projection matrix, a hypersphere objective function and a hypersphere constraint function are constructed. The hypersphere and the data projection matrix that meet the above conditions are obtained by solving the hypersphere objective function and the hypersphere constraint function. When detecting data, the data projection matrix is first used to map the data to be detected. By judging whether the mapped data feature representation is located inside or outside the hypersphere, it is determined whether the data is normal.
[0005] However, the SVDD method can only detect data of a single modality. For example, all data samples in the training set are in text mode. The SVDD method can obtain the projection matrix of the text modality data and the hypersphere suitable for text modality data detection based on the data samples in the training set. When there are data samples of multiple modalities in the training set, the SVDD method is difficult to cope with the complexity and heterogeneity of multimodal data, especially when the difference between the modalities is too large. The method cannot fully maintain the consistency between different modalities while fully exploring the complementarity between different modalities, and thus cannot construct a hypersphere suitable for all modal data. Therefore, when using the SVDD method to detect anomalies in blockchain data, it is necessary to construct corresponding projection matrices and hyperspheres for data of various modalities, which not only increases the complexity of data anomaly detection, but also requires more computing resources and storage space.
[0006] In summary, the existing SVDD method can only guarantee the detection accuracy of single modal data in blockchain data anomaly detection, but cannot guarantee the detection accuracy of all modal data. In addition, the detection efficiency is low, and it cannot guarantee the accuracy of blockchain multimodal data and the security of the blockchain system. Summary of the invention
[0007] To this end, the technical problem to be solved by the present invention is to overcome the problem that the data anomaly detection method in the prior art can only guarantee the detection accuracy of a single modal data when used for multimodal data anomaly detection, and cannot guarantee the detection accuracy of all modal data, and the detection efficiency is low, and cannot guarantee the accuracy of blockchain multimodal data and the security of the blockchain system.
[0008] In order to solve the above technical problems, the present invention provides a blockchain multimodal data anomaly detection method, comprising:
[0009] Acquire a training set, wherein the training set includes different modality data sets;
[0010] The projection matrix of each modality data set is sparsely represented by using the L21 norm, and the sparse projection matrix items of each modality data set are constructed; based on the sum of the sparse projection matrix items of all modality data sets, the target sparse projection matrix items are obtained;
[0011] Based on the invariance of the neighbor similarity graph matrix after the data samples in the same modality data set are mapped by their corresponding projection matrices, a first multimodal graph regularization term is constructed; based on the invariance of the semantic similarity matrix after the data samples in different modality data sets are mapped by their corresponding projection matrices, a second multimodal graph regularization term is constructed; and the first multimodal graph regularization term and the second multimodal graph regularization term are weightedly summed to obtain a target multimodal graph regularization term;
[0012] Based on minimizing the weighted sum of the square of the hypersphere radius, the target sparse projection matrix term, the target multimodal graph regularization term, the normal data sample distribution entropy penalty term, and the abnormal data sample distribution entropy penalty term, a hypersphere objective function is constructed; based on the hypersphere objective function and the hypersphere constraint function, a multimodal data anomaly detection model is obtained;
[0013] The multimodal data anomaly detection model is solved to obtain the hypersphere radius, the hypersphere center and the projection matrix of each modal data set, so as to detect the multimodal data to be detected in the blockchain.
[0014] Preferably, the sparse projection matrix entries for each modality dataset are expressed as:
[0015] ,
[0016] in, Indicates The sparse projection matrix entries of the modal datasets; Indicates The projection matrix of the modality dataset; represents transpose;
[0017] The target sparse projection matrix term is expressed as:
[0018] ,
[0019] in, represents the target sparse projection matrix entry; Represents the number of modal datasets in the training set.
[0020] Preferably, the first multimodal graph regularization term is expressed as:
[0021] ,
[0022] ,
[0023] in, represents the first multimodal graph regularization term; Represents the number of modal datasets in the training set; Indicates In the modality dataset The feature representation of the data samples after being mapped by the projection matrix; Indicates In the modality dataset The feature representation of the data samples after being mapped by the projection matrix; Indicates The number of data samples in each modality dataset; Indicates In the modality dataset data samples and The neighbor similarity graph matrix of data samples; Indicates In the modality dataset data samples; Indicates In the modality dataset data samples; represents the Gaussian kernel bandwidth;
[0024] The second multimodal graph regularization term is expressed as:
[0025] ,
[0026] ,
[0027] in, represents the second multimodal graph regularization term; Indicates The number of data samples in each modality dataset; Indicates In the modality dataset data samples and In the modality dataset The semantic similarity matrix of data samples; Indicates In the modality dataset The feature representation of the data samples after being mapped by the projection matrix; Indicates In the modality dataset data samples;
[0028] The target multimodal graph regularization term is expressed as:
[0029] ,
[0030] in, represents the target multimodal graph regularization term; Represents a weight parameter that measures the importance between the first multimodal graph regularization term and the second multimodal graph regularization term.
[0031] Preferably, the hypersphere objective function is expressed as:
[0032] ,
[0033] in, represents the hypersphere objective function; represents the radius of the hypersphere; Represents the entropy penalty term of normal data sample distribution; Represents the weight parameter of the entropy penalty term of the normal data sample distribution; Represents the entropy penalty term for the abnormal data sample distribution; Represents the weight parameter of the entropy penalty term of the abnormal data sample distribution; represents the target multimodal graph regularization term; represents the weight parameter of the target multimodal graph regularization term; represents the target sparse projection matrix entry; Represents the weight parameter of the target sparse projection matrix entry.
[0034] Preferably, the process of constructing the normal data sample distribution entropy penalty term includes:
[0035] Based on the ratio of the distance between each normal data sample in each modal data set and the global distribution center after being mapped by its corresponding projection matrix and the sum of the distances between all normal data samples in all modal data sets and the global distribution center after being mapped by the projection matrix, the distribution entropy of the normal data sample is obtained;
[0036] The target distribution entropy penalty item of the normal data sample is obtained based on the product of the distribution entropy of the normal data sample and the relaxation factor; the normal data sample distribution entropy penalty item is obtained based on the sum of the target distribution entropy penalty items of all normal data samples in all modal data sets.
[0037] Preferably, the distribution entropy of normal data samples is expressed as:
[0038] ,
[0039] in, Indicates In the modality dataset The distribution entropy of normal data samples; Indicates In the modality dataset The distance between a normal data sample and the global distribution center after being mapped by the projection matrix; Indicates The number of normal data samples in each modality dataset;
[0040] The entropy penalty term of normal data sample distribution is expressed as:
[0041] ,
[0042] in, Represents the entropy penalty term of normal data sample distribution; Represents the number of modal datasets in the training set; Indicates In the modality dataset Relaxation factor for normal data samples.
[0043] Preferably, the process of constructing the abnormal data sample distribution entropy penalty term includes:
[0044] Based on the ratio of the inverse of the distance between each abnormal data sample in each modal data set and the global distribution center after being mapped by the projection matrix and the sum of the inverse of the distance between all abnormal data samples in all modal data sets and the global distribution center after being mapped by the projection matrix, the distribution entropy of the abnormal data sample is obtained;
[0045] The target distribution entropy penalty item of the abnormal data sample is obtained based on the product of the distribution entropy of the abnormal data sample and the relaxation factor; the abnormal data sample distribution entropy penalty item is obtained based on the sum of the target distribution entropy penalty items of all abnormal data samples in all modal data sets.
[0046] Preferably, the distribution entropy of abnormal data samples is expressed as:
[0047] ,
[0048] in, Indicates In the modality dataset The distribution entropy of abnormal data samples; Indicates In the modality dataset The distance between an abnormal data sample and the global distribution center after being mapped by the projection matrix; Indicates The number of data samples in each modality dataset; Indicates The number of normal data samples in each modality dataset; Indicates Abnormal data samples in the modal data set;
[0049] The entropy penalty term of abnormal data sample distribution is expressed as:
[0050] ,
[0051] in, Represents the entropy penalty term for the abnormal data sample distribution; Indicates In the modality dataset Relaxation factor for outlier data samples.
[0052] Preferably, the hypersphere constraint function includes a normal data sample constraint function and an abnormal data sample constraint function, wherein the normal data sample constraint function is expressed as:
[0053] ,
[0054] in, Indicates The projection matrix of the modality dataset; Indicates In the modality dataset Normal data samples; represents the center of the hypersphere; represents the radius of the hypersphere; express The relaxation factor of Indicates The number of normal data samples in each modality dataset; Represents the number of modal datasets in the training set;
[0055] The abnormal data sample constraint function is expressed as:
[0056] ,
[0057] in, Indicates In the modality dataset Anomaly data samples, express The relaxation factor, Indicates The number of data samples in each modality dataset; Indicates Abnormal data samples in the modal dataset.
[0058] Preferably, detecting the multimodal data to be detected in the blockchain includes:
[0059] Obtain the data to be tested in the blockchain, and use the projection matrix of the modality data set with the same modality as the data to be tested as the target projection matrix;
[0060] Mapping the data to be detected by using the target projection matrix to obtain a feature representation of the data to be detected;
[0061] The Euclidean distance between the feature representation of the data to be detected and the center of the hypersphere is calculated. If the Euclidean distance is less than or equal to the square of the radius of the hypersphere, the data to be detected is determined to be normal data. If the Euclidean distance is greater than the square of the radius of the hypersphere, the data to be detected is determined to be abnormal data.
[0062] In order to realize anomaly detection of various modal data in the blockchain through a universal hypersphere, the present application first designs a corresponding projection matrix for each modal data set, and uses the L21 norm to sparse the projection matrix of each modal data set, so that the data of each modality can be mapped to the hypersphere through the corresponding projection matrix, thereby realizing anomaly detection of different modal data, and the sparsity constraint is imposed on the projection matrix so that the important features in the data can be focused on during the data detection process, reducing the influence of noise and redundant information; at the same time, in order to construct a hypersphere that can reflect the complexity and heterogeneity of various modal data and avoid the problem that the hypersphere can only detect anomalies of a single modal data but cannot detect whether other modal data are abnormal, the present application is based on the invariance of the neighbor graph matrix after mapping of data samples in the same modal data set and the data in different modal data sets. According to the invariance of the semantic similarity matrix after sample mapping, the target multimodal graph regularization term is constructed, which can not only effectively capture the intrinsic relationship of the same modal data, but also capture the relationship between different modal data, and fully explore the complementary information of multimodal data; finally, based on the square of the hypersphere radius, the target sparse projection matrix term, the target multimodal graph regularization term, the normal data sample distribution entropy penalty term and the abnormal data sample distribution entropy penalty term, the hypersphere objective function is jointly constructed, and the projection matrix of different modal data sets and the universal hypersphere suitable for various modal data detection are solved, so as to realize the anomaly detection of all modal data in the blockchain using the universal hypersphere, while reducing the cost and complexity of data anomaly detection, significantly reducing the occupation of computing resources, improving the accuracy and detection efficiency of blockchain multimodal data anomaly detection, and ensuring the security of the blockchain system. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0064] Figure 1 Flowchart of the blockchain multimodal data anomaly detection method provided for this application;
[0065] Figure 2 The architecture diagram of the blockchain multimodal data anomaly detection method provided for this application;
[0066] Figure 3 A schematic diagram comparing the average accuracies obtained using different multimodal data anomaly detection methods provided in this application. DETAILED DESCRIPTION
[0067] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0068] See also Figure 1 , Figure 1 The flowchart of the blockchain multimodal data anomaly detection method provided by this application is shown, and the method specifically includes:
[0069] S10: obtaining a training set, where the training set includes data sets of different modalities;
[0070] S20: sparsely represent the projection matrix of each modality data set by using the L21 norm, and construct the sparse projection matrix items of each modality data set; obtain the target sparse projection matrix items based on the sum of the sparse projection matrix items of all modality data sets;
[0071] S30: constructing a first multimodal graph regularization term based on the invariance of the neighbor similarity graph matrix after the data samples in the same modal data set are mapped by their corresponding projection matrices; constructing a second multimodal graph regularization term based on the invariance of the semantic similarity matrix after the data samples in different modal data sets are mapped by their corresponding projection matrices; performing weighted summation of the first multimodal graph regularization term and the second multimodal graph regularization term to obtain a target multimodal graph regularization term;
[0072] S40: Based on the weighted sum minimization of the square of the hypersphere radius, the target sparse projection matrix term, the target multimodal graph regularization term, the normal data sample distribution entropy penalty term and the abnormal data sample distribution entropy penalty term, a hypersphere objective function is constructed; based on the hypersphere objective function and the hypersphere constraint function, a multimodal data anomaly detection model is obtained;
[0073] S50: Solve the multimodal data anomaly detection model to obtain the hypersphere radius, the hypersphere center and the projection matrix of each modal data set, so as to detect the multimodal data to be detected in the blockchain.
[0074] The blockchain multimodal data anomaly detection method provided by the present application designs a corresponding projection matrix for each modal data set in order to realize anomaly detection of various modal data in the blockchain through a universal hypersphere, and uses the L21 norm to sparse the projection matrix of each modal data set, so that the data of each modality can be mapped to the hypersphere through the corresponding projection matrix, thereby realizing anomaly detection of different modal data, and the sparsity constraint is imposed on the projection matrix so that the important features in the data are focused on during the data detection process, reducing the influence of noise and redundant information; at the same time, in order to construct a hypersphere that can reflect the complexity and heterogeneity of various modal data and avoid the problem that the hypersphere can only detect anomalies of a single modal data but cannot detect whether other modal data are abnormal, the present application is based on the invariance of the neighbor graph matrix after the data samples in the same modal data set are mapped and different The target multimodal graph regularization term is constructed based on the invariance of the semantic similarity matrix after mapping the data samples in the modal data set, which can not only effectively capture the intrinsic relationship of the same modal data, but also capture the relationship between different modal data, and fully explore the complementary information of multimodal data; finally, the hypersphere objective function is jointly constructed based on the square of the hypersphere radius, the target sparse projection matrix term, the target multimodal graph regularization term, the normal data sample distribution entropy penalty term and the abnormal data sample distribution entropy penalty term, and the projection matrix of different modal data sets and the universal hypersphere suitable for various modal data detection are solved, so as to realize the anomaly detection of all modal data in the blockchain using the universal hypersphere, while reducing the cost and complexity of data anomaly detection, significantly reducing the occupation of computing resources, improving the accuracy and detection efficiency of blockchain multimodal data anomaly detection, and ensuring the security of the blockchain system.
[0075] For example, Figure 2 The figure shows the architecture diagram of the blockchain multimodal data anomaly detection method provided by the present application. By mapping (linear mapping or nonlinear mapping) the data samples of each modality in the training set to the common subspace using the projection matrix, the hypersphere boundary that meets all the samples in the training set is found. When detecting data anomalies, it is only necessary to map the data to be detected and determine whether the data is outside or inside the hypersphere to determine whether the data is normal data or abnormal data. When mapping the data, the present application constructs a multimodal graph regularization term to constrain the two structural relationships within and between the modalities of the multimodal data. At the same time, by constructing a sparse projection matrix term, the interference of redundant information in the multimodal data is reduced, so that the final hypersphere can reflect the characteristics of various modal data to the greatest extent, thereby detecting data of different modalities.
[0076] Since multimodal data exists in various forms and provides a diverse description of the target object, it essentially contains complementarity. However, this complementary information is often interfered by redundant information in the multimodal data. Based on this, the L21 norm is used in this application to sparse the projection matrix of each modal data set, thereby extracting the key features of each data sample and reducing the impact of redundant and interfering features.
[0077] Specifically, the sparse projection matrix item of each modality data set in step S20 is expressed as:
[0078] ,
[0079] in, Indicates The sparse projection matrix entries of the modal datasets; Indicates The projection matrix of the modality dataset; represents transpose;
[0080] The target sparse projection matrix entry is expressed as:
[0081] ,
[0082] in, represents the target sparse projection matrix entry; Represents the number of modal datasets in the training set;
[0083] Specifically, the L21 norm is usually solved using a semi-quadratic minimization method, that is, when defining hour, Equivalent to ,in, Indicates The projection matrix of the modality dataset No. List, is the smoothing term with the minimum value;
[0084] Furthermore, the target sparse projection matrix can be expressed as:
[0085]
[0086] in, , .
[0087] Furthermore, since the modalities of data samples in the same modality dataset are the same, when they are mapped to the low-dimensional subspace, the neighborhood relationship of the data in the original sample space, that is, the structural relationship within the modality, should be maintained; while the modalities of data samples in different modality datasets are different, but when data samples of different modalities represent the same content or theme, they should have similar semantics, that is, the structural relationship between modalities; in this application, a multimodal graph regularization term is introduced to maintain the above two structural relationships, so as to maximize the consistency of modality data while fully mining the complementary information in multimodal data;
[0088] Specifically, the first multimodal graph regularization term in step S30 is expressed as:
[0089] ,
[0090] ,
[0091] in, represents the first multimodal graph regularization term; Represents the number of modal datasets in the training set; Indicates In the modality dataset The feature representation of the data samples after being mapped by the projection matrix; Indicates In the modality dataset The feature representation of the data samples after being mapped by the projection matrix; Indicates The number of data samples in each modality dataset; Indicates In the modality dataset data samples and The neighbor similarity graph matrix of data samples; Indicates In the modality dataset data samples; Indicates In the modality dataset data samples; represents the Gaussian kernel bandwidth;
[0092] The second multimodal graph regularization term is expressed as:
[0093] ,
[0094] ,
[0095] in, represents the second multimodal graph regularization term; Indicates The number of data samples in each modality dataset; Indicates In the modality dataset data samples and In the modality dataset The semantic similarity matrix of data samples; Indicates In the modality dataset The feature representation of the data samples after being mapped by the projection matrix; Indicates In the modality dataset data samples;
[0096] The target multimodal graph regularization term is expressed as:
[0097] ,
[0098] in, represents the target multimodal graph regularization term; A weight parameter representing the importance between the first multimodal graph regularization term and the second multimodal graph regularization term;
[0099] Optionally, in some embodiments of the present application, a similarity matrix may be constructed using a neighbor similarity graph matrix and a semantic similarity matrix:
[0100] ,
[0101] in, represents the similarity matrix, is a weight parameter to measure the importance between the neighbor similarity graph matrix and the semantic similarity matrix. Furthermore, the target multimodal graph regularization term can be expressed as:
[0102]
[0103] in, represents the number of data samples in the training set, Indicates the training set data samples and The similarity matrix between data samples is It means to find the trace of the matrix, Indicates The projection matrix of the modality dataset, Indicates modal datasets, Indicates The projection matrix of the modality dataset, Indicates modal datasets, , Indicates modality dataset and the The Laplacian matrix of the modal data set, To contain The diagonal matrix of .
[0104] Alternatively, the entropy penalty term for normal data sample distribution in the traditional SVDD method is , the entropy penalty term of the abnormal data sample distribution is Based on this, in some embodiments of the present application, considering the different modes of data samples in each modality data set, the normal data sample distribution entropy penalty term can be , the entropy penalty term of the abnormal data sample distribution can be ;
[0105] However, in SVDD, the slack variables The geometric interpretation of is the distance from the sample outside the hypersphere to the surface of the hypersphere, and the penalty term It means that all normal data samples are considered equally important and are penalized the same as abnormal data samples. That is, the traditional SVDD method believes that all normal data samples and abnormal data samples contribute equally to the establishment of the hypersphere boundary. However, in fact, according to the data sample distribution and VC dimension theory, data samples at different locations should have different importance. That is, the closer the sample is to the hypersphere boundary, the greater its contribution to the construction of the hypersphere, and even plays a decisive role.
[0106] Based on this, this application designs a penalty based on distribution entropy for each data sample from the perspective of information theory to measure the contribution of each data sample to the hypersphere. First, the distance measurement of each sample relative to the global distribution center is given. This application uses Euclidean distances (ED). u The calculation formula of the distance between a data sample and the global distribution center after being mapped by the projection matrix is:
[0107] ,
[0108] in, Indicates The feature representation of the data samples after being mapped by the projection matrix is: Represents the mean of the feature representation of all data samples after being mapped by the projection matrix, represents the inner product of vectors;
[0109] Furthermore, for the normal data samples in the training set, when the normal data samples move from the center point to the far end, their abnormal probability gradually increases, that is, when the normal data samples are far away from the global distribution center, the abnormal probability of the sample gradually increases; and when the abnormal data samples move from the far end to the global distribution center, their normal probability gradually increases, that is, when the abnormal data samples are close to the global distribution center, the normal probability of the sample gradually increases; In addition, in the field of information theory, entropy is a measure used to evaluate the degree of uncertainty of the information carried by the sample. If a discrete random variable Obey probability distribution , then the information entropy can be defined as:
[0110] ,
[0111] Based on the above derivation process, as a preferred embodiment, the present application designs a penalty called distribution entropy for both normal data samples and abnormal data samples in the training set:
[0112] Specifically, the process of constructing the normal data sample distribution entropy penalty term in step S40 includes:
[0113] Based on the ratio of the distance between each normal data sample in each modal data set and the global distribution center after being mapped by its corresponding projection matrix and the sum of the distances between all normal data samples in all modal data sets and the global distribution center after being mapped by the projection matrix, the distribution entropy of the normal data sample is obtained; wherein, the distribution entropy of the normal data sample is expressed as:
[0114] ,
[0115] in, Indicates In the modality dataset The distribution entropy of normal data samples; Indicates In the modality dataset The distance between a normal data sample and the global distribution center after being mapped by the projection matrix; Indicates The number of normal data samples in each modality dataset;
[0116] The target distribution entropy penalty term of the normal data sample is obtained based on the product of the distribution entropy of the normal data sample and the relaxation factor; the normal data sample distribution entropy penalty term is obtained based on the sum of the target distribution entropy penalty terms of all normal data samples in all modal data sets; wherein, the normal data sample distribution entropy penalty term is expressed as:
[0117] ,
[0118] in, Represents the entropy penalty term of normal data sample distribution; Represents the number of modal datasets in the training set; Indicates In the modality dataset Relaxation factor for normal data samples.
[0119] Specifically, the construction process of the abnormal data sample distribution entropy penalty term in step S40 includes:
[0120] Based on the ratio of the inverse of the distance between each abnormal data sample in each modal data set and the global distribution center after being mapped by the projection matrix and the sum of the inverse of the distance between all abnormal data samples in all modal data sets and the global distribution center after being mapped by the projection matrix, the distribution entropy of the abnormal data sample is obtained; wherein, the distribution entropy of the abnormal data sample is expressed as:
[0121] ,
[0122] in, Indicates In the modality dataset The distribution entropy of abnormal data samples; Indicates In the modality dataset The distance between an abnormal data sample and the global distribution center after being mapped by the projection matrix; Indicates The number of data samples in each modality dataset; Indicates The number of normal data samples in each modality dataset; Indicates Abnormal data samples in the modal data set;
[0123] The target distribution entropy penalty term of the abnormal data sample is obtained based on the product of the distribution entropy of the abnormal data sample and the relaxation factor; the abnormal data sample distribution entropy penalty term is obtained based on the sum of the target distribution entropy penalty terms of all abnormal data samples in all modal data sets; wherein, the abnormal data sample distribution entropy penalty term is expressed as:
[0124] ,
[0125] in, Represents the entropy penalty term for the abnormal data sample distribution; Indicates In the modality dataset Relaxation factor for outlier data samples.
[0126] Furthermore, the hypersphere objective function in step S40 is expressed as:
[0127] ,
[0128] in, represents the hypersphere objective function; represents the radius of the hypersphere; Represents the entropy penalty term of normal data sample distribution; Represents the weight parameter of the entropy penalty term of the normal data sample distribution; Represents the entropy penalty term for the abnormal data sample distribution; Represents the weight parameter of the entropy penalty term of the abnormal data sample distribution; represents the target multimodal graph regularization term; represents the weight parameter of the target multimodal graph regularization term; represents the target sparse projection matrix entry; Represents the weight parameter of the target sparse projection matrix entry.
[0129] Specifically, the process of constructing the hypersphere constraint function in step S40 includes:
[0130] Based on the Euclidean distance between each normal data sample and the center of the hypersphere after being mapped by the projection matrix being less than or equal to the sum of the square of the hypersphere radius and the relaxation factor of the normal data sample, a normal data sample constraint function is constructed;
[0131] Specifically, the normal data sample constraint function is expressed as:
[0132] ,
[0133] in, Indicates The projection matrix of the modality dataset; Indicates In the modality dataset Normal data samples; represents the center of the hypersphere; represents the radius of the hypersphere; express The relaxation factor of Indicates The number of normal data samples in each modality dataset; Represents the number of modal datasets in the training set;
[0134] Based on the Euclidean distance between each abnormal data sample and the center of the hypersphere after being mapped by the projection matrix being greater than or equal to the difference between the square of the hypersphere radius and the relaxation factor of the abnormal data sample, an abnormal data sample constraint function is constructed;
[0135] Specifically, the abnormal data sample constraint function is expressed as:
[0136] ,
[0137] in, Indicates In the modality dataset Anomaly data samples, express The relaxation factor, Indicates The number of data samples in each modality dataset; Indicates Abnormal data samples in the modal data set;
[0138] Based on the normal data sample constraint function and the abnormal data sample constraint function, a hypersphere constraint function is obtained.
[0139] Based on the hypersphere objective function and hypersphere constraint function provided in the above embodiment, a multimodal data anomaly detection model can be obtained:
[0140]
[0141] Solving the above model can obtain the radius of the hypersphere, the center of the hypersphere, and the projection matrix of each modal data set. Specifically, in order to solve the above model, the above model is first converted into a Lagrangian function:
[0142]
[0143] in, and is the Lagrange multiplier;
[0144] For the above Lagrangian function, a two-step alternating iteration method is used in the embodiment of the present application to solve it, specifically:
[0145] The first step is to fix , solve , and ,when When fixed, Can be Calculation, the Lagrangian function can be simplified to:
[0146]
[0147] Solution about The partial derivative of and set it to 0, after simplifying, we get:
[0148] ,
[0149] ,
[0150] ,
[0151] ,
[0152] Substituting the above derivative results into In the simplification, we get the dual problem:
[0153]
[0154] st ,
[0155] ,
[0156] It can be seen that the above dual problem is a QP problem containing inequality constraints. The optimal solution can be obtained by solving the above problem. Furthermore, all sample points can be classified according to the KKT condition, so that the hypersphere boundary can be calculated by any point on the hypersphere boundary, that is:
[0157] ,
[0158] Step 2: Fix 、 and , solve , solved in the first step , can be solved explicitly or implicitly, and after removing the constant irrelevant terms, can be simplified to:
[0159]
[0160] right Ask about The partial derivative of can be obtained:
[0161]
[0162] Furthermore, we use the gradient descent method to Solution:
[0163] ,
[0164] in, is the gradient learning rate.
[0165] Furthermore, the step S50 of detecting the multimodal data to be detected in the blockchain includes:
[0166] Obtain the data to be tested in the blockchain, and use the projection matrix of the modality data set with the same modality as the data to be tested as the target projection matrix;
[0167] The target projection matrix is used to map the data to be detected to obtain the feature representation of the data to be detected;
[0168] The Euclidean distance between the feature representation of the data to be detected and the center of the hypersphere is calculated. If the Euclidean distance is less than or equal to the square of the radius of the hypersphere, the data to be detected is determined to be normal data. If the Euclidean distance is greater than the square of the radius of the hypersphere, the data to be detected is determined to be abnormal data.
[0169] Optionally, if the data to be detected is multidimensional data including multiple modal representations, the data can be classified by the following decision strategy:
[0170] AND strategy: If all modal representations are designated as normal, the data to be detected is normal data, otherwise the data to be detected is abnormal data;
[0171] OR strategy: If any modal representation is designated as normal, the data to be detected is normal data, otherwise, the data to be detected is abnormal data;
[0172] m-mode strategy: If the m-th mode representation is designated as normal, the data to be detected is normal data, otherwise, the data to be detected is abnormal data.
[0173] Since the data set for training the anomaly detection model is unbalanced, in order to evaluate the experimental effect of the blockchain multimodal data anomaly detection method provided by this application, the embodiment of this application adopts the classic geometric mean (GM) and average precision (AP) evaluation indicators to eliminate the abnormal high-precision deviation problem with a large number of samples:
[0174] The geometric mean (GM) represents the geometric mean of sensitivity and specificity, and its calculation formula is:
[0175] ,
[0176] in, It is called sensitivity and recall. It is called specificity and precision;
[0177] ,
[0178] ;
[0179] Average precision (AP) represents the arithmetic mean of sensitivity and specificity, and its calculation formula is:
[0180] .
[0181] The experimental environment parameters in the embodiment of the present application are shown in Table 1:
[0182] Table 1
[0183]
[0184] The parameters of the experimental method and the comparison method are shown in Table 2:
[0185] Table 2
[0186]
[0187] Specifically, the embodiments of the present application use several classic traditional machine learning algorithms as comparison algorithms, including support vector data description (SVDD), density weighted support vector data description (density weighted SVDD, DW-SVDD), support vector machine (SVM), small sphere and large margin (small aphere and large margin, SSLM) and multimodal subspace support vector data (multimodal subspace SVDD, MS-SVDD) description of three variants. As shown in Table 3, the mean and variance of the GM classification evaluation index of the above algorithm after ten-fold cross validation, Figure 3 The mean and variance of AP classification indicators under GM indicators are shown in Table 3 and Figure 3 It can be seen that the DEMS-SVDD method provided by this application has better classification performance, generalization performance and more stable robustness than other methods, which means that the method provided by this application has higher accuracy and stability in the field of multimodal data anomaly detection;
[0188] Table 3
[0189]
[0190] The datasets used in the embodiments of this application are from the IRIS, ROBOT EXECUTIONFAILURES (REF) and IONOSPHERE (IONO) datasets on the UCI public dataset website, and the MSRC-V1 dataset is from the MLDTA public dataset website. In order to simulate the application scenario of multimodal datasets, the experiment processed and divided the data. As shown in Table 4, the experiment divided the training set and the test set in a ratio of 7:3, and used ten-fold cross validation to determine the parameters, normalized the data features, and mapped the features to the range of [-1,1]:
[0191] Table 4
[0192]
[0193] During the formal training of the model, the parameter optimization range of cross-validation is continuously adjusted by observing the results of each training to avoid overfitting caused by overly complex parameter models and improve the generalization ability of the model. After multiple trainings, a stable and high-performance DEMS-SVDD model is gradually established. In practical applications, DEMS-SVDD is deployed on the blockchain in the form of a smart contract. When new data is to be stored on the blockchain, it is first judged as abnormal to determine the legitimacy of the data, thereby reducing the cost and risk of manual intervention, improving the efficiency and reliability of the blockchain system, and providing guarantees for the application and development of blockchain technology in more fields.
[0194] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0195] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0196] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0197] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0198] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.
Claims
1. A blockchain multimodal data anomaly detection method, characterized in that: include: Acquire a training set, wherein the training set includes different modality data sets; The projection matrix of each modality dataset is sparsely represented using the L21 norm, and the sparse projection matrix items of each modality dataset are constructed; based on the sum of the sparse projection matrix items of all modality datasets, the target sparse projection matrix items are obtained; wherein, the sparse projection matrix items of each modality dataset are expressed as: Γ m (Q)=‖(Q m ) T ‖ 2,1 , Among them, Γ m (Q) represents the sparse projection matrix item of the m-th modality dataset; Q m represents the projection matrix of the mth modality data set; T represents transpose; The target sparse projection matrix term is expressed as: Where Γ(Q) represents the target sparse projection matrix item; M represents the number of modal data sets in the training set; Based on the invariance of the neighbor similarity graph matrix after the data samples in the same modality data set are mapped by their corresponding projection matrices, a first multimodal graph regularization term is constructed; based on the invariance of the semantic similarity matrix after the data samples in different modality data sets are mapped by their corresponding projection matrices, a second multimodal graph regularization term is constructed; the first multimodal graph regularization term and the second multimodal graph regularization term are weightedly summed to obtain a target multimodal graph regularization term; wherein, the first multimodal graph regularization term is expressed as: Where Ω1(Q) represents the first multimodal graph regularization term; M represents the number of modal datasets in the training set; It represents the feature representation of the i-th data sample in the m-th modality data set after being mapped by the projection matrix; represents the feature representation of the jth data sample in the mth modality dataset after being mapped by the projection matrix; N m Represents the number of data samples in the mth modality dataset; Represents the neighbor similarity graph matrix of the i-th data sample and the j-th data sample in the m-th modal data set; Represents the i-th data sample in the m-th modal data set; represents the jth data sample in the mth modal data set; δ represents the Gaussian kernel bandwidth; The second multimodal graph regularization term is expressed as: Where Ω2(Q) represents the second multimodal graph regularization term; N p Represents the number of data samples in the p-th modality dataset; Represents the semantic similarity matrix between the i-th data sample in the m-th modality dataset and the g-th data sample in the p-th modality dataset; It represents the feature representation of the g-th data sample in the p-th modality data set after being mapped by the projection matrix; represents the gth data sample in the pth modal data set; The target multimodal graph regularization term is expressed as: Ω(Q)=βΩ1(Q)+Ω2(Q), Wherein, Ω(Q) represents the target multimodal graph regularization term; β represents the weight parameter that measures the importance between the first multimodal graph regularization term and the second multimodal graph regularization term; Based on minimizing the weighted sum of the square of the hypersphere radius, the target sparse projection matrix term, the target multimodal graph regularization term, the normal data sample distribution entropy penalty term, and the abnormal data sample distribution entropy penalty term, a hypersphere objective function is constructed; based on the hypersphere objective function and the hypersphere constraint function, a multimodal data anomaly detection model is obtained; The multimodal data anomaly detection model is solved to obtain the hypersphere radius, the hypersphere center and the projection matrix of each modal data set, so as to detect the multimodal data to be detected in the blockchain.
2. The blockchain multimodal data anomaly detection method according to claim 1 is characterized in that: The hypersphere objective function is expressed as: J=min(R 2 +C1I1+C2I2+μ1Ω(Q)+μ2Γ(Q)), Among them, J represents the hypersphere objective function; R represents the hypersphere radius; I1 represents the entropy penalty term of the normal data sample distribution; C1 represents the weight parameter of the entropy penalty term of the normal data sample distribution; I2 represents the entropy penalty term of the abnormal data sample distribution; C2 represents the weight parameter of the entropy penalty term of the abnormal data sample distribution; Ω(Q) represents the target multimodal graph regularization term; μ1 represents the weight parameter of the target multimodal graph regularization term; Γ(Q) represents the target sparse projection matrix term; μ2 represents the weight parameter of the target sparse projection matrix term.
3. The blockchain multimodal data anomaly detection method according to claim 1 is characterized in that: The construction process of the normal data sample distribution entropy penalty term includes: Based on the ratio of the distance between each normal data sample in each modal data set and the global distribution center after being mapped by its corresponding projection matrix and the sum of the distances between all normal data samples in all modal data sets and the global distribution center after being mapped by the projection matrix, the distribution entropy of the normal data sample is obtained; The target distribution entropy penalty term of the normal data sample is obtained based on the product of the distribution entropy of the normal data sample and the relaxation factor; the normal data sample distribution entropy penalty term is obtained based on the sum of the target distribution entropy penalty terms of all normal data samples in all modal data sets.
4. The blockchain multimodal data anomaly detection method according to claim 3 is characterized in that: The distribution entropy of a normal data sample is expressed as: Among them, W l m represents the distribution entropy of the lth normal data sample in the mth modal data set; ED l It represents the distance between the lth normal data sample in the mth modal data set and the global distribution center after being mapped by the projection matrix; Represents the number of normal data samples in the mth modality dataset; The entropy penalty term of normal data sample distribution is expressed as: Among them, I1 represents the entropy penalty term of the normal data sample distribution; M represents the number of modal data sets in the training set; represents the relaxation factor of the lth normal data sample in the mth modal data set.
5. The blockchain multimodal data anomaly detection method according to claim 1 is characterized in that: The construction process of the abnormal data sample distribution entropy penalty term includes: Based on the ratio of the inverse of the distance between each abnormal data sample in each modal data set and the global distribution center after being mapped by the projection matrix and the sum of the inverse of the distance between all abnormal data samples in all modal data sets and the global distribution center after being mapped by the projection matrix, the distribution entropy of the abnormal data sample is obtained; The target distribution entropy penalty item of the abnormal data sample is obtained based on the product of the distribution entropy of the abnormal data sample and the relaxation factor; the abnormal data sample distribution entropy penalty item is obtained based on the sum of the target distribution entropy penalty items of all abnormal data samples in all modal data sets.
6. The blockchain multimodal data anomaly detection method according to claim 5 is characterized in that: The distribution entropy of abnormal data samples is expressed as: in, represents the distribution entropy of the hth abnormal data sample in the mth modal data set; ED h represents the distance between the hth abnormal data sample in the mth modal data set and the global distribution center after being mapped by the projection matrix; N m Represents the number of data samples in the mth modality dataset; Represents the number of normal data samples in the mth modality dataset; Represents the abnormal data sample in the mth modal data set; The entropy penalty term of abnormal data sample distribution is expressed as: Among them, I2 represents the entropy penalty term of abnormal data sample distribution; represents the relaxation factor for the hth abnormal data sample in the mth modal data set.
7. The blockchain multimodal data anomaly detection method according to claim 1 is characterized in that: The hypersphere constraint function includes a normal data sample constraint function and an abnormal data sample constraint function, wherein the normal data sample constraint function is expressed as: Among them, Q m Represents the projection matrix of the mth modality dataset; represents the lth normal data sample in the mth modal data set; a represents the center of the hypersphere; R represents the radius of the hypersphere; express The relaxation factor of represents the number of normal data samples in the mth modal data set; M represents the number of modal data sets in the training set; The abnormal data sample constraint function is expressed as: in, represents the hth abnormal data sample in the mth modal data set, express The relaxation factor, N m Represents the number of data samples in the mth modality dataset; Represents the abnormal data sample in the mth modality dataset.
8. The blockchain multimodal data anomaly detection method according to claim 1 is characterized in that: Detection of multimodal data to be detected in the blockchain includes: Obtain the data to be tested in the blockchain, and use the projection matrix of the modality data set with the same modality as the data to be tested as the target projection matrix; Mapping the data to be detected by using the target projection matrix to obtain a feature representation of the data to be detected; The Euclidean distance between the feature representation of the data to be detected and the center of the hypersphere is calculated. If the Euclidean distance is less than or equal to the square of the radius of the hypersphere, the data to be detected is determined to be normal data. If the Euclidean distance is greater than the square of the radius of the hypersphere, the data to be detected is determined to be abnormal data.
