Molecular Classification Method Based on Hash Algorithm

Through the combination of SimHash algorithm and support vector machine, the inefficiency and hardware dependence of graph classification technology on large-scale molecular graph data sets are solved, and efficient and reliable molecular classification is achieved.

CN115331754BActive Publication Date: 2025-08-01CENT SOUTH UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210995952.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-19
Publication Date
2025-08-01
Estimated Expiration
2042-08-19

AI Technical Summary

Technical Problem

When existing graph classification technology processes graph data with continuous attributes, especially complex graph data such as protein interaction graphs, there are problems of inefficiency and dependence on expensive hardware. Especially in large-scale molecular testing, graph neural network technology has high demand for computing resources.

Method used

The SimHash algorithm is used to generate the vertex vector expression of the molecular structure diagram, and the kernel matrix is constructed by splicing neighbor node vectors and calculating similarity, and input the support vector machine to train the molecular graph classifier to realize molecular classification.

Benefits of technology

On the premise of ensuring classification accuracy, the computing resource requirements are reduced, the dependence on expensive hardware is avoided, and efficiency is improved. It is suitable for classification tasks of large-scale molecular graph datasets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115331754B_ABST
    Figure CN115331754B_ABST
Patent Text Reader

Abstract

The present invention discloses a molecular classification method based on a hash algorithm, which includes obtaining molecules with known classifications and constructing molecular structure diagrams; calculating the vector representations of vertices in the diagrams; obtaining the adjacent node vectors and representations of each vertex and splicing them to obtain the hash code vector representations of each vertex; adding up all the hash code vector representations of the vertices; obtaining the vector representations of each molecular structure diagram; calculating the similarity between any two molecular structure diagrams and constructing a kernel matrix; training to obtain a molecular graph classifier; obtaining the similarity between the molecular structure diagram of the molecule to be classified and the known molecular structure diagrams, and inputting it into the molecular graph classifier to obtain the classification result. The method of the present invention avoids the massive parameter learning in graph neural networks and no longer relies on expensive high-end hardware. It can significantly reduce the time overhead on the premise of meeting the molecular classification accuracy, and is especially suitable for classification tasks in the scenario of large-scale molecular graph datasets. Moreover, it has high reliability, good precision and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data mining, and particularly relates to a molecular classification method based on a hash algorithm. Background Art

[0002] Graph data is very common in real life, such as chemical molecular formulas in the field of biochemistry, social networks, road traffic networks, etc. With the advent of the big data era, the types and quantities of graph data have shown exponential growth, which has also promoted the rapid development of graph mining technology. An important application in the field of graph mining is graph classification; graph classification technology is used to learn the label category information of unknown graphs by training a classifier on known graphs. Graph classification technology has also promoted the development of data mining technology in the field of biochemistry, which is beneficial to quickly identifying the reaction of molecules to a certain substance, especially in large-scale molecular tests.

[0003] According to the information carried by the vertices in the graph, graph data is usually divided into two categories: graphs with discrete attributes and graphs with continuous attributes. A typical example of the former is a chemical molecular formula, where each vertex represents an atom and each edge represents a chemical bond, and this kind of graph only includes the simplest information. The latter includes protein interaction graphs, where vertices represent proteins and edges represent the connections between proteins. More importantly, each vertex contains multiple attributes representing physical and chemical properties, and their values are usually real numbers. Currently, the commonly used graph classification technologies mainly focus on the former.

[0004] However, there are still some classification methods for the latter (such as complex graph data like protein interaction graphs) nowadays. Such methods mainly include kernel methods and graph neural network methods. As a class of traditional methods, kernel methods are mainly used to measure the similarity between graphs, and the key lies in representing the complex molecular graph structure as a vector by extracting substructures. However, as the scale of the graph increases, the number of substructures will increase sharply in kernel methods, resulting in low efficiency. Graph neural network technology can learn the hidden patterns in the molecular graph structure; recent research has shown that graph neural network technology has powerful graph expression capabilities and can effectively preserve the information in the molecular graph. However, due to the massive parameter calculations, graph neural network technology is extremely dependent on expensive high-end hardware (such as Graphics Processing Unit, GPU), and requires a large amount of computing and storage resources. Summary of the Invention

[0005] The purpose of the present invention is to provide a molecular classification method based on a hash algorithm with high reliability, good accuracy and high efficiency.

[0006] The molecular classification method based on a hash algorithm provided by the present invention includes the following steps:

[0007] S1. Obtain molecules with known classifications and construct corresponding molecular structure diagrams;

