A machine learning-based spectrum and molecular structure comparison and matching system

Through a multimodal deep learning architecture and a shared embedding space learning strategy, combined with convolutional neural networks and graph neural networks, the problems of inefficiency and interpretability in matching spectral data with molecular structures are solved, and efficient and accurate automatic matching of spectra and molecular structures is achieved.

CN120508836BActive Publication Date: 2025-09-23CHANGSHU INSTITUTE OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510999873.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-09-23
Estimated Expiration
2045-07-21

AI Technical Summary

Technical Problem

The matching of spectral data and molecular structure in existing technologies has problems such as low efficiency, reliance on manual experience, insufficient feature extraction, weak model generalization ability and lack of structural interpretability, which makes it difficult to automatically match spectral information with molecular structure.

Method used

A multimodal deep learning architecture is adopted, combined with convolutional neural networks and graph neural networks, to construct a matching model between spectrum vectors and molecular structure vectors. Through shared embedding space learning strategy and attention mechanism, efficient and accurate matching of spectra and molecular structures is achieved.

Benefits of technology

It has greatly improved the accuracy and robustness of spectral analysis and molecular structure matching, achieved automated and interpretable matching of spectral information and molecular structure, and improved the generalization ability and interpretability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508836B_ABST
    Figure CN120508836B_ABST
Patent Text Reader

Abstract

The present invention discloses a spectrum and molecular structure comparison and matching system based on machine learning, which relates to the field of spectral intelligent analysis. The system includes a model construction module, a training optimization module, a candidate calculation module, and an interpretation visualization module. The present invention automatically extracts the deep semantic features of the spectrum and structure by constructing a multimodal deep learning model, thereby greatly improving the accuracy and robustness of spectral analysis and molecular structure matching. A shared embedding space learning strategy is adopted to project different modalities into the same feature space to achieve unified matching and similarity scoring. The introduction of an attention mechanism realizes the visual mapping between spectral peaks and molecular structure fragments, which helps to understand the chemical groups or atoms corresponding to each spectral peak and enhance the interpretability of the matching results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent spectrum analysis, and in particular to a spectrum and molecular structure comparison and matching system based on machine learning. Background Art

[0002] The identification and confirmation of molecular structures are fundamental and critical tasks in fields such as chemistry, medicine, materials, and the environment. Traditionally, researchers have relied primarily on spectroscopic techniques to infer the structures of unknown compounds. However, the correlation between spectral data and molecular structure is complex and nonlinear, and the analysis process relies heavily on manual experience and expert knowledge, resulting in low efficiency and susceptibility to subjective bias. In recent years, with the continuous expansion of chemical databases, an increasing number of structure-spectrum pairs have been standardized and made public. However, how to automatically learn the matching relationship between spectra and structures from existing data efficiently and accurately still faces the following challenges: Spectral information is high-dimensional and noisy, and spectra vary under different acquisition conditions, making direct matching difficult; molecular structure is complex, encompassing both graph structure and spatial configuration and electronic information, making it difficult to model using traditional rule-based matching methods; cross-modal feature fusion is difficult, as spectra are in sequence or vector form, while molecules are graph structures or SMILES sequences, resulting in significant modal differences between the two; existing methods are mostly based on database retrieval and lack structural interpretation capabilities, making it impossible to assign structural meaning to each spectral peak, limiting their application in traceability and discovery tasks.

[0003] Although some studies have attempted to use machine learning methods to classify spectra or identify structural fragments, such methods generally have problems such as insufficient feature extraction, weak model generalization ability, and lack of structural interpretability. Summary of the Invention

[0004] In view of the problems of existing reliance on manual experience, low efficiency, complex spectral information and matching difficulties, the present invention is proposed.

[0005] Therefore, the problem to be solved by the present invention is how to achieve efficient, accurate, and interpretable automatic matching between spectral information and molecular structure, thereby replacing the traditional structure analysis method that relies on manual experience, is inefficient, and has poor scalability. To solve the above technical problems, the present invention provides the following technical solutions:

