## 3 Materials and Methods
### Weighted Deep Feature Combination Based on Attentional Factorization Machine  
In order to extract the descriptive features of odor molecules, we add an attention unit to the DeepFM framework proposed by [47] to form a DeepAFM model and obtain the molecular descriptive features through the weighted deep feature combination based on the attentional factorization machine. Odor molecular feature descriptors are numerous and complex, and not all feature interactions contribute equally to odor classification. Therefore, it is very reasonable to use DeepAFM to extract descriptive features from molecular feature descriptors. The 2140-dimensional molecular feature descriptors generated using PaDEL-descriptor software are utilized to train and validate the attentional factorization machine-based deep neural network model. DeepAFM is divided into an attentional factorization machine (AFM) component [48] and a DNN component, which share the same input, and all parameters are trained jointly for the combined prediction model. AFM is used for feature extraction of order-1 features and order-2 features, which are formed by a pairwise combination of order-1 features, and its output is the sum of the addition unit and the attention unit; DNN is used for feature extraction of high-order features, which are formed by operations such as a full connection of order-1 features. Therefore, it can learn both high-order combination features and low-order combination features. The AFM component is a factorization machine for learning weighted feature interactions, where FM estimates the target by modeling all interactions between each pair of features. It can capture order-2 feature interactions more effectively. Especially when the dataset is sparse, AFM can better learn feature interactions that never or rarely appear in the training data. The raw input feature vectors for molecular feature descriptors are typically highly sparse, ultra-high-dimensional, and grouped by fields (e.g., electronic properties, functional groups, atomic numbers, etc.). For fields with categorical and binary raw features, after one-hot encoding, the feature space tends to be highly sparse and high-dimensional, which makes the network difficult to train. Therefore, the factorization machine is performed on the order-2 parameter matrix, and the latent variable space \(\mathbf{V}\in\mathbb{R}^{n\times k}\) (\(k\) is given) is introduced to solve this matrix, where \(n\) means that the sparse feature is a \(n\)-dimensional vector. In addition, not all feature interactions contribute equally to odor classification. Therefore, we extend the attention mechanism [49] to capture the salient structure of molecular feature descriptors to extract feature interactions that are important for classification. The AFM component is as follows,  
\[s_{ij}=\mathbf{W}_{s}\sigma(\mathbf{W}_{a}<\mathbf{V}_{i},\mathbf{V}_{j}>x_{i }\cdot x_{j}+\mathbf{b}_{s}) \tag{6}\]  
\[\alpha_{ij}=\frac{exp(s_{ij})}{\sum_{i=1}^{n}\sum_{j=i+1}^{n}exp(s_{ij})} \tag{7}\]  
\[\mathbf{Y}_{AFM}=<\mathbf{w},\mathbf{x}>+\sum_{i=1}^{n}\sum_{j=i+1}^{n}\alpha _{ij}<\mathbf{V}_{i},\mathbf{V}_{j}>x_{i}\cdot x_{j} \tag{8}\]  
where \(\mathbf{w}\in\mathbb{R}^{n}\), \(\mathbf{V}_{i}\in\mathbb{R}^{k}\), \(\sigma()\) is the activation function, \(s_{ij}\) is the attention score, and the attention value \(\alpha_{ij}\) denotes the importance of this order-2 feature interaction. The addition unit (\(<\mathbf{w},\mathbf{x}>\)) of Equation (8) reflects the importance of the order-1 features, and the attention unit denotes the influence of the order-2 feature interaction. Furthermore, the embedding layer is designed to compress the input vector into a low-dimensional dense real-valued vector, which is then fed into the network to train latent vectors; otherwise, the network may not be able to train. The overall network is jointly trained in an end-to-end manner.