[0008] S2. For the molecular structure diagrams obtained in step S1, use the SimHash algorithm to calculate the vector representations of each vertex in the diagram;

[0009] S3. For each vertex in the diagram, find all its neighbor nodes and add the vector representations of the corresponding neighbor nodes to obtain the vector sum representation of the adjacent nodes of each vertex;

[0010] S4. Concatenate the vector representation of each vertex and the vector sum representation of its adjacent nodes to obtain the hash code vector representation of each vertex;

[0011] S5. Add up all the hash code vector representations of each vertex;

[0012] S6. For each molecular structure diagram obtained in step S1, repeat steps S2 - S5 until a set number of times to obtain the vector representation of each molecular structure diagram;

[0013] S7. According to the vector representations of each molecular structure diagram obtained in step S6, calculate the similarity between any two molecular structure diagrams, thereby constructing a kernel matrix;

[0014] S8. Input the kernel matrix obtained in step S7 into a support vector machine to train and obtain a molecular graph classifier;

[0015] S9. For the molecule to be classified, obtain the vector representation of the molecular structure diagram of this molecule, calculate the similarity between this molecule and the known molecular structure diagrams, and input the similarity result into the molecular graph classifier obtained in step S8 to obtain the classification result of the molecule to be classified.

[0016] The step of using the SimHash algorithm to calculate the vector representations of each vertex in the molecular structure diagram obtained in step S2 specifically includes the following steps:

[0017] Initialize the parameters of the SimHash algorithm: Generate K d - dimensional vectors that follow a Gaussian distribution; d is the number of vertex features in the molecular structure diagram;

[0018] Represent each vertex in the molecular structure diagram as a d - dimensional feature vector x, and randomly generate K d - dimensional hyperplane normal vectors n (k) , k = 1, 2,..., K;

[0019] Use the following formula to convert the feature vector x into a K - dimensional hash code, thereby obtaining the vector representation of the vertex:

[0020]

[0021] Wherein is the k-th dimensional hash code.

[0022] The adding of the vector representations of the corresponding neighbor nodes described in step S3 is specifically the adding of the corresponding bits of the vector representations of the corresponding neighbor nodes.

[0023] The concatenating of the vector representation of each vertex and the vector sum representation of the adjacent nodes of the vertex described in step S4 to obtain the hash code vector representation of each vertex is specifically the concatenating of the vector representation of each vertex and the vector sum representation of the adjacent nodes of the vertex, so as to represent each vertex as a 2K-dimensional hash code, thereby obtaining the hash code vector representation of each vertex.

[0024] The adding of all the hash code vector representations of each vertex described in step S5 is specifically the adding of the corresponding bits of the hash code vector representations of all the vertices.

[0025] For each molecular structure diagram obtained in step S1, steps S2 to S5 are repeated until a set number of times to obtain the vector representation of each molecular structure diagram, which specifically includes the following steps:

[0026] For each molecular structure diagram obtained in step S1, steps S2 to S5 are repeated until a set number of times R to obtain the vector representation of each molecular structure diagram; when repeating step S2, during the process of initializing the parameters of the SimHash algorithm, K K-dimensional vectors that follow a Gaussian distribution are generated.

[0027] The calculating of the similarity between any two molecular structure diagrams according to the vector representation of each molecular structure diagram obtained in step S6, so as to construct a kernel matrix, specifically includes the following steps:

[0028] Calculate the Hamming similarity between any two molecular structure diagrams according to the vector representation of each molecular structure diagram obtained in step S6;

[0029] The kernel matrix is calculated using the following formula:

[0030]

[0031] Where k(i,j) is the element in the i-th row and j-th column of the kernel matrix, used to represent the similarity between graph g i and graph g j ; is the k-th dimensional value in the r-th vector representation of graph g i ; is the k-th dimensional value in the r-th vector representation of graph g j ; represents 1 when the above two values are equal and 0 when they are not equal.

[0032] Input the kernel matrix obtained in step S7 into a support vector machine to train a molecular graph classifier, which specifically includes the following steps:

[0033] Use a support vector machine to train the molecular graph classifier:

[0034] w T ·x + b = 0

[0035] In the formula, w is the normal vector of the hyperplane; x is the vector representation of the molecular graph; b is the intercept;

[0036] Take the obtained kernel matrix as the non - linear kernel of the support vector machine and construct the following objective function:

[0037]

[0038]

[0039] 0 ≤ α i ≤ C, i = 1, 2,..., n

