Mass spectrum library intelligent expansion method based on semi-supervised closed-loop learning
Patent Information
- Application Number
- CN202511533776.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-25
- Publication Date
- 2026-10-20
AI Technical Summary
该过程不仅要求实际操作人员掌握碎片离子关联解析等专业知识,且耗时长,难以满足现场核查的时效性要求
[0062]本发明设计了智能解谱闭环学习网络结构,由质谱模拟子网络和结构解析子网络两部分组成。设计联合训练损失函数,利用预训练的分子结构编码器和质谱预测解码器,建立质谱预测网络。设计模型微调损失函数,微调质谱模拟网络。本发明在闭环预训练的基础上,仅用目标数据库的少量数据进行微调,从而提高质谱模拟网络在目标数据库上的质谱预测表现。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention belongs to the field of mass spectrometry analysis, specifically relating to a method for intelligent expansion of mass spectrometry libraries based on semi-supervised closed-loop learning. Background Technology
[0003] Gas chromatography-electron impact ionization mass spectrometry (GC-EI-MS) is considered the gold standard for substance identification. Its commercial software enables efficient identification of known compounds through automated database searching and comparison with standard compound spectra. This method significantly lowers the operational barrier; experimenters do not need extensive experience in mass spectrometry analysis. By using standardized instrument operation and data processing software, highly reliable compound identification results can be obtained.
[0004] However, for compounds not included in standard mass spectrometry libraries, simple spectral searches can only provide limited reference information, often requiring expert interpretation for final identification. Interpretive experts analyze fragmented spectral information to infer possible molecular structures, which are then cross-validated with those in standard databases to confirm the structure. For the analysis of newly discovered unknown compounds, synthesis and chemical reaction methods are often used to aid in the inference and verification. This process not only requires operators to possess expertise in fragment ion correlation analysis but is also time-consuming, making it difficult to meet the timeliness requirements of on-site verification.
[0005] Traditional mass spectrometry analysis relies on human experience and matching with a limited spectral library. Its limitations are mainly reflected in: ① Insufficient spectral library coverage: The existing NIST library contains less than 1,000 CWC-related compounds and their derivatives; ② Low analysis efficiency: The identification of unknown compounds is time-consuming and depends on expert experience.
[0006] The paradigm shift brought about by deep learning methods in mass spectrometry analysis is attracting sustained attention from the academic community. Its technological evolution can be summarized into two main paradigms: one is mass spectrometry simulation and library expansion, which involves constructing molecular structure-mass spectra to predict the mass spectra of compounds; the other is direct structure analysis, which involves inferring molecular structures from mass spectrometry data. The former is a direct problem, easier to solve; the latter is an inverse problem, more challenging.
[0007] Intelligent mass spectrometry analysis faces challenges such as strong dependence on training data, limited model generalization ability, and insufficient adaptability to rare or novel CWC derivatives. Given the continuously expanding scope of CWC regulation and the emergence of new derivatives, relying on traditional experimental methods to establish a standard spectral database one by one is costly and time-consuming, while manual spectral analysis is limited by expert experience and subjective bias.
[0008] Therefore, there is an urgent need to develop a new intelligent and scalable mass spectrometry analysis method to overcome the bottlenecks of existing technologies in terms of spectral library coverage and resolution efficiency, and to achieve rapid, accurate, and automated identification of CWC-related compounds and their derivatives, providing strong technical support for international compliance and national security. Summary of the Invention
[0009] The purpose of this invention is to provide a mass spectrometry library intelligent expansion technology based on semi-supervised closed-loop learning, providing technical support for chemical weapons verification.
[0010] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0011] A method for intelligent expansion of mass spectrometry libraries based on semi-supervised closed-loop learning includes the following steps:
[0012] S1 generates a list of chemical structural formulas from the CWC Appendix Chemical Structural Formulas:
[0013] Select a general structural formula; based on the undetermined functional groups in the general formula, set the selection range of the undetermined functional groups, and exhaustively list them within the range to form a set of molecular structures;
[0014] Morgan molecular fingerprints were generated based on the molecular structure set, resulting in an unlabeled molecular structure dataset.
[0015] S2: Use the chemical structural formula involved in step S1 as input to a semi-supervised closed-loop network and predict its mass spectrometry spectrum; the specific steps are as follows:
[0016] (1) Training dataset establishment: Collect molecular structure-mass spectrum sample pairs from existing data, generate corresponding Morgan molecular fingerprints, and establish a labeled molecular structure-mass spectrum dataset;
[0017] The intersection of the labeled molecular structure-mass spectrometry dataset and the unlabeled molecular structure dataset obtained in step S1 is used to obtain dataset 2. The dataset is then divided into three parts: the non-dataset 2 part of the labeled molecular structure-mass spectrometry dataset, which is dataset 1; and the non-dataset 2 part of the unlabeled molecular structure dataset, which is dataset 3.
[0018] Datasets 1 and 3 are relatively large, containing both supervised and unsupervised data, and are used as semi-supervised closed-loop training datasets for the model; Dataset 2 is relatively small and is used as a fine-tuning dataset for the model.
[0019] (2) Closed-loop learning network structure design: A closed-loop network architecture is adopted, including a mass spectrometry simulation subnetwork and a structure analysis subnetwork; the closed-loop network can be trained not only using labeled datasets for supervised training, but also using unlabeled datasets;
[0020] When a molecular structure is input, the mass spectrometry simulation subnetwork converts the molecular structure into a mass spectrometry vector. The mass spectrometry vector is then converted back into a molecular fingerprint by the structure analysis subnetwork. By comparing the input molecular fingerprint with the generated molecular fingerprint, the network is trained in an unsupervised closed-loop manner.
[0021] Both the mass spectrometry simulation subnetwork and the structure analysis subnetwork adopt an encoder-decoder architecture, and all layers use linear layers;
[0022] The mass spectrometry simulation subnetwork consists of two parts: a molecular structure encoder and a mass spectrometry prediction decoder. The molecular structure encoder represents the molecular fingerprint as a continuous vector, i.e., the molecular structure representation space.
[0023] The mass spectrometry prediction decoder reconstructs the continuous vector generated by the molecular structure encoder into a discretized mass spectrum. Considering that the forward sequence of the mass spectrum contains key information, including molecular ion peaks and base peaks, and that its m / z value represents the molecular mass of the corresponding structural fragment, while the reverse sequence of the mass spectrum contains similar fragmentation patterns between different molecules, the mass spectrometry prediction head predicts the mass spectrum from both forward and reverse directions. Let the molecular structure representation space be x, and the result s(x) of the mass spectrometry prediction is expressed as:
[0024]
[0025] in , , These represent forward prediction mass spectrometry, reverse prediction mass spectrometry, and the output control gate, respectively; the final output mass spectrum is a weighted sum of the forward and reverse predictions.
[0026] The structure resolution subnetwork includes a mass spectrometry resolution encoder and a molecular structure decoder, which converts molecular fingerprints into mass spectra.
[0027] The mass spectrometry decoding encoder converts the discretized mass spectrum into a continuous vector, i.e., the mass spectrum representation space; the molecular structure decoding takes the continuous vector generated by the mass spectrometry decoding encoder as input and outputs a molecular fingerprint vector.
[0028] (3) Model pre-training: Model pre-training is carried out on the basis of closed-loop network architecture, and a joint training loss function is designed to achieve alignment between molecular structure representation space and mass spectrometry representation space;
[0029] The loss function in the closed-loop pre-training stage consists of three parts: the loss function of the two sub-networks, the feature alignment loss function, and the closed-loop consistency loss function.
[0030] The loss function of the mass spectrometry simulation subnetwork uses a weighted cosine similarity loss function to compare the differences between the predicted mass spectrum and the standard spectrum:
[0031]
[0032] in Indicates the parameters of the mass spectrometry simulation network. This represents a mass spectrometry simulation network. and These represent supervised molecular fingerprint and mass spectrometry sample pairs, respectively.
[0033] The loss function of the structural analysis subnetwork uses JS divergence to measure the difference in distribution between the predicted molecular fingerprint and the true molecular fingerprint:
[0034]
[0035] in Represents the structural analysis network parameters. Represents the structure of the parsing network;
[0036] The closed-loop consistency loss of supervised dataset 1 is expressed as:
[0037]
[0038] The closed-loop consistency loss of dataset 3 for unsupervised data is expressed as:
[0039]
[0040] in Molecular fingerprints for unsupervised data (dataset 3); The spectrogram predicted by the intelligent spectrum simulation network for unsupervised data (dataset 3); This refers to the molecular fingerprint reconstructed by the structural analysis network; the difference between the reconstructed molecular fingerprint and the real molecular fingerprint is compared by JS divergence.
[0041] The feature alignment loss function uses the infoNCE loss, which learns an effective joint feature representation space by distinguishing between positive and negative samples:
[0042]
[0043] in The feature vector representing the query sample; The feature vector representing a positive sample represents a different perspective from the query sample, indicating that the sample belongs to the same category or the same entity. Represents the feature vector of any sample; It represents the temperature coefficient and controls the sharpness of the distribution; This represents the total number of samples. The InfoNCE loss can be viewed as a k-class classification task, with the goal of correctly classifying samples into the categories corresponding to positive samples, thereby achieving feature alignment and obtaining the joint representation space of molecular structure and mass spectrometry.
[0044] The final loss function is expressed as:
[0045]
[0046] (4) Model fine-tuning: In the model fine-tuning stage, only a small dataset 2 is used to conduct supervised training on the mass spectrometry simulation network. The goal is to ensure that the predicted mass spectra and the real mass spectra are as consistent as possible. Cosine similarity loss is not sensitive to small values, which can easily lead to a lot of noise in the predicted spectrum. Therefore, JS divergence is further selected to measure the distribution difference between the predicted mass spectra and the real spectrum. For the distribution, JS divergence is also relatively sensitive to small values, so it can effectively avoid the problem of too much noise when using only cosine similarity. The proposed fine-tuning loss is expressed as:
[0047]
[0048] in This represents the parameters of the mass spectrometry simulation network after model pre-training in step 3).
[0049] When the loss function in steps (3) and (4) reaches the set value, the model training is considered complete.
[0050] Preferably, the hidden layer feature dimension of both the mass spectrometry simulation subnetwork and the structure analysis subnetwork is 2000.
[0051] Preferably, the mass spectrometry prediction head consists of three linear layers, and the hidden layer feature dimension of each linear layer is 2000.
[0052] Preferably, the molecular structure encoder consists of nine linear layers, each containing a dropout layer to reduce the effects of overfitting.
[0053] Preferably, the mass spectrometry parsing encoding consists of nine consecutive linear layers, each containing a dropout layer to reduce the impact of overfitting.
[0054] Preferably, the mass spectrometry analytical encoder adopts a residual connection design, which helps to alleviate the gradient vanishing problem in deep networks.
[0055] Preferably, after the model is fine-tuned, the model is tested: the unlabeled target dataset 2 is input into the mass spectrometry simulation subnetwork to obtain the corresponding predicted spectrum and verify the effectiveness of the model.
[0056] Preferably, in the establishment of the training dataset in steps S1 and S2, the rdkit library is used to generate a Morgan molecular fingerprint with a length of 4096.
[0057] Preferably, after step S2, a spectral library file containing compound information is generated according to the import file format requirements and imported into an existing mass spectrometry library.
[0058] Furthermore, using the rdkit library, essential information, including molecular mass, molecular formula, SMILES, and InChiKey, is extracted from the molecular structure and written as an SDF file, which is then imported into the NIST spectral library to achieve mass spectrometry library expansion.
[0059] Preferably, in step S1, a list of structural formulas is generated based on the substitution of other chemical structural formulas for chemicals in the CWC appendix, thereby expanding the other chemical quality spectral library.
[0060] Secondly, the present invention provides a method for predicting the mass spectrum of an unknown compound, wherein an unknown compound having a general formula structure is input into a trained model described in the first aspect, and the mass spectrum of the unknown compound is output.
[0061] The beneficial effects achieved by this invention are as follows:
[0062] This invention designs an intelligent closed-loop learning network structure for spectral interpretation, consisting of a mass spectrometry simulation subnetwork and a structure analysis subnetwork. A joint training loss function is designed, and a mass spectrometry prediction network is established using a pre-trained molecular structure encoder and a mass spectrometry prediction decoder. A model fine-tuning loss function is designed to fine-tune the mass spectrometry simulation network. Based on closed-loop pre-training, this invention uses only a small amount of data from the target database for fine-tuning, thereby improving the mass spectrometry prediction performance of the mass spectrometry simulation network on the target database. Attached Figure Description
[0063] Figure 1 This is a flowchart of the method described in this invention;
[0064] Figure 2 For the dataset partitioning described in this invention
[0065] Figure 3 This is a comparison between the predicted spectrum and the actual spectrum of Embodiment 1 of the present invention. Detailed Implementation
[0066] Example 1
[0067] Combination Figures 1-2 This paper elaborates in more detail on a method for intelligent expansion of mass spectrometry libraries based on semi-supervised closed-loop learning:
[0068] Step 1: Generate a list of chemical structures from the CWC Appendix Tables based on the general structural formulas of chemicals in the CWC Appendix Tables.
[0069] by Figure 1 Taking the general formula shown on the left—alkyl (methyl, ethyl, n-propyl or isopropyl) fluorophosphonic alkyl (carbon chain with less than or equal to 10 carbon atoms, including cycloalkanes) esters—as an example, step 1 is described in detail.
[0070] In the diagram, positions 1 and 2 of the general formula represent undetermined functional groups. Position 1 can be methyl, ethyl, n-propyl, or isopropyl, totaling four types. Position 2 can be a carbon chain with 10 or fewer carbon atoms, including cycloalkanes. Limitations are imposed on position 2 based on the following conditions: 1) unsaturation degree is 0 or 1, i.e., the general formula is CnH2n or CnH2n+2, n=1,2,3,…,10; 2) it does not contain 3-membered or 4-membered rings. After exhaustive searching, a total of 1000 types are identified. The CnH2n (or CnH2n+2) carbon chain at position 2 may have n possible linkages with the P atom, but includes many repeating molecular structures. Finally, using the rdkit library, the generated molecular structures are converted to InChiKey form, and repeating molecular structures are removed, resulting in 27292 molecular structural formulas. Using the rdkit library, a Morgan molecular fingerprint of length 4096 is generated. Step 1 is completed, obtaining the molecular fingerprint of the target chemical, which serves as the input for step 2. Figure 2 The molecular structure shown is an unlabeled dataset.
[0071] Step 2: Use the chemical structure of the chemical involved in step (1) as input to a semi-supervised closed-loop network and predict its mass spectrometry spectrum.
[0072] Step (2) includes steps such as establishing the training dataset, designing the closed-loop learning network structure, model pre-training, model fine-tuning, and model testing.
[0073] 1) Training Dataset Establishment: Collect molecular structure-mass spectrometry sample pairs from existing data. Using the rdkit library, generate a Morgan molecular fingerprint of length 4096, thus completing the training dataset setup. Figure 2 A labeled molecular structure-mass spectrometry dataset was established. The intersection of this dataset and the exhaustively obtained unlabeled molecular structure dataset from step 1 was taken, dividing the dataset into three parts: the labeled molecular structure-mass spectrometry dataset was divided into two parts—the part unrelated to the target chemical (dataset 1) and the part related to the target chemical (dataset 2), and the unlabeled molecular structure dataset (dataset 3). Datasets 1 and 3 are larger in scale, containing both supervised and unsupervised data, and are used as semi-supervised closed-loop training datasets for the model. Dataset 2 is smaller in scale and is used as the model fine-tuning dataset.
[0074] 2) Closed-loop learning network architecture design: This step adopts a closed-loop network architecture, consisting of a mass spectrometry simulation subnetwork ( Figure 1 (above) and structural parsing subnetwork ( Figure 1 The proposed closed-loop network consists of two parts (below). It can be trained in a supervised manner using labeled datasets, as well as on unlabeled datasets. For example, when a molecular structure is input, the mass spectrometry simulation sub-network converts the molecular structure into a mass spectrometry vector. This mass spectrometry vector can then be converted back into a molecular fingerprint via the structure analysis sub-network. By comparing the input molecular fingerprint with the generated molecular fingerprint, unsupervised closed-loop training can be performed on the network. Therefore, the proposed closed-loop network can utilize unlabeled molecular structure datasets (dataset 3), thereby improving the network's performance on target compounds.
[0075] Both sub-networks employ an encoder-decoder architecture, with all layers using linear layers and hidden layers having a feature dimension of 2000. The mass spectrometry simulation sub-network consists of a molecular structure encoder and a mass spectrometry prediction decoder. The molecular structure encoder represents a 4096-bit molecular fingerprint as a continuous vector (molecular structure representation space). The molecular structure encoder consists of 9 linear layers, each containing a dropout layer to reduce overfitting. The mass spectrometry prediction decoder reconstructs the continuous vector generated by the molecular structure encoder into a discretized mass spectrum. Considering that the forward order of the mass spectrum contains key information such as molecular ion peaks and base peaks, and its m / z value represents the molecular mass of the corresponding structural fragment, while the reverse order of the mass spectrum contains similar fragmentation patterns between different molecules, the proposed mass spectrometry prediction head predicts the mass spectrum from both forward and reverse directions. Let the molecular structure representation space be x, and the result of the mass spectrometry prediction can be expressed as...
[0076]
[0077] in , , These represent the forward prediction mass spectrometry, the backward prediction mass spectrometry, and the output control gate, respectively. The final output mass spectrum is a weighted sum of the forward and backward predictions. Therefore, the mass spectrometry prediction head consists of three linear layers, each with 2000 neurons.
[0078] The structure resolution subnetwork consists of a mass spectrometry resolution encoder and a molecular structure decoder. Its molecular fingerprint is converted into a mass spectrum. The mass spectrometry resolution encoder converts the discretized mass spectrum of length 1000 into a continuous vector, i.e., the mass spectrometry representation space. The mass spectrometry resolution encoder consists of nine consecutive linear layers, each containing a dropout layer to reduce the impact of overfitting. The molecular structure decoder takes the "mass spectrometry representation space" generated by the mass spectrometry resolution encoder as input and outputs a molecular fingerprint vector of length 4096. This module employs a residual connection design, which helps alleviate the gradient vanishing problem in deep networks.
[0079] 3) Model Pre-training: Model pre-training is conducted based on the closed-loop network architecture. A joint training loss function is designed to align the molecular structure representation space with the mass spectrometry representation space. The loss function in the closed-loop pre-training stage mainly consists of three parts: the loss functions of the two sub-networks, the feature alignment loss function, and the closed-loop consistency loss function. The loss function of the mass spectrometry simulation sub-network adopts a weighted cosine similarity loss function to compare the differences between the predicted mass spectra and the standard spectra.
[0080]
[0081] in Indicates the parameters of the mass spectrometry simulation network. This represents a mass spectrometry simulation network. and The loss function of the structure resolution subnetwork, represented by JS divergence, measures the difference in distribution between predicted and true molecular fingerprints, for molecular fingerprints and mass spectrometry samples from the NIST database, respectively.
[0082]
[0083] in Represents the structural analysis network parameters. The structure is represented by a parsing network. The closed-loop consistency loss for supervised data (dataset 1) can be expressed as:
[0084]
[0085] The closed-loop consistency loss for unsupervised data (dataset 3) can be expressed as:
[0086]
[0087] The feature alignment loss function uses the infoNCE loss, which learns an effective joint feature representation space by distinguishing between positive and negative samples:
[0088]
[0089] The final loss function can be expressed as:
[0090]
[0091] 4) Model Fine-tuning: In the model fine-tuning stage, only a small dataset (2) is used for supervised training of the mass spectrometry simulation network, with the goal of ensuring that the predicted mass spectra are as consistent as possible with the actual mass spectra. Cosine similarity loss is insensitive to small values, which can easily lead to many noisy points in the predicted spectra. Therefore, we further select JS divergence to measure the distribution difference between the predicted and actual mass spectra. JS divergence is also relatively sensitive to small values for the distribution, thus effectively avoiding the problem of excessive noise when using only cosine similarity. Therefore, the proposed fine-tuning loss can be expressed as:
[0092]
[0093] This invention improves the mass spectrometry prediction performance of the mass spectrometry simulation network on the target database by fine-tuning it using only a small amount of data from the target database, based on closed-loop pre-training.
[0094] 5) Model testing: Input the unlabeled target dataset (dataset 2) into the mass spectrometry simulation subnetwork to obtain the corresponding predicted spectrum, thus realizing the intelligent expansion of the target compound molecular structure.
[0095] Upon inspection, such as Figure 3 As shown, the method proposed in this invention has a high degree of agreement between the predicted spectrum and the actual spectrum.
[0096] Finally, following the import file format requirements of different manufacturers, a spectral library file containing the above compound information is generated and imported into an existing mass spectrometry library. Using the final weight file from step 2, the target compound's SMILE file list is tested to predict its mass spectrum, and a final SDF file is generated. For any molecular structure, information such as molecular mass, molecular formula, mass spectrum, SMILES, and InChiKey is included. The target compound's SDF file is then converted into a database searchable by NIST software, thus expanding the target compound's spectral library.
Claims
1. A method for intelligent expansion of mass spectrometry spectral library based on semi-supervised closed-loop learning, characterized in that, Includes the following steps: S1 generates a list of chemical structural formulas from the CWC Appendix Chemical Structural Formulas: Select a general structural formula; based on the undetermined functional groups in the general formula, set the selection range of the undetermined functional groups, and exhaustively list them within the range to form a set of molecular structures; Morgan molecular fingerprints were generated based on the molecular structure set, resulting in an unlabeled molecular structure dataset. S2: Use the chemical structural formula involved in step S1 as input to a semi-supervised closed-loop network and predict its mass spectrometry spectrum; the specific steps are as follows: (1) Training dataset establishment: Collect molecular structure-mass spectrum sample pairs from existing data, generate corresponding Morgan molecular fingerprints, and establish a labeled molecular structure-mass spectrum dataset; The intersection of the labeled molecular structure-mass spectrometry dataset and the unlabeled molecular structure dataset obtained in step S1 is used to obtain dataset 2. The dataset is divided into three parts: part 1 is the non-dataset 2 of the labeled molecular structure-mass spectrometry dataset; and part 3 is the non-dataset 2 of the unlabeled molecular structure dataset. Dataset 1 and Dataset 3 are used as semi-supervised closed-loop training datasets for the model. (2) Closed-loop learning network structure design: A closed-loop network architecture is adopted, including a mass spectrometry simulation subnetwork and a structure analysis subnetwork; Both the mass spectrometry simulation subnetwork and the structure analysis subnetwork adopt an encoder-decoder architecture, and all layers use linear layers; The mass spectrometry simulation subnetwork consists of two parts: a molecular structure encoder and a mass spectrometry prediction decoder. The molecular structure encoder represents the molecular fingerprint as a continuous vector, i.e., the molecular structure representation space. The mass spectrometry prediction decoder reconstructs the continuous vector generated by the molecular structure encoder into a discretized mass spectrum; the mass spectrometry prediction head predicts the mass spectrum from both forward and reverse directions. Let the molecular structure representation space be x, and the result of the mass spectrometry prediction s(x) is expressed as: wherein , , respectively represent a forward prediction mass spectrum, a backward prediction mass spectrum, and an output control gate; The structure resolution subnetwork includes a mass spectrometry resolution encoder and a molecular structure decoder, which converts molecular fingerprints into mass spectra. The mass spectrometry decoding encoder converts the discretized mass spectrum into a continuous vector, i.e., the mass spectrum representation space; the molecular structure decoding takes the continuous vector generated by the mass spectrometry decoding encoder as input and outputs a molecular fingerprint vector. (3) Model pre-training: Model pre-training is carried out on the basis of closed-loop network architecture, and a joint training loss function is designed to achieve alignment between molecular structure representation space and mass spectrometry representation space; The loss function in the closed-loop pre-training stage consists of three parts: the loss functions of the two sub-networks, the feature alignment loss function, and the closed-loop consistency loss function. The loss function of the mass spectrometry simulation sub-network uses a weighted cosine similarity loss function to compare the differences between the predicted mass spectrum and the standard spectrum. wherein denotes the mass spectrometry simulation network parameters, denotes the mass spectrometry simulation network, and denotes the supervised data molecular fingerprints and mass spectrometry sample pairs, respectively; The loss function of the structural analysis subnetwork uses JS divergence to measure the difference in distribution between the predicted molecular fingerprint and the true molecular fingerprint: wherein represents a structural analysis network parameter, represents a structural analysis network; The closed-loop consistency loss of supervised dataset 1 is expressed as: The closed-loop consistency loss of dataset 3 for unsupervised data is expressed as: wherein is the molecular fingerprint of the unsupervised data dataset 3; is the spectrum predicted by the intelligence spectrum simulation network for the unsupervised data dataset 3; is the molecular fingerprint reconstructed by the structure resolution network; The feature alignment loss function uses the infoNCE loss, which learns an effective joint feature representation space by distinguishing between positive and negative samples: wherein denotes the feature vector of a query, from dataset 2; denotes the feature vector of a positive sample, different view of the same class or the same entity as the query sample; denotes the feature vector of a random sample; denotes the temperature coefficient, controlling the sharpness of the distribution; denotes the number of all samples; The final loss function is expressed as: When the loss function in step (3) reaches a set value, it is determined that the model training is complete; a mass spectrum library is obtained.
2. The method of claim 1, wherein the method is based on semi-supervised closed-loop learning. After step (3), step (4) model fine-tuning is performed: the mass spectrum simulation network is supervised trained by using a subset of the data set 2 in the model fine-tuning stage, and the fine-tuning loss is represented as: When the fine-tuning loss value reaches a set value, the training is completed.
3. The method of claim 1, wherein the method is based on semi-supervised closed-loop learning. The hidden layer feature dimensions of the mass spectrum simulation subnetwork and the structure analysis subnetwork are both 2000; the mass spectrum prediction head is composed of three linear layers, and the hidden layer feature dimensions of each linear layer are all 2000.
4. The method of claim 1, wherein the method is based on semi-supervised closed-loop learning. The molecular structure encoder is composed of 9 linear layers, each layer containing a dropout layer to reduce the influence of overfitting; the mass spectrum analysis code is composed of 9 consecutive linear layers, each layer containing a dropout layer to reduce the influence of overfitting.
5. The method of claim 1, wherein the method is based on semi-supervised closed-loop learning. The mass spectrum analysis encoder adopts a residual connection design.
6. The method of claim 2, wherein the method is based on semi-supervised closed-loop learning. After the model fine-tuning, the model test is performed: the data set 2 of the unlabeled target data set is input into the mass spectrum simulation subnetwork to obtain the corresponding predicted spectrum, and the effectiveness of the model is verified.
7. The method of claim 1, wherein the method is based on semi-supervised closed-loop learning. In the training data set establishment of steps S1 and S2, the rdkit library is used to generate Morgan molecular fingerprints with a length of 4096.
8. The method of claim 1, wherein the method is based on semi-supervised closed-loop learning. After step S2, a spectrum library file containing compound information is generated according to the import file format requirements, and is imported into an existing mass spectrum library.
9. The method of claim 1-8, wherein, In step S1, a structure formula list is generated based on other chemical structure general formula instead of CWC appendix chemical to expand other chemical mass spectrum library.
10. A method of predicting the mass spectrum of an unknown compound, characterized by, An unknown compound with a general structure is input into the trained model in any one of claims 1-9, and the mass spectrum of the unknown compound is output.