[0006] In a first aspect, an embodiment of the present invention provides a spectrum and molecular structure comparison and matching system based on machine learning, which includes a model construction module for constructing a matching model between a spectrum vector and a molecular structure vector. The matching model is based on a multimodal deep learning architecture, integrating a convolutional neural network to extract spectral pattern features and a graph neural network to extract molecular structure features, normalizing the original spectral signal into a fixed-length vector form, and constructing a spectrum vector:

[0007]

[0008] Among them, S is the spectrum vector, s i is the light intensity value of the i-th sampling point, L is the number of spectrum sampling points, is the real number space;

[0009] The candidate molecular structure is represented as a graph. A one-dimensional convolutional neural network is used to extract the local pattern features of the spectrum. Multiple rounds of message propagation are performed on the molecular graph through the graph neural network. Two fully connected networks are used to map the two features to an embedding space of the same dimension. A shared embedding space learning strategy is used to train the correlation scoring function between the spectrum and the molecular structure. The molecular graph is input into the graph neural network. The updated nodes in each round of propagation are represented as follows:

[0010]

[0011] in, is the set of neighbor nodes of node v, l is the number of current GNN layers, is the feature representation of node u in layer l, is the updated feature representation of node v at layer l+1, AGG is the aggregation function, is the learnable weight parameter of the lth layer, is a nonlinear activation function;

[0012] Finally, all nodes are aggregated to obtain structural embedding. Through the embedding space of shared dimensions, the embedding distance between matching pairs is minimized, and a similarity scoring function is constructed. The cosine similarity scoring expression is as follows:

[0013]

[0014] Among them, S is a known spectrum data, G is the structure diagram of a candidate molecule, is the embedding vector obtained by the CNN encoder of the spectral sample S, is the embedding vector obtained after the molecular graph G passes through the GNN encoder;

[0015] A training optimization module is used to use known structure-spectrum paired samples as training data and adopt contrastive learning or triplet loss function for training;

[0016] The candidate calculation module is used to calculate the matching scores of all candidate molecules in the database based on the input target spectrum through the matching model, calculate the similarity scores of all candidate molecular structure vectors with the target spectrum vector, and sort all candidate structures according to the scores:

[0017] ;

[0018] Take the top-K high-scoring candidate molecules as the recognition results, and output the matching candidate molecule list,

[0019] Corresponding matching scores and rankings; sort candidate molecules according to the matching scores and output the top-N candidate structures related to the target spectrum;

[0020] The interpretation and visualization module is used to map the intermediate attention weights back to the spectral peak positions and atoms or groups in the structure, realizing the aligned interpretation of the spectrum and the molecular structure. A cross-attention layer is inserted between the spectrum embedding encoder and the structure encoder. For each spectral peak vector, the attention weight between it and each structural node is calculated:

[0021]

[0022] in, is the attention weight between the i-th spectral peak and the j-th structural node, is the embedding vector of the i-th spectral peak position, is the embedding vector of the node in the j-th molecular structure, M is the total number of nodes in the molecular structure, is the embedding vector of the kth node in the molecular structure;

[0023] For each spectral peak, the structural node index corresponding to the maximum attention value is used; if multiple groups are interpreted in combination, the α ij Perform threshold screening and select α ij All j >δ are taken as the associated atom set; the Top-N candidate structures are further confirmed by combining experimental mass spectrometry and NMR data.

[0024] As a preferred solution of the spectrum and molecular structure comparison and matching system based on machine learning of the present invention, wherein: known structure-spectrum paired samples are used as training data, and contrastive learning or triple loss function is used for training, including:

[0025] Construct triple samples as spectrogram, correct structure and wrong structure, construct paired samples including matching as 1 and non-matching as 0; calculate the loss function and backpropagate to update the parameters, where the triple loss function expression is as follows:

[0026]