[0040] In the formula, α = [α1, α2,..., α n ; n is the number of molecular graphs; α i is the Lagrange multiplier; y i is the molecular graph label; k(i, j) is the element in the i - th row and j - th column of the kernel matrix; C is the penalty factor;

[0041] Use the quadratic programming algorithm to solve the objective function to obtain the optimal solution

[0042] Then calculate the optimal value of b which is

[0043] Finally, obtain the molecular graph classifier; for the molecular structure graph g corresponding to a molecule m , the predicted result of the class label of this molecule is where k(m, i) is the similarity between graph g m and graph g i , sign(Z) is a binary function, if Z is positive, then sign(Z) = 1, if Z is negative, then sign(Z) = - 1; the predicted label result of 1 indicates positive, and the predicted label result of - 1 indicates negative.

[0044] The molecular classification method based on the hash algorithm provided by the present invention efficiently represents the molecular graph structure by randomly generating several groups of SimHash functions, achieving linear time and space complexity with respect to the number of molecular graphs, effectively preserving the similarity information between graphs, being able to generate a kernel matrix for a support vector machine, and inputting the kernel matrix into the support vector machine to train and obtain a molecular graph classifier, thereby completing the classification of molecules; the method of the present invention avoids the massive parameter learning in graph neural networks, and at the same time no longer relies on expensive high-end hardware, can significantly reduce the time overhead on the premise of meeting the molecular classification accuracy, is particularly suitable for classification tasks in the scenario of large-scale molecular graph datasets, and has high reliability, good accuracy, and high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a schematic flowchart of the method of the present invention.

[0046] Figure 2 It is a schematic diagram of the overall idea of the method of the present invention.

[0047] Figure 3 It is a schematic diagram of the process of steps S2 to S5 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] As Figure 1 shown is a schematic flowchart of the method of the present invention:

[0049] In general, each molecule can be modeled as a graph g=(V, E, A, f), where V is the vertex set of the graph, E is the edge set of the graph, A is the attribute set of the graph, each vertex in the graph carries multiple numerical attributes, and f: represents the vertex as a real-valued vector of |A| dimensions Each dimension represents an attribute, and the dimension value represents the attribute value. At the same time, the molecular graph corresponds to a class label representing a certain attribute of the molecule. The main objective of the method of the present invention is to given the molecular structure diagrams of n molecules and the corresponding class labels express the n molecular structure diagrams as n low-dimensional vectors By learning from to obtain a molecular graph classifier, so as to realize the label classification of unknown molecules, the specific idea is as Figure 2 shown.

[0050] Therefore, the molecular classification method based on the hash algorithm provided by the present invention includes the following steps:

[0051] S1. Obtain molecules with known classifications and construct corresponding molecular structure diagrams;

[0052] S2. For the molecular structure diagram obtained in step S1, use the SimHash algorithm to calculate the vector representation of each vertex in the diagram; specifically, it includes the following steps:

[0053] Initialize the parameters of the SimHash algorithm: Generate K d-dimensional vectors that follow a Gaussian distribution; d is the number of features of the vertices in the molecular structure diagram;

[0054] Represent each vertex in the molecular structure diagram as a d-dimensional feature vector x at the initial stage, and randomly generate K d-dimensional hyperplane normal vectors n (k) , k = 1, 2,..., K;

[0055] Use the following formula to convert the feature vector x into a K-dimensional hash code, thereby obtaining the vector representation of the vertex:

[0056]

[0057] In the formula is the k-th dimensional hash code;

[0058] S3. For each vertex in the diagram, find all the neighbor nodes of the vertex, and add the vector representations of the corresponding neighbor nodes to obtain the sum of the vector representations of the adjacent nodes of each vertex; specifically, add the vector representations of the corresponding neighbor nodes bit by bit.

[0059] S4. Concatenate the vector representation of each vertex and the sum of the vector representations of the adjacent nodes of the vertex to obtain the hash code vector representation of each vertex; specifically, concatenate the vector representation of each vertex and the sum of the vector representations of the adjacent nodes of the vertex, so as to represent each vertex as a 2K-dimensional hash code, thereby obtaining the hash code vector representation of each vertex.

[0060] S5. Add up all the hash code vector representations of each vertex; specifically, add the hash code vector representations of all vertices bit by bit.

[0061] S6. For each molecular structure diagram obtained in step S1, repeat steps S2 - S5 until the set number of times to obtain the vector representation of each molecular structure diagram, specifically including the following steps:

