A molecular odor prediction method based on cross-modal attention fusion
By employing a cross-modal attention fusion method, which comprehensively utilizes molecular properties, fingerprints, and SMILES sequence features, the limitations of single-modal features in existing technologies are overcome, resulting in more accurate molecular odor prediction and improved model discrimination and generalization performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV
- Filing Date
- 2026-02-05
- Publication Date
- 2026-05-29
Smart Images

Figure CN122117152A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of cheminformatics and deep learning, and more specifically to a molecular odor prediction method based on cross-modal attention fusion. Background Technology
[0002] Molecular odor prediction is one of the core tasks in the field of computational olfaction, aiming to establish a quantitative relationship between chemical molecular structure and human olfactory perception. It has important application value in perfume design, food flavor optimization, environmental odor monitoring and neuroscience research.
[0003] Currently, machine learning-based molecular odor prediction methods mainly rely on modeling using single-type features extracted from molecular structures. Common features include numerical vectors based on physical descriptors, molecular fingerprints based on substructure statistics, or sequence representations based on strings. However, olfactory perception itself is the result of the combined effects of multiple molecular properties. Features of a single modality are insufficient to fully characterize this complex structure-activity relationship. Using only molecular fingerprints may lose accurate physical parameter information, while relying solely on physical descriptors cannot fully express the fine two-dimensional topological structure. This limitation of representation dimension restricts the model's complete capture of the underlying mechanisms of molecular odor.
[0004] When attempting to fuse multiple features, existing methods often employ simple feature splicing or early fusion strategies based on fully connected layers. These methods treat features from different modalities as independent and equal inputs, failing to explicitly model and utilize the complex interactions and dependencies between information from different modalities. For example, the one-dimensional sequence order of a molecule and its three-dimensional spatial polarity may jointly influence a certain odor property in a nonlinear manner. Simple splicing operations cannot enable the model to autonomously learn such cross-modal synergistic or inhibitory effects, resulting in coarse information fusion and an inability to form a joint representation with high discriminative power.
[0005] Furthermore, most models only optimize a single classification or regression loss during training, ignoring the inherent chemical similarity constraints of molecular data and the semantic associations between labels. In practice, molecules with similar structures or properties often have similar odor characteristics, and there are also co-occurrence or mutual exclusion patterns among certain odor labels. Existing training objectives usually do not introduce this kind of valuable domain knowledge as an explicit constraint into the learning process, which may cause the model to learn mapping relationships that violate chemical intuition, thereby affecting its generalization ability and the rationality of prediction results.
[0006] Therefore, how to design a molecular odor prediction method based on cross-modal attention fusion that can deeply integrate multi-dimensional molecular information and explicitly model complex relationships between modalities to achieve more accurate and reliable molecular odor prediction is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention provides a molecular odor prediction method based on cross-modal attention fusion, which aims to overcome the problems of limited single-modal representation ability, simple inter-modal fusion method and insufficient exploration of the complex relationship between molecular structure and label in existing methods. By realizing the effective fusion of features through cross-modal attention mechanism, the model’s ability to distinguish odor categories and its generalization performance are improved, and finally more accurate and more in line with the laws of olfactory perception is achieved in automatic molecular odor prediction.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A molecular odor prediction method based on cross-modal attention fusion includes the following steps: S1. Obtain the molecular dataset and extract basic molecular property features, molecular fingerprint features, and SMILES sequence features in parallel for each molecule; S2. A molecular odor prediction model is trained using the aforementioned basic molecular property features, molecular fingerprint features, and SMILES sequence features; the molecular odor prediction model includes a modal encoder, a cross-modal attention fusion module, and a classification head connected in sequence; S3. For the molecule to be predicted, input its corresponding basic molecular property features, molecular fingerprint features and SMILES sequence features into the trained molecular odor prediction model to obtain the prediction probability of the corresponding odor category. S4. Based on the predicted probability, determine the odor category prediction result of the molecule to be predicted.
[0010] Preferably, in step S1, extracting basic molecular property features, molecular fingerprint features, and SMILES sequence features includes: Parse the SMILES string of the molecule and generate a molecule object; Based on the molecular object, basic molecular property features are extracted, including molecular weight, LogP, topological polar surface area, number of rotatable bonds, number of hydrogen bond donors, number of hydrogen bond acceptors, molar refractive index, ring structure count, number of aromatic rings, CSP3 fraction, number of valence electrons, number of bridgehead atoms and number of spiro ring atoms, and the extracted feature values are then trimmed and normalized by logarithmic transformation. Based on the molecular object, molecular fingerprint features are extracted, including generating Morgan circular fingerprint, MACCS structural bond fingerprint and RDKit topological fingerprint, and the generated fingerprints are concatenated into a high-dimensional fingerprint vector; The SMILES string is character-level tokenized, a vocabulary is built, and the character sequence is converted into a fixed-length integer sequence.
[0011] Preferably, the modal encoder includes a property encoder; the property encoder includes a linear layer, a batch normalization layer, an activation function, and a dropout layer, used to encode and reduce the dimensionality of the basic molecular property features to obtain property characterization.
[0012] Preferably, the modal encoder includes a fingerprint encoder; the fingerprint encoder includes a multilayer perceptron structure for compressing and reducing the dimensionality of the molecular fingerprint features to obtain a fingerprint representation.
[0013] Preferably, the modal encoder includes a SMILES encoder; the SMILES encoder includes an embedding layer, a position encoding layer, and a multi-layer Transformer encoder layer; it is used to map the SMILES sequence features into a vector sequence through the embedding layer, add position information to the vector sequence through the position encoding layer, encode the sequence through the multi-layer Transformer encoder layer, and perform global average pooling on the encoded sequence to obtain the SMILES representation.
[0014] Preferably, the cross-modal attention fusion module includes: The linear projection and alignment unit includes multiple independent linear layers and batch normalization layers, which will align the representations of each modality to a unified hidden dimension in the future. The modal sequence construction unit stacks the aligned modal representations along the sequence dimension to form a multimodal sequence; A multi-head self-attention unit performs self-attention calculations on the multimodal sequence to obtain the self-attention output of each modality; The gated weight generation unit includes a linear layer, an activation function, and a Softmax normalization layer connected in sequence. After concatenating the aligned modal representations on the feature dimension, it calculates the normalized weights corresponding to each modality. The weighted fusion unit performs weighted summation on the self-attention outputs of each modality using the normalized weights to obtain the fusion representation vector.
[0015] Preferably, in the multi-head self-attention unit, performing self-attention calculation on the multimodal sequence includes: The modal sequences are mapped to a query matrix Q, a key matrix K, and a value matrix V using learnable weight matrices, respectively. Calculate the dot product of the query matrix Q and the transpose of the key matrix K to obtain the initial attention score matrix; Construct the modality-aware bias matrix and add it to the initial attention score matrix to obtain the corrected attention score matrix; The corrected attention score matrix is scaled and Softmax normalized to obtain the attention weight matrix. The attention output is obtained by weighting and summing the value matrix V using the attention weight matrix; The attention output is residually connected to the modality sequence, and after layer normalization, the self-attention output of each modality is obtained.
[0016] Preferably, the construction of the modality-aware bias matrix includes: Each of the property characterization, fingerprint characterization, and sequence characterization is assigned a unique modality type identifier. Based on the modality type identifier of the query vector and the modality type identifier of the key vector, the corresponding scalar bias value is obtained from the learnable bias parameter table; Organize the scalar bias values of all query-key modality pair combinations into a matrix.
[0017] Preferably, the classification head includes: Multiple hidden layers, each of which sequentially performs linear transformation, batch normalization, ReLU activation, and Dropout processing; The linear output layer, based on the output of the last hidden layer, yields the raw scores for each odor category; The Sigmoid function outputs the predicted probability for each odor category.
[0018] Preferably, the molecular odor prediction model is trained using a combined loss function. :
[0019] in, For asymmetric Focal loss, For molecular fingerprint similarity constraint loss, For molecular property similarity constraint loss, For label co-occurrence correlation loss, , , These are the weighting coefficients for each type of loss.
[0020] As can be seen from the above technical solution, compared with the prior art, the technical solution of the present invention has the following beneficial effects: 1. By extracting three types of modal features in parallel—basic molecular properties, molecular fingerprints, and SMILES sequences—this technical approach can comprehensively utilize the physicochemical properties, structural fingerprints, and sequence information of molecules to fully characterize molecular properties, providing richer feature representations for subsequent odor prediction and helping to improve the model's ability to model complex odor relationships.
[0021] 2. By introducing a cross-modal attention fusion module and combining it with a gating weight generation mechanism, this method can dynamically adjust the contribution of different modal features in the prediction task, realize adaptive interaction and fusion between features, thereby enhancing the model's ability to integrate multimodal information and improving the accuracy of odor category discrimination.
[0022] 3. By employing a combined loss function that includes asymmetric Focal loss, molecular feature similarity constraints, and label co-occurrence correlation constraints, the training process not only focuses on the difficulty of sample classification and class balance, but also introduces prior knowledge of chemical structure similarity and label association. This helps guide the model to learn prediction results that are more in line with chemical intuition and olfactory perception, thereby improving the model's generalization performance. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0024] Figure 1 A flowchart of a molecular odor prediction method based on cross-modal attention fusion is provided for an embodiment of the present invention; Figure 2 A framework diagram of a molecular odor prediction model provided in an embodiment of the present invention; Figure 3 This is a framework diagram of the cross-modal attention fusion module provided in an embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] like Figure 1 As shown, this embodiment provides a molecular odor prediction method based on cross-modal attention fusion, including the following steps: S1. Obtain the molecular dataset and extract basic molecular property features, molecular fingerprint features, and SMILES sequence features in parallel for each molecule; S2. Train a molecular odor prediction model using the aforementioned basic molecular properties, molecular fingerprint features, and SMILES sequence features; for example... Figure 2As shown, the molecular odor prediction model includes a modal encoder, a cross-modal attention fusion module, and a classification head connected in sequence; S3. For the molecule to be predicted, input its corresponding basic molecular property features, molecular fingerprint features and SMILES sequence features into the trained molecular odor prediction model to obtain the prediction probability of the corresponding odor category. S4. Based on the predicted probability, determine the odor category prediction result of the molecule to be predicted.
[0027] This method extracts molecular properties, fingerprints, and sequence features in parallel and integrates them adaptively with an encoder and a cross-modal attention fusion module to form a comprehensive and in-depth molecular characterization. Furthermore, by introducing modality-aware attention bias and multi-constraint combination loss, it enhances the model's ability to model the complex relationship between molecular structure and odor, thereby improving the accuracy, robustness, and interpretability of the prediction results.
[0028] In this embodiment, S1, the molecular dataset is acquired, and basic molecular property features, molecular fingerprint features, and SMILES sequence features are extracted in parallel for each molecule. The molecular dataset is derived from public odor molecule databases or experimentally calibrated proprietary data. Each sample contains the standard SMILES string of the molecule and its corresponding multi-label odor category label. The dataset was cleaned and deduplicated during construction, and stratified sampling was used to divide the training set and the test set to ensure a balanced distribution of odor categories and provide a reliable data foundation for model training and evaluation.
[0029] Furthermore, the extraction of basic molecular property features, molecular fingerprint features, and SMILES sequence features includes: Parse the SMILES string of the molecule and generate a molecule object; Based on the molecular object, basic molecular property features are extracted, including molecular weight, LogP, topological polar surface area, number of rotatable bonds, number of hydrogen bond donors, number of hydrogen bond acceptors, molar refractive index, ring structure count, number of aromatic rings, CSP3 fraction, number of valence electrons, number of bridgehead atoms and number of spiro ring atoms, and the extracted feature values are then trimmed and normalized by logarithmic transformation. Based on the molecular object, molecular fingerprint features are extracted, including generating Morgan circular fingerprint, MACCS structural bond fingerprint and RDKit topological fingerprint, and the generated fingerprints are concatenated into a high-dimensional fingerprint vector; The SMILES string is character-level tokenized, a vocabulary is built, and the character sequence is converted into a fixed-length integer sequence.
[0030] Furthermore, generating molecular objects includes: The SMILES string is parsed to identify atoms, chemical bonds, branching structures, and ring structures. Based on the recognition results, an intermediate connection graph representing the molecular topology is constructed. The intermediate connection diagram is subjected to atomic valence saturation and structural normalization to generate a molecular object containing complete atomic, chemical bond and topological connection information.
[0031] Furthermore, the syntax parsing here specifically includes: atomic symbols are represented by uppercase letters of the elements or by elements and charges enclosed in square brackets "[]"; chemical bond types are represented by symbols "-", "=", "#", and ":" to indicate single bonds, double bonds, triple bonds, and aromatic bonds, respectively, and single bonds are connected by default when no symbol is specified between adjacent atoms; branching structures are marked by parentheses "()", and the atomic sequence within the parentheses is regarded as a branch derived from the previous atom; ring structures are marked by the same number to pair atoms to form a closed ring.
[0032] This step obtains samples from a cleaned and standardized molecular dataset, and then extracts three types of heterogeneous features for each molecule in parallel: basic physicochemical properties, multiple molecular fingerprints, and SMILES sequences. This not only ensures the quality and representativeness of the input data, but also provides a comprehensive and reliable molecular characterization foundation for subsequent model construction through multi-angle and complementary feature engineering, thereby enhancing the model's ability to capture molecular information.
[0033] In this embodiment S2, a molecular odor prediction model is trained using the basic molecular property features, molecular fingerprint features, and SMILES sequence features. The molecular odor prediction model includes a modal encoder, a cross-modal attention fusion module, and a classification head connected in sequence. The modal encoder includes a property encoder; the property encoder includes a linear layer, a batch normalization layer, an activation function, and a dropout layer, which are used to encode and reduce the dimensionality of the basic molecular property features to obtain property representations.
[0034] Furthermore, the modal encoder includes a fingerprint encoder; the fingerprint encoder includes a multilayer perceptron structure for compressing and reducing the dimensionality of the molecular fingerprint features to obtain a fingerprint representation; Furthermore, the modal encoder includes a SMILES encoder; the SMILES encoder includes an embedding layer, a position encoding layer, and a multi-layer Transformer encoder layer; it is used to map the SMILES sequence features into a vector sequence through the embedding layer, add position information to the vector sequence through the position encoding layer, encode the sequence through the multi-layer Transformer encoder layer, and perform global average pooling on the encoded sequence to obtain the SMILES representation. Specifically, the position encoding uses sine and cosine functions, represented as:
[0035]
[0036] in, Indicates the position index. Indicates a dimension index. Indicates the embedding dimension.
[0037] This module contains three independent sub-encoders, which are responsible for encoding and dimensionality reduction of basic molecular properties, molecular fingerprints, and SMILES sequences, respectively. The three work in parallel to map the original heterogeneous features into dense representations of a unified dimension.
[0038] like Figure 3 As shown, the cross-modal attention fusion module includes: The linear projection and alignment unit includes multiple independent linear layers and batch normalization layers, which will align the representations of each modality to a unified hidden dimension in the future. The modal sequence construction unit stacks the aligned modal representations along the sequence dimension to form a multimodal sequence; A multi-head self-attention unit performs self-attention calculations on the multimodal sequence to obtain the self-attention output of each modality; The gated weight generation unit includes a linear layer, an activation function, and a Softmax normalization layer connected in sequence. After concatenating the aligned modal representations on the feature dimension, it calculates the normalized weights corresponding to each modality. The weighted fusion unit, through the normalized weights, performs a weighted summation of the self-attention outputs of each modality to obtain the fusion representation vector. ;
[0039] in, , , These represent the self-attention outputs of the property mode, fingerprint mode, and SMILES mode, respectively. , , These represent the normalized weights corresponding to the property mode, fingerprint mode, and SMILES mode, respectively.
[0040] Furthermore, in the multi-head self-attention unit, the self-attention calculation for the multimodal sequence includes: The modal sequences are mapped to a query matrix Q, a key matrix K, and a value matrix V using learnable weight matrices, respectively. Calculate the dot product of the query matrix Q and the transpose of the key matrix K to obtain the initial attention score matrix; Construct the modality-aware bias matrix and add it to the initial attention score matrix to obtain the corrected attention score matrix; The corrected attention score matrix is scaled and Softmax normalized to obtain the attention weight matrix. The attention output is obtained by weighting and summing the value matrix V using the attention weight matrix; The attention output is residually connected to the modality sequence, and after layer normalization, the self-attention output of each modality is obtained.
[0041] Furthermore, the construction of the modality-aware bias matrix includes: Each of the property characterization, fingerprint characterization, and sequence characterization is assigned a unique modality type identifier. Based on the modality type identifier of the query vector and the modality type identifier of the key vector, the corresponding scalar bias value is obtained from the learnable bias parameter table; Organize the scalar bias values of all query-key modality pair combinations into a matrix.
[0042] This module projects and aligns the representations of each modality and stacks them into a modality sequence. Then, by introducing a multi-head self-attention mechanism with modality-aware bias, it models the interaction and dependency between features of different modalities. At the same time, it uses a gating network to dynamically learn the importance weight of each modality in the current prediction task. Finally, it performs weighted fusion of the attention output to obtain a comprehensive and balanced fused representation. It realizes adaptive interaction and contribution adjustment between modalities, and improves the depth and effectiveness of feature fusion.
[0043] Furthermore, the classification header includes: Multiple hidden layers, each of which sequentially performs linear transformation, batch normalization, ReLU activation, and Dropout processing; The linear output layer, based on the output of the last hidden layer, yields the raw scores for each odor category; The Sigmoid function outputs the predicted probability for each odor category:
[0044] in, This represents the predicted probability of the i-th odor tag. This represents the original score corresponding to the i-th label output by the classification header.
[0045] While ensuring expressiveness, this module structure enhances generalization ability through mechanisms such as batch normalization and Dropout, and completes a reliable mapping from fused features to the probability distribution of specific odor attributes.
[0046] Furthermore, a combined loss function is used for optimization during the model training phase: Specifically, this includes: first, calculating the asymmetric Focal loss; applying a binary cross-entropy loss to the predicted score and the true label; setting focusing parameters according to the sample difficulty and the positive / negative sample categories; and applying label smoothing to the true label, as shown below:
[0047] in, The label smoothing coefficient is used to apply a pruning operation to the negative sample probabilities to enhance asymmetry, and is expressed as:
[0048] in, To prune the boundary, calculate the basic cross-entropy loss:
[0049]
[0050] Calculate the focus weights:
[0051]
[0052]
[0053] in, and Let be the focusing parameters for positive and negative samples, respectively. The asymmetric Focal loss is:
[0054] Then, the molecular fingerprint similarity constraint loss is calculated. Within a batch, the pairwise cosine similarity matrix of the molecular fingerprint features and the pairwise cosine similarity matrix of the predicted labels are calculated. The mean squared error loss is calculated for the upper triangular part of the similarity matrix, expressed as:
[0055]
[0056]
[0057] in, The fingerprint features are after L2 normalization. The predicted probability after L2 normalization. This indicates that the upper triangular portion is extracted; Similarly, calculate the molecular property similarity constraint loss. Calculation method and The same, except that fingerprint features are replaced with property features; Next, the label co-occurrence correlation loss is calculated. The co-occurrence matrices of the predicted labels and the true labels are calculated, and the mean squared error loss between the two is calculated, expressed as:
[0058]
[0059]
[0060] in, Batch size; The above losses are weighted and summed according to preset weighting coefficients to obtain the final combined loss. :
[0061] It is an asymmetric Focal loss used to handle class imbalance and easy / difficult samples; The molecular fingerprint similarity constraint loss is used to ensure that the similarity of molecular fingerprint features within a batch is consistent with the similarity of predicted labels. The loss is constrained by molecular property similarity, ensuring that the similarity of molecular property features within a batch is consistent with the similarity of the predicted labels; For the label co-occurrence correlation loss, the co-occurrence matrix of the predicted labels is constrained to be consistent with the co-occurrence matrix of the true labels; , , These are the weighting coefficients for each loss, with values such as 0.02, 0.02, and 0.05.
[0062] Furthermore, before training begins, if a pre-trained model is provided, the weight parameters of the pre-trained model are loaded to initialize the current model, and the training hyperparameters are set to a batch size of 32 and a learning rate of 5×10⁻⁶. The weight decay coefficient is 0.005, the gradient clipping threshold is 0.5, the early stopping patience value is 25 epochs, the AdamW optimizer is used for parameter updates, in each training batch, forward propagation calculates the prediction result and combined loss, backpropagation calculates the gradient, gradient clipping is used to prevent gradient explosion, and then the model parameters are updated. After each epoch, the model performance is evaluated on the validation set and the validation loss is recorded. When the validation loss does not improve beyond the minimum increment threshold within 25 consecutive epochs, the early stopping mechanism is triggered to terminate training and load the model parameters with the lowest validation loss. During the testing phase, the trained model is used to infer on the test set. For each test sample, three modal features are extracted, and a fused representation is obtained through a modal encoder and a cross-modal fusion module. This fused representation is input into the classification head to obtain a prediction score, which is then converted into the prediction probability of each odor label using a sigmoid function. Evaluation metrics are calculated, including: calculating the AUROC (Area Under the Receiver Operating Characteristic) for each odor label, and then taking the average of all labels as the overall AUROC evaluation metric; setting a threshold to convert the prediction probability into binary prediction, and calculating precision, recall, and F1 score. The metrics for each label, as well as the macro-average and micro-average metrics for all labels, can be calculated separately, expressed as:
[0063]
[0064]
[0065]
[0066]
[0067] in, For the first The true rate of each label The false positive rate The total number of odor labels. For a real example, As a false positive example, This is a false negative.
[0068] This step constructs and trains a deep learning model that includes a modal encoder, a cross-modal attention fusion module, and a classification head. Each modal encoder is responsible for mapping the original features to a representation of a unified dimension. The fusion module achieves adaptive interaction and fusion between modalities by introducing a multi-head self-attention mechanism with modality-aware bias and a gated weighted network. Furthermore, during training, a combined loss function that integrates asymmetric Focal loss and multiple structured constraints is used for optimization, enabling the model to deeply fuse multi-source information. Chemical similarity and label relevance priors are also introduced, effectively improving the model's discriminative ability, generalization, and interpretability.
[0069] In this embodiment, S3, for the molecule to be predicted, its corresponding basic molecular property features, molecular fingerprint features and SMILES sequence features are input into the trained molecular odor prediction model to obtain the prediction probability of the corresponding odor category. In specific application scenarios, such as screening candidate molecules for perfumes or evaluating flavor molecules in food, the specific implementation process includes: 1) Feature extraction of the molecule to be predicted; A researcher obtains the SMILES string of a target molecule, parses it to generate a molecular object, and the process includes: performing syntactic parsing on the SMILES string to identify atoms, chemical bonds, branching structures, and ring structures; constructing an intermediate connection diagram representing the molecular topology based on the identification results; and performing atomic valence state saturation and structural normalization processing on the intermediate connection diagram to finally generate a normalized molecular object containing complete atomic, chemical bond, and topological connection information. Based on this molecular object, its physicochemical property descriptors are computed in parallel, molecular fingerprints are generated, and the original SMILES string is segmented and digitally encoded to obtain three types of modal feature vectors consistent with those in the training phase.
[0070] 2) Feature input and model forward propagation; The standardized feature vectors extracted in the previous step are input into the corresponding modules of the pre-trained molecular odor prediction model: basic molecular property features are input into the property encoder, molecular fingerprint features are input into the fingerprint encoder, and SMILES sequence features are input into the sequence encoder. After each encoder outputs a modal representation with a unified dimension, they are sent to the cross-modal attention fusion module for interactive and weighted fusion. Finally, the classification head outputs a multi-dimensional vector, where each dimension corresponds to a preset odor category, such as the original prediction score for fragrance, floral, or herbal scents. 3) Calculation and output of predicted probability; The raw score output by the classification head is mapped element-wise using the Sigmoid function and converted into probability values between 0 and 1. This probability vector is the model's predicted probability distribution for the molecule in each odor category. For example, the output result is [Fruit: 0.92, Floral: 0.15, Herbaceous: 0.03, ...], which means that the model judges that the molecule has a very high probability of having a strong fruity odor, while the probability of having a floral or herbaceous odor is relatively low.
[0071] This process enables end-to-end automatic prediction from molecular structure to quantitative odor attribute spectra, providing an efficient and objective auxiliary decision-making tool for practical applications such as perfume design and flavor screening.
[0072] In this embodiment, S4, based on the predicted probability, the odor category prediction result of the molecule to be predicted is determined; After obtaining the predicted probabilities of each odor label by performing the above steps, the final odor label prediction result is obtained in the following way: For each odor label, its predicted probability is compared with a preset probability threshold; if the predicted probability is greater than or equal to the preset probability threshold, the molecule to be predicted is determined to have the odor category corresponding to the odor label; otherwise, the molecule to be predicted is determined not to have the odor category.
[0073] The predicted probabilities of all odor tags are sorted from high to low, and the top k odor tags with the highest predicted probabilities are selected as the odor category prediction results of the molecule to be predicted; where k is a preset positive integer.
[0074] Users can set a fixed threshold for binarization judgment or select the most likely labels based on probability sorting. This can not only meet the need for accurate screening of high-confidence odors, but also support the diversified exploration of potential odor profiles of molecules, thus enhancing the adaptability of the method in practical applications.
[0075] This embodiment presents a molecular odor prediction method based on cross-modal attention fusion. Through systematic multimodal feature extraction, deep modal interaction fusion, and the introduction of structured loss constraints based on chemical priors, it constructs an efficient prediction framework from molecular structure to olfactory attributes. This not only improves the accuracy of odor prediction but also enhances the interpretability of model decisions, providing strong support for molecular intelligent screening and design in computational olfaction and related fields.
[0076] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0077] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A molecular odor prediction method based on cross-modal attention fusion, characterized in that, Includes the following steps: S1. Obtain the molecular dataset and extract basic molecular property features, molecular fingerprint features, and SMILES sequence features in parallel for each molecule; S2. A molecular odor prediction model is trained using the aforementioned basic molecular property features, molecular fingerprint features, and SMILES sequence features; the molecular odor prediction model includes a modal encoder, a cross-modal attention fusion module, and a classification head connected in sequence; S3. For the molecule to be predicted, input its corresponding basic molecular property features, molecular fingerprint features and SMILES sequence features into the trained molecular odor prediction model to obtain the prediction probability of the corresponding odor category. S4. Based on the predicted probability, determine the odor category prediction result of the molecule to be predicted.
2. The molecular odor prediction method based on cross-modal attention fusion according to claim 1, characterized in that, In step S1, the extraction of basic molecular property features, molecular fingerprint features, and SMILES sequence features includes: Parse the SMILES string of the molecule and generate a molecule object; Based on the molecular object, basic molecular property features are extracted, including molecular weight, LogP, topological polar surface area, number of rotatable bonds, number of hydrogen bond donors, number of hydrogen bond acceptors, molar refractive index, ring structure count, number of aromatic rings, CSP3 fraction, number of valence electrons, number of bridgehead atoms and number of spiro ring atoms, and the extracted feature values are then trimmed and normalized by logarithmic transformation. Based on the molecular object, molecular fingerprint features are extracted, including generating Morgan circular fingerprint, MACCS structural bond fingerprint and RDKit topological fingerprint, and the generated fingerprints are concatenated into a high-dimensional fingerprint vector; The SMILES string is character-level tokenized, a vocabulary is built, and the character sequence is converted into a fixed-length integer sequence.
3. The molecular odor prediction method based on cross-modal attention fusion according to claim 2, characterized in that, The modal encoder includes a property encoder; the property encoder includes a linear layer, a batch normalization layer, an activation function, and a dropout layer, used to encode and reduce the dimensionality of the basic molecular property features to obtain property characterization.
4. The molecular odor prediction method based on cross-modal attention fusion according to claim 1, characterized in that, The modal encoder includes a fingerprint encoder; the fingerprint encoder includes a multilayer perceptron structure for compressing and reducing the dimensionality of the molecular fingerprint features to obtain a fingerprint representation.
5. The molecular odor prediction method based on cross-modal attention fusion according to claim 1, characterized in that, The modal encoder includes a SMILES encoder; the SMILES encoder includes an embedding layer, a position encoding layer, and a multi-layer Transformer encoder layer; it is used to map the SMILES sequence features into a vector sequence through the embedding layer, add position information to the vector sequence through the position encoding layer, encode the sequence through the multi-layer Transformer encoder layer, and perform global average pooling on the encoded sequence to obtain the SMILES representation.
6. The molecular odor prediction method based on cross-modal attention fusion according to claim 5, characterized in that, The cross-modal attention fusion module includes: The linear projection and alignment unit includes multiple independent linear layers and batch normalization layers, which will align the representations of each modality to a unified hidden dimension in the future. The modal sequence construction unit stacks the aligned modal representations along the sequence dimension to form a multimodal sequence; A multi-head self-attention unit performs self-attention calculations on the multimodal sequence to obtain the self-attention output of each modality; The gated weight generation unit includes a linear layer, an activation function, and a Softmax normalization layer connected in sequence. After concatenating the aligned modal representations on the feature dimension, it calculates the normalized weights corresponding to each modality. The weighted fusion unit performs weighted summation on the self-attention outputs of each modality using the normalized weights to obtain the fusion representation vector.
7. The molecular odor prediction method based on cross-modal attention fusion according to claim 6, characterized in that, In the multi-head self-attention unit, the self-attention calculation for the multimodal sequence includes: The modal sequences are mapped to a query matrix Q, a key matrix K, and a value matrix V using learnable weight matrices, respectively. Calculate the dot product of the query matrix Q and the transpose of the key matrix K to obtain the initial attention score matrix; Construct the modality-aware bias matrix and add it to the initial attention score matrix to obtain the corrected attention score matrix; The corrected attention score matrix is scaled and Softmax normalized to obtain the attention weight matrix. The attention output is obtained by weighting and summing the value matrix V using the attention weight matrix; The attention output is residually connected to the modality sequence, and after layer normalization, the self-attention output of each modality is obtained.
8. The molecular odor prediction method based on cross-modal attention fusion according to claim 1, characterized in that, The construction of the modality-aware bias matrix includes: Each of the property characterization, fingerprint characterization, and sequence characterization is assigned a unique modality type identifier. Based on the modality type identifier of the query vector and the modality type identifier of the key vector, the corresponding scalar bias value is obtained from the learnable bias parameter table; Organize the scalar bias values of all query-key modal pair combinations into a matrix.
9. A molecular odor prediction method based on cross-modal attention fusion according to claim 1, characterized in that, The classification header includes: Multiple hidden layers, each of which sequentially performs linear transformation, batch normalization, ReLU activation, and Dropout processing; The linear output layer, based on the output of the last hidden layer, yields the raw scores for each odor category; The Sigmoid function outputs the predicted probability for each odor category.
10. A molecular odor prediction method based on cross-modal attention fusion according to claim 1, characterized in that, The molecular odor prediction model is trained using a combined loss function. : in, For asymmetric Focal loss, For molecular fingerprint similarity constraint loss, For molecular property similarity constraint loss, For label co-occurrence correlation loss, , , These are the weighting coefficients for each type of loss.