[0027] Among them, α is the margin hyperparameter, is the molecular structure G that correctly matches the spectrum S + The structure embedding vector obtained after GNN encoding, is the molecular structure G that is incorrectly paired with the spectrum S - The embedding vector obtained after GNN encoding;

[0028] Then backpropagation and gradient descent optimization algorithms are performed to update the parameters.

[0029] As a preferred embodiment of the machine learning-based spectrum and molecular structure comparison and matching system of the present invention, candidate molecules are sorted according to the matching scores, and the top-N candidate structures related to the target spectrum are output, including:

[0030] A matching score threshold τ is set, and all candidate molecules are screened. Candidate molecules with scores below the threshold are eliminated. The screened candidate set is sorted in descending order by matching score. Based on the parameter N set by the user or the system, the top N candidate molecules with the highest scores are dynamically selected. For the top-N candidate structures, a candidate structure list containing matching scores and comprehensive information is output.

[0031] As a preferred embodiment of the machine learning-based spectrum and molecular structure comparison and matching system of the present invention, the top-N candidate structures are further confirmed by combining experimental mass spectrometry and NMR data, including:

[0032] For mass spectrum matching, the normalized mass spectrum cosine similarity evaluation is used. For NMR matching, the matching score is constructed based on the sum of squared displacement differences, and the weight coefficient λ is set. MS ,λ NMR ,λ ML The comprehensive scoring formula is as follows:

[0033]

[0034] Among them, score ML (G i ) is the original score of the machine learning matching model;

[0035] According to TotalScore(G i ) Re-rank the Top-N candidate structures. If the mass spectrum and NMR matching degree of a candidate structure are higher than those of other candidate structures, and its machine learning model score is also high, then the structure is confirmed as the final result; if multiple candidate structures have the same score, further confirmation is supplemented by experimental verification.

[0036] In a second aspect, an embodiment of the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, the steps of the spectrum and molecular structure comparison and matching system based on machine learning as described in the first aspect of the present invention are implemented.

[0037] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, the steps of the machine learning-based spectrum and molecular structure comparison and matching system as described in the first aspect of the present invention are implemented.

[0038] The beneficial effects of the present invention are as follows: the present invention automatically extracts deep semantic features of spectra and structures by constructing a multimodal deep learning model, thereby greatly improving the accuracy and robustness of spectral analysis and molecular structure matching.

[0039] A shared embedding space learning strategy is used to project different modalities into the same feature space, achieving unified matching and similarity scoring. An attention mechanism is introduced to achieve a visual mapping between spectral peaks and molecular structure fragments, helping to understand the chemical groups or atoms corresponding to each spectral peak and enhancing the interpretability of matching results. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 Schematic diagram of the structure of the spectrum and molecular structure comparison and matching system based on machine learning.

[0042] Figure 2 A diagram of the computer equipment for the machine learning-based spectrum and molecular structure comparison and matching system. DETAILED DESCRIPTION

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0044] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0045] Secondly, the term "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in various places throughout this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive of other embodiments.

[0046] Example 1

[0047] Reference Figure 1~Figure 2 , which is the first embodiment of the present invention, provides a spectrum and molecular structure comparison and matching system based on machine learning, including:

[0048] S1: Construct a matching model between spectrum vectors and molecular structure vectors. The matching model is based on a multimodal deep learning architecture, integrating convolutional neural networks to extract spectral pattern features and graph neural networks to extract molecular structure features, and adopts a shared embedding space learning strategy to train the correlation scoring function between the spectrum and the molecular structure.

[0049] Preferably, the original spectral signal is normalized into a fixed-length vector form to construct a spectrogram vector:

[0050]

[0051] Among them, S is the spectrum vector, s i is the light intensity value of the i-th sampling point, L is the number of spectrum sampling points, is the real number space;

[0052] The candidate molecular structure is represented as a graph, and the local pattern features of the spectrum are extracted using a one-dimensional convolutional neural network. Multiple rounds of message propagation are performed on the molecular graph through a graph neural network, and two fully connected networks are used to map the two features into an embedding space of the same dimension.

[0053] Preferably, the molecular graph is input into the graph neural network, and the updated nodes in each round of propagation are represented as follows:

[0054]

[0055] in, is the set of neighbor nodes of node v, l is the number of current GNN layers, is the feature representation of node u in layer l, is the updated feature representation of node v at layer l+1, AGG is the aggregation function, is the learnable weight parameter of the lth layer, is a nonlinear activation function;

[0056] Finally, all nodes are aggregated to obtain structural embedding. Through the embedding space of shared dimensions, the embedding distance between matching pairs is minimized, and a similarity scoring function is constructed. The cosine similarity scoring expression is as follows:

[0057]

[0058] Among them, S is a known spectrum data, G is the structure diagram of a candidate molecule, is the embedding vector obtained by the CNN encoder of the spectral sample S, is the embedding vector obtained after the molecular graph G passes through the GNN encoder.

[0059] Furthermore, infrared spectral data and corresponding molecular structures from the public database NIST Chemistry WebBook were selected, covering common organic small molecules. Sample size: A total of 6,000 sets of structure-spectrum matching pairs were collected; Spectrum processing: The original FTIR spectral signal in the range of 400–4000 cm -1 The range is uniformly sampled, the number of sampling points L = 1024, and normalized to the interval 0-1 to obtain the spectrum vector S∈R 1024 , RDKit is used to convert the molecular SMILES into a molecular graph G = (V, E), and the node features include atom type, bond type and atomic heterocycle label.

[0060] Furthermore, the spectrogram encoder: a three-layer one-dimensional convolutional neural network outputs the spectrogram embedding vector z S ∈R 128 , structure encoder: a three-layer graph convolutional network, performs three rounds of message passing, and outputs the molecular structure embedding vector z G ∈R 128 , embedding space sharing: the two encoders are mapped to the same embedding space of dimension 128; training objective: triplet loss is used; training details: Adam optimizer, learning rate 1e-4, batch size = 128, training 50 rounds.

[0061] Furthermore, 1,000 groups were randomly sampled from the dataset for testing. Evaluation metrics included Top-1 accuracy, which indicates that the candidate with the highest predicted score is completely consistent with the true structure; Top-5 accuracy, which indicates that the true structure appears in the top five predicted candidates; and average cosine similarity, which represents the average similarity score of all predicted pairs. The experimental results are as follows:

[0062] Table 1: Core evaluation indicators of the model in the task of matching spectra and molecular structures

[0063]

[0064] Note: The model accurately matched 64.5% of the test samples to the corresponding molecular structures. In more than 90% of cases, the true molecular structure was among the top five candidate results, meeting the requirements for rapid screening. The high average cosine similarity proves that the model has learned an effective spectrum-structure correspondence.

[0065] S2: Use known structure-spectrum paired samples as training data and use contrastive learning or triplet loss function for training.

[0066] Preferably, the triplet samples are constructed as spectrograms, correct structures, and incorrect structures, and the paired samples are constructed including matching as 1 and non-matching as 0; the loss function is calculated and the parameters are updated through back propagation, wherein the triplet loss function expression is as follows:

[0067]

[0068] Among them, α is the margin hyperparameter, is the molecular structure G that correctly matches the spectrum S + The structure embedding vector obtained after GNN encoding, is the molecular structure G that is incorrectly paired with the spectrum S - The embedding vector obtained after GNN encoding;

[0069] Then backpropagation and gradient descent optimization algorithms are performed to update the parameters.

[0070] Furthermore, the infrared band 400–4000 cm -1 The spectrum signal is uniformly sampled to 1024 sampling points; the sampling signal is normalized to obtain the spectrum vector S=[s1,s2,...,s 1024 ]∈R 1024 ;Structure preprocessing: Use RDKit to convert the molecular SMILES into a graph structure G=(V,E). The node features include atom type, atomic heterocycle label, bond type, etc.

[0071] Furthermore, for each spectrum S, the corresponding real structure G is selected + As a positive sample; randomly sample another 5 structures from the database, remove the real structure, and use them as candidate negative samples G − ; Use the dynamic hard negative sample mining strategy to select the current model embedding distance d(z S ,z G− ) The nearest one is used as the final negative sample to increase the difficulty of training.

[0072] Furthermore, a three-layer one-dimensional convolutional network is constructed with kernel sizes of 7, 5, and 3, and the number of channels is 64, 128, and 128, respectively. Each layer is followed by Batch Normalization and ReLU activation. Finally, it is mapped to a 128-dimensional vector z through a fully connected layer. S ∈R 128 3-layer graph convolutional network, each layer aggregates neighbor node features through message passing; the node feature dimension is expanded from the initial 50 dimensions to 128 dimensions; all node features are averaged and pooled to obtain the molecular structure embedding z G ∈R 128 .

[0073] The training loss function decreases steadily during the training process, and the accuracy of the validation set triples reaches 93%; dynamic difficult negative sample mining increases the training difficulty and significantly improves the model's discrimination ability.

[0074] Test results: In 1000 test samples, the model's top-1 matching accuracy reached 65.8%; the top-5 matching accuracy reached 91.2%; and the average cosine similarity was 0.85. Specific example: The input spectrum contains a clear carbonyl peak (1725cm -1 ) and aromatic ring vibration peaks; the model's Top-3 output structures all contain carbonyl and aromatic ring groups, and the Top-1 accurately corresponds to the target structure; combined with subsequent mass spectrometry and NMR verification, the accuracy of the match was further confirmed.

[0075] S3: For the input target spectrum, the matching model is used to calculate the matching scores with all candidate molecules in the database, the candidate molecules are sorted according to the matching scores, and the top-N candidate structures related to the target spectrum are output.

[0076] Preferably, for all candidate molecular structure vectors, the similarity scores with the target spectrum vector are calculated, and all candidate structures are sorted according to the scores:

[0077] ;

[0078] Take the top-K high-scoring candidate molecules as the recognition results, and output the matching candidate molecule list,

[0079] Corresponding matching scores and rankings.

[0080] Preferably, a matching score threshold τ is set, and the scores of all candidate molecules are screened, and candidate molecules with scores below the threshold are eliminated. The screened candidate set is sorted in descending order by matching score, and the top N candidate molecules with the highest scores are dynamically selected according to the parameter N set by the user or the system; for the top-N candidate structures, a candidate structure list containing matching scores and comprehensive information is output.

[0081] Furthermore, a CNN encoder (3 layers of 1D convolution + pooling) is used to map the normalized spectra into vectors, and a GNN is used to aggregate node information after multiple rounds of propagation for each candidate molecular graph to generate a structural embedding;

[0082] For each candidate molecule G i , calculate its cosine similarity with the target spectrogram vector, assuming that the partial scores are as follows:

[0083] Table 2: Top-5 candidate molecular structure matching results

[0084]

[0085] Set the threshold τ=0.80, eliminate candidate structures with scores below the threshold, and after screening, there are 278 valid candidate structures left. Arrange the remaining candidates in descending order of score: set Top-N=5, and obtain the top 5 molecular structures with the highest scores; output the matching result list: the system outputs the molecular ID, score, molecular formula,

[0086] Structure diagram, mass, optional mass spectrometry / NMR / SMILES.

[0087] S4: Map the intermediate attention weights back to the spectral peak positions and atoms or groups in the structure to achieve aligned interpretation of the spectrum and molecular structure; further confirm the Top-N candidate structures by combining experimental mass spectrometry and NMR data.

[0088] Preferably, a cross-attention layer is inserted between the spectrogram embedding encoder and the structure encoder, and for each spectrum peak vector, the attention weight between it and each structure node is calculated:

[0089]

[0090] in, is the attention weight between the i-th spectral peak and the j-th structural node, is the embedding vector of the i-th spectral peak position, is the embedding vector of the node in the j-th molecular structure, M is the total number of nodes in the molecular structure, is the embedding vector of the kth node in the molecular structure;

[0091] For each spectral peak, the structural node index corresponding to the maximum attention value is used; if multiple groups are interpreted in combination, the α ij Perform threshold screening and select α ij All j >δ are considered as the associated atom set.

[0092] Preferably, for mass spectrum matching, the normalized mass spectrum cosine similarity evaluation is used, and for NMR matching, the matching score is constructed based on the sum of squared displacement differences, and the weight coefficient λ is set MS ,λ NMR ,λ ML The comprehensive scoring formula is as follows:

[0093]

[0094] Among them, score ML (G i ) is the original score of the machine learning matching model;

[0095] According to TotalScore(G i) Re-rank the Top-N candidate structures. If the mass spectrum and NMR matching degree of a candidate structure are higher than those of other candidate structures, and its machine learning model score is also high, then the structure is confirmed as the final result; if multiple candidate structures have the same score, further confirmation is supplemented by experimental verification.

[0096] Furthermore, the target spectrum is: infrared spectrum (IR): the number of sampling points is L = 1024, in cm -1 = is the horizontal axis, with a wavelength range of 400–4000; Mass spectrum (MS): obtained in electron impact mode, with main peaks at approximately m / z 137, 152, and 121; NMR spectrum (1H): δ values ​​appear in the regions of 7.2 ppm (aromatic), 3.8 ppm (-OCH3), and 2.8 ppm (-CH2-). 3000 candidate molecules with similar molecular formulas were selected from PubChem, and the normalized IR spectra S∈R 1024 , input one-dimensional CNN to extract the local pattern of spectrum peak, and output the spectrum peak vector Z S ∈R 64×128 , each candidate molecular structure is converted into a graph G = (V, E), where nodes are atoms (C, H, O) and edges are bonds. A three-layer GCN is used to generate an embedding representation h for each atomic node j ∈R 128 , and get the structure matrix Z G ∈R M ×128 , where M≈15.

[0097] Calculate the attention weight for each spectral peak and structural node. Example results (position of maximum attention value):

[0098] The 12th peak with the highest weight corresponds to structural node j=7 (the O-CH3 group on the benzene ring); the 35th peak is associated with nodes j=3, 4, and 5, representing carbon atoms in the benzene ring. The target spectrum is paired with each candidate structure, and then mass spectrometry, NMR, and comprehensive scores are performed. All candidate structures are ranked by Total Score, and the top 5 are as follows:

[0099] Table 3: Top-5 candidate molecular structures based on TotalScore ranking

[0100]

[0101] Note: The top-1 candidate structure matches the actual target molecule. Peak attention mapping verifies that approximately 91% of the peak positions in the IR spectrum can be correctly attributed to the functional groups of the target structure.

[0102] This embodiment also provides a computer device suitable for a spectrum and molecular structure comparison and matching system based on machine learning, including a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute computer-executable instructions to implement the spectrum and molecular structure comparison and matching system based on machine learning proposed in the above embodiment.

[0103] The computer device may be a terminal, comprising a processor, memory, a communication interface, a display, and an input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores an operating system and computer programs. The internal memory provides an environment for the operating system and computer programs stored in the non-volatile storage media. The communication interface of the computer device is used to communicate with external terminals via wired or wireless communication. Wireless communication may be achieved via Wi-Fi, a carrier network, NFC (near-field communication), or other technologies. The display of the computer device may be a liquid crystal display or an electronic ink display. The input device may be a touchscreen overlay on the display, buttons, a trackball, or a touchpad on the computer device housing, or an external keyboard, touchpad, or mouse.

[0104] This embodiment also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements a spectrum and molecular structure comparison and matching system based on machine learning as proposed in the above embodiment.

[0105] In summary, this paper constructs a multimodal deep learning model to automatically extract deep semantic features of spectra and structures, significantly improving the accuracy and robustness of spectral analysis and molecular structure matching. A shared embedding space learning strategy is adopted to project different modalities into the same feature space, achieving unified matching and similarity scoring. The introduction of an attention mechanism enables a visual mapping between spectral peaks and molecular structure fragments, which helps to understand the chemical groups or atoms corresponding to each spectral peak and enhances the interpretability of the matching results.

[0106] Example 2

[0107] This embodiment is the second embodiment of the present invention. This embodiment provides a spectrum and molecular structure comparison and matching system based on machine learning. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation experiments.

[0108] Specifically, step 1: collect 4000 molecular structure samples with matching spectra; each sample contains: original infrared spectrum (IR) → interpolated into a 1024-dimensional vector; corresponding molecular structure (SMILES) → converted to graph G=(V,E); divide the data set into: training set: 2800; validation set: 600; test set: 600.

[0109] Step 2: Model architecture design, spectrogram encoder: Input: 1024-dimensional spectral vector; Network structure: Conv1D(64)→ ReLU→ MaxPool→ Conv1D(128)→ FC(128); Structure encoder: Input: molecular graph G; Network structure: GCN(128)×3 layers; Aggregation method: node mean pooling to generate structure vector z G ∈R 128 .

[0110] Step 3: Model training process, training parameters: Optimizer: Adam, initial learning rate 1e-4;

[0111] Batch Size: 64, Epoch Number: 50; After each round of training, the accuracy is evaluated on the validation set. Training sample generation method: Construct a triple (S, G + , G - ), where G + For correct matching, G - is a random sampling error structure.

[0112] Step 4: Model testing and evaluation: Input spectrum S into the test set and calculate the matching scores with 1000 candidate molecular structures. Sorted by matching scores, the top-1 and top-5 prediction results are output. Evaluation metrics include: Top-1 accuracy; Top-5 recall; mean average precision (mAP); and attention visualization accuracy.

[0113] Experimental results:

[0114] Table 4: Comparison of accuracy, average precision and interpretability of different matching methods

[0115]

[0116] Visualization of the results, performing structural matching on a target spectrum (from the test set): Top-1 matching molecular structure: C9H8O4; Output matching score: 0.983; Attention mechanism highlights the spectral peak at 1740 cm -1 Mapped to carboxylic acid groups (COOH); peak at 1610 cm -1 Mapped to the carbon atoms of the benzene ring; expert manual verification of the explanation rationality score: 9.4 / 10.

[0117] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A spectrum and molecular structure comparison and matching system based on machine learning, characterized in that: include: The model building module is used to construct a matching model between the spectrum vector and the molecular structure vector. The matching model is based on a multimodal deep learning architecture, integrating convolutional neural networks to extract spectral pattern features and graph neural networks to extract molecular structure features. The original spectral signal is normalized into a fixed-length vector form to construct the spectrum vector: ; Among them, S is the spectrum vector, s i is the light intensity value of the i-th sampling point, L is the number of spectrum sampling points, is the real number space; The candidate molecular structure is represented as a graph. A one-dimensional convolutional neural network is used to extract the local pattern features of the spectrum. Multiple rounds of message propagation are performed on the molecular graph through the graph neural network. Two fully connected networks are used to map the two features to an embedding space of the same dimension. A shared embedding space learning strategy is used to train the correlation scoring function between the spectrum and the molecular structure. The molecular graph is input into the graph neural network. The updated nodes in each round of propagation are represented as follows: ; in, is the set of neighbor nodes of node v, l is the number of current GNN layers, is the feature representation of node u in layer l, is the updated feature representation of node v at layer l+1, AGG is the aggregation function, is the learnable weight parameter of the lth layer, is a nonlinear activation function; Finally, all nodes are aggregated to obtain structural embedding. Through the embedding space of shared dimensions, the embedding distance between matching pairs is minimized, and a similarity scoring function is constructed. The cosine similarity scoring expression is as follows: ; Among them, S is a known spectrum data, G is the structure diagram of a candidate molecule, is the embedding vector obtained by the CNN encoder of the spectral sample S, is the embedding vector obtained after the molecular graph G passes through the GNN encoder; A training optimization module is used to use known structure-spectrum paired samples as training data and adopt contrastive learning or triplet loss function for training; The candidate calculation module is used to calculate the matching scores of all candidate molecules in the database based on the input target spectrum through the matching model, calculate the similarity scores of all candidate molecular structure vectors with the target spectrum vector, and sort all candidate structures according to the scores: ; Take the top-K high-scoring candidate molecules as the recognition results, and output the matching candidate molecule list, Corresponding matching scores and rankings; sort candidate molecules according to the matching scores and output the top-N candidate structures related to the target spectrum; The interpretation and visualization module is used to map the intermediate attention weights back to the spectral peak positions and atoms or groups in the structure, realizing the aligned interpretation of the spectrum and the molecular structure. A cross-attention layer is inserted between the spectrum embedding encoder and the structure encoder. For each spectral peak vector, the attention weight between it and each structural node is calculated: ; in, is the attention weight between the i-th spectral peak and the j-th structural node, is the embedding vector of the i-th spectral peak position, is the embedding vector of the node in the j-th molecular structure, M is the total number of nodes in the molecular structure, is the embedding vector of the kth node in the molecular structure; For each spectral peak, the structural node index corresponding to the maximum attention value is used; if multiple groups are interpreted in combination, the α ij Perform threshold screening and select α ij All j >δ are taken as the associated atom set; the Top-N candidate structures are further confirmed by combining experimental mass spectrometry and NMR data.

2. The spectrum and molecular structure comparison and matching system based on machine learning according to claim 1, characterized in that: The method uses known structure-spectrum paired samples as training data and adopts contrastive learning or triplet loss function for training, including: Construct triple samples as spectrogram, correct structure and wrong structure, construct paired samples including matching as 1 and non-matching as 0; calculate the loss function and backpropagate to update the parameters, where the triple loss function expression is as follows: ; Among them, α is the margin hyperparameter, is the molecular structure G that correctly matches the spectrum S + The structure embedding vector obtained after GNN encoding, is the molecular structure G that is incorrectly paired with the spectrum S - The embedding vector obtained after GNN encoding; Then backpropagation and gradient descent optimization algorithms are performed to update the parameters.

3. The machine learning-based spectrum and molecular structure comparison and matching system according to claim 1, wherein: The candidate molecules are sorted according to the matching scores, and the top-N candidate structures related to the target spectrum are output, including: A matching score threshold τ is set, and all candidate molecules are screened. Candidate molecules with scores below the threshold are eliminated. The screened candidate set is sorted in descending order by matching score. Based on the parameter N set by the user or the system, the top N candidate molecules with the highest scores are dynamically selected. For the top-N candidate structures, a candidate structure list containing matching scores and comprehensive information is output.

4. The machine learning-based spectrum and molecular structure comparison and matching system according to claim 1, wherein: The Top-N candidate structures are further confirmed by combining experimental mass spectrometry and NMR data, including: For mass spectrum matching, the normalized mass spectrum cosine similarity evaluation is used. For NMR matching, the matching score is constructed based on the sum of squared displacement differences, and the weight coefficient λ is set. MS ,λ NMR ,λ ML The comprehensive scoring formula is as follows: ; Among them, score ML (G i ) is the original score of the machine learning matching model; According to TotalScore(G i ) Re-rank the Top-N candidate structures. If the mass spectrum and NMR matching degree of a candidate structure are higher than those of other candidate structures, and its machine learning model score is also high, then the structure is confirmed as the final result; if multiple candidate structures have the same score, further confirmation is supplemented by experimental verification.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the spectrum and molecular structure comparison and matching system based on machine learning are implemented as described in any one of claims 1 to 4.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the spectrum and molecular structure comparison and matching system based on machine learning according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Method for improving drug-target activity prediction precision by combining machine learning and conformation calculation

    CN114708931A

  • Raman spectrum algorithm based on multi-channel one-dimensional convolutional neural network and spatial pyramid pooling technology

    CN120124683A