[0062] For each molecular structure diagram obtained in step S1, repeat steps S2 - S5 until the set number of times R to obtain the vector representation of each molecular structure diagram; when repeating step S2, during the process of initializing the parameters of the SimHash algorithm, generate K K-dimensional vectors that follow a Gaussian distribution; among them, the schematic diagram of the process of steps S2 - S5 is as Figure 3 shown;

[0063] Specifically, when initializing for the first time, generate K d-dimensional vectors that follow a Gaussian distribution; when initializing for the second to the R-th time, generate K K-dimensional vectors that follow a Gaussian distribution each time.

[0064] S7. According to the vector representations of each molecular structure diagram obtained in step S6, calculate the similarity between any two molecular structure diagrams, and thus construct a kernel matrix. Specifically, it includes the following steps:

[0065] According to the vector representations of each molecular structure diagram obtained in step S6, calculate the Hamming similarity between any two molecular structure diagrams.

[0066] The kernel matrix is calculated using the following formula:

[0067]

[0068] In the formula, k(i,j) is the element in the i-th row and j-th column of the kernel matrix, which is used to represent the similarity between graph g i and graph g j ; is the k-th dimensional value of graph g i in the r-th vector representation; is the k-th dimensional value of graph g j in the r-th vector representation; represents 1 when the above two values are equal and 0 when they are not equal;

[0069] S8. Input the kernel matrix obtained in step S7 into a support vector machine to train a molecular graph classifier. Specifically, it includes the following steps:

[0070] Use a support vector machine to train the molecular graph classifier:

[0071] w T ·x + b = 0

[0072] In the formula, w is the normal vector of the hyperplane; x is the vector representation of the molecular graph; b is the intercept;

[0073] Take the obtained kernel matrix as the non-linear kernel of the support vector machine and construct the following objective function:

[0074]

[0075]

[0076] 0 ≤ α i ≤ C, i = 1, 2,..., n

[0077] In the formula, α = [α1, α2,..., α n ; n is the number of molecular graphs; α i is the Lagrange multiplier; yi is the molecular graph label; k(i,j) is the element in the i-th row and j-th column of the kernel matrix; C is the penalty factor;

[0078] Use the quadratic programming algorithm to solve the objective function to obtain the optimal solution

[0079] Then calculate the optimal value of b is

[0080] Finally, obtain the molecular graph classifier; for the molecular structure graph g corresponding to a molecule m , the predicted result of the class label of this molecule is where k(m,i) is the similarity between the graph g m and the graph g i , sign(Z) is a binary function, if Z is positive, then sign(Z)=1, if Z is negative, then sign(Z)=-1; the predicted result of the label being 1 indicates positive, and the predicted result of the label being -1 indicates negative. Positive means that the molecule has this predicted property, and negative means that the molecule does not have this predicted property;

[0081] S9. For the molecule to be classified, obtain the vector expression of the molecular structure graph of this molecule, calculate the similarity between this molecule and the known molecular structure graphs, and input the similarity result into the molecular graph classifier obtained in step S8, so as to obtain the classification result of the molecule to be classified.

[0082] This molecular classification method provided by the present invention is applicable to the classification of molecules including those with complex molecular structure graphs such as protein interaction graphs. The classification result is whether the molecule has a certain property. For example, in an in vitro activity test of cyclooxygenase COX-2 inhibitors, according to their reactions to human recombinant enzymes, they are divided into active compounds and inactive compounds.

Claims

1. A molecular classification method based on a hash algorithm, comprising the following steps: S1. Obtain molecules with known classifications and construct corresponding molecular structure diagrams; S2. For the molecular structure diagrams obtained in step S1, use the SimHash algorithm to calculate the vector representations of each vertex in the diagram; specifically, it includes the following steps: Initialize the parameters of the SimHash algorithm: generate R groups of K d-dimensional vectors that follow a Gaussian distribution; d is the number of features of the vertices in the molecular structure diagram; Each vertex in the molecular structure diagram is represented as a d-dimensional feature vector x at the initial stage, and K d-dimensional hyperplane normal vectors n that follow a Gaussian distribution are randomly generated (k) , where k = 1, 2,..., K; Use the following formula to convert the feature vector x into a K-dimensional hash code, thereby obtaining the vector representation of the vertex: where is the k-th dimensional hash code; S3. For each vertex in the diagram, find all the neighbor nodes of the vertex and add the corresponding vector representations of the neighbor nodes to obtain the sum of the vector representations of the adjacent nodes of each vertex; S4. Concatenate the vector representation of each vertex and the sum of the vector representations of the adjacent nodes of the vertex to obtain the hash code vector representation of each vertex; S5. Add up all the hash code vector representations of each vertex; S6. For each molecular structure diagram obtained in step S1, repeat steps S2 to S5 until a set number of times, to obtain the vector representation of each molecular structure diagram; S7. According to the vector representations of each molecular structure diagram obtained in step S6, calculate the similarity between any two molecular structure diagrams, thereby constructing a kernel matrix; S8. Input the kernel matrix obtained in step S7 into a support vector machine to train and obtain a molecular graph classifier; S9. For the molecule to be classified, obtain the vector representation of the molecular structure diagram of the molecule, calculate the similarity between the molecule and the known molecular structure diagrams, and input the similarity result into the molecular graph classifier obtained in step S8, thereby obtaining the classification result of the molecule to be classified.

2. The molecular classification method based on the hash algorithm according to claim 1, wherein The adding of the corresponding vector representations of the neighbor nodes described in step S3 specifically means adding the corresponding vector representations of the neighbor nodes bit by bit.

3. The molecular classification method based on the hash algorithm according to claim 2, wherein The concatenating of the vector representation of each vertex and the sum of the vector representations of the adjacent nodes of the vertex described in step S4 to obtain the hash code vector representation of each vertex specifically means concatenating the vector representation of each vertex and the sum of the vector representations of the adjacent nodes of the vertex, thereby expressing each vertex as a 2K-dimensional hash code, thereby obtaining the hash code vector representation of each vertex.

4. The molecular classification method based on the hash algorithm according to claim 3, characterized in that The adding up of all the hash code vector representations of each vertex described in step S5 specifically means adding the hash code vector representations of all the vertices bit by bit.

5. The molecular classification method based on the hash algorithm according to claim 4, characterized in that The repeating of steps S2 to S5 until a set number of times for each molecular structure diagram obtained in step S1 to obtain the vector representation of each molecular structure diagram described in step S6 specifically includes the following steps: For each molecular structure diagram obtained in step S1, repeat steps S2 to S5 until a set number of times R to obtain the vector representation of each molecular structure diagram; when repeating step S2, during the process of initializing the parameters of the SimHash algorithm, generate K K-dimensional vectors that follow a Gaussian distribution.

6. The molecular classification method based on the hash algorithm according to claim 5, characterized in that The calculating of the similarity between any two molecular structure diagrams according to the vector representations of each molecular structure diagram obtained in step S6 to construct a kernel matrix described in step S7 specifically includes the following steps: According to the vector representations of each molecular structure diagram obtained in step S6, calculate the Hamming similarity between any two molecular structure diagrams; The kernel matrix is calculated using the following formula: where \(k(i, j)\) is the element in the \(i\)-th row and \(j\)-th column of the kernel matrix, used to represent the similarity between graph \(g\) i and graph \(g\) j ; is the \(k\)-th dimensional value of graph \(g\) i in the \(r\)-th vector representation; is the \(k\)-th dimensional value of graph \(g\) j in the \(r\)-th vector representation; is 1 when the above two values are equal and 0 when they are not equal.

7. The molecular classification method based on the hash algorithm according to claim 6, wherein As described in step S8, input the kernel matrix obtained in step S7 into a support vector machine to train a molecular graph classifier, which specifically includes the following steps: Use a support vector machine to train a molecular graph classifier: w T ·x + b = 0 In the formula, w is the normal vector of the hyperplane; x is the vector representation of the molecular graph; b is the intercept; Take the obtained kernel matrix as the non-linear kernel of the support vector machine and construct the following objective function: 0 ≤ α i ≤ C, i = 1, 2, ..., n where α = [α1, α2,..., α n ; n is the number of molecular graphs; α i is the Lagrange multiplier; y i is the molecular graph label; k(i, j) is the element in the i-th row and j-th column of the kernel matrix; C is the penalty factor; The quadratic programming algorithm is used to solve the objective function to obtain the optimal solution Then calculate the optimal value of b For Finally, a molecular graph classifier is obtained; for the molecular structure graph g corresponding to a molecule m , the predicted result of the class label of this molecule is where k(m,i) is the similarity between graph g m and graph g i , sign(Z) is a binary function, if Z is positive, then sign(Z)=1, if Z is negative, then sign(Z)=-1; a predicted label result of 1 indicates positive, and a predicted label result of -1 indicates negative.

Citation Information

Patent Citations

  • Code classification method based on Hash algorithm

    CN116432125A