Odor detection method and device based on gradient boosting tree model, equipment and medium
Patent Information
- Application Number
- CN202610173859.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-06
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2046-02-06
AI Technical Summary
[0003]然而,现有基于梯度提升树模型的电子鼻检测系统在车载嵌入式环境部署时面临双重挑战
[0009]This invention provides an odor detection method, apparatus, device, and medium based on a gradient boosting tree model. It acquires and standardizes raw odor data from an electronic nose, and introduces a quantization sensing mechanism to adapt model parameters to the quantization bit width during gradient boosting tree model training based on the standard dataset, generating a quantized sensing-trained model and subtree prediction outputs. Based on the subtree prediction outputs, weak and strong subtrees are selected, and the weak subtrees are clustered and merged based on similarity, then combined with the strong subtrees to generate a target model. Finally, the target model is used to detect odor data, thereby simultaneously optimizing quantization adaptability and structural precision during the training phase. This approach offers advantages such as simultaneously optimizing quantization adaptability and structural precision during model training, effectively reducing quantization errors and structural information loss, improving the efficiency and accuracy of the model during hardware deployment, and balancing detection performance with hardware deployment requirements.
Smart Images

Figure CN122084694B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to an odor detection method, apparatus, device and medium based on a gradient boosting tree model. Background Technology
[0002] With the rapid development of the automotive industry, in-vehicle air quality and odor comfort have become key factors affecting passenger health and well-being. During the initial use of a new vehicle, interior materials, adhesives, and components continuously release volatile organic compounds (VOCs), creating complex and irritating odors within the enclosed space, which can easily cause dizziness, nausea, and other physiological discomfort in passengers. Electronic nose systems, which collect odor response signals through multi-channel gas sensor arrays and combine them with machine learning models to establish a mapping relationship between signals and odor perception, are gradually becoming a mainstream technology to replace manual olfaction. Among these, the gradient boosting tree model, with its advantages in modeling nonlinear relationships and its ability to generalize from small samples, is widely used in odor detection tasks.
[0003] However, existing electronic nose detection systems based on gradient boosting tree models face a dual challenge when deployed in automotive embedded environments. First, the model uses floating-point precision to store node threshold parameters, resulting in significant storage overhead and computational latency on resource-constrained automotive hardware, making it difficult to meet the requirements of low-power scenarios. Second, to accurately characterize the complex relationship between odor features and subjective perception, the model needs to construct a large number of subtree structures, causing the model size to continuously expand, further exacerbating hardware resource consumption and inference latency issues. Although some research has attempted compression through post-training quantization or simple model pruning, these methods directly reduce accuracy or structure after training, easily leading to abrupt changes in quantization error and loss of structural information, resulting in a significant decrease in model prediction accuracy and failing to balance detection performance and hardware deployment requirements. Therefore, there is an urgent need to develop a technical solution that simultaneously optimizes quantization adaptability and structural simplification during the model training phase. Summary of the Invention
[0004] The purpose of this application is to propose an odor detection method, device, equipment, and medium based on a gradient boosting tree model. This method has the advantages of simultaneously optimizing quantization adaptability and structural precision during the model training stage, effectively reducing quantization errors and structural information loss, improving the efficiency and accuracy of the model during hardware deployment, and balancing detection performance with hardware deployment requirements.
[0005] To address the aforementioned technical problems, embodiments of this application provide an odor detection method based on a gradient boosting tree model, comprising: The raw odor data of the electronic nose is acquired and standardized to generate a standard training dataset. The gradient boosting tree model is iteratively trained based on the standard training dataset, and a quantization-aware mechanism is introduced during the training process to adapt the model parameters of the gradient boosting tree model to the target quantization bit width of the input data, thereby generating the complete model after quantization-aware training and the prediction output of each subtree. Based on the predicted output of each subtree, a set of weak subtrees and a set of strong subtrees are selected. Similarity clustering and merging reconstruction are performed on the set of weak subtrees. The set of strong subtrees is combined with the merged and reconstructed subtrees to generate a target gradient boosting tree model. The odor data of the electronic nose to be detected is acquired, and the odor data of the electronic nose to be detected is detected by the target gradient boosting tree model to obtain the detection result.
[0006] To address the aforementioned technical problems, embodiments of this application provide an odor detection device based on a gradient boosting tree model, comprising: The training data generation module is used to acquire the raw odor data of the electronic nose, and to standardize the raw odor data to generate a standard training dataset. The quantization-aware module is used to iteratively train the gradient boosting tree model based on the standard training dataset, and introduces a quantization-aware mechanism during the training process to adapt the model parameters of the gradient boosting tree model to the target quantization bit width, thereby generating the complete model trained by quantization-aware and the prediction output of each subtree. The subtree merging and reconstruction module is used to filter out a set of weak subtrees and a set of strong subtrees based on the prediction output of each subtree, perform similarity clustering and merging and reconstruction on the set of weak subtrees, and combine the set of strong subtrees with the merged and reconstructed subtrees to generate a target gradient boosting tree model. The odor data detection module is used to acquire the odor data of the electronic nose to be detected, and to detect the odor data of the electronic nose to be detected through the target gradient boosting tree model to obtain the detection result.
[0007] To solve the above-mentioned technical problems, one technical solution adopted by the present invention is to provide a computer device, including one or more processors; and a memory for storing one or more programs, so that the one or more processors implement the odor detection method based on the gradient boosting tree model described in any one of the above-mentioned methods.
[0008] To solve the above-mentioned technical problems, one technical solution adopted by the present invention is: a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the odor detection method based on the gradient boosting tree model described above.
[0009] This invention provides an odor detection method, apparatus, device, and medium based on a gradient boosting tree model. It acquires and standardizes raw odor data from an electronic nose, and introduces a quantization sensing mechanism to adapt model parameters to the quantization bit width during gradient boosting tree model training based on the standard dataset, generating a quantized sensing-trained model and subtree prediction outputs. Based on the subtree prediction outputs, weak and strong subtrees are selected, and the weak subtrees are clustered and merged based on similarity, then combined with the strong subtrees to generate a target model. Finally, the target model is used to detect odor data, thereby simultaneously optimizing quantization adaptability and structural precision during the training phase. This approach offers advantages such as simultaneously optimizing quantization adaptability and structural precision during model training, effectively reducing quantization errors and structural information loss, improving the efficiency and accuracy of the model during hardware deployment, and balancing detection performance with hardware deployment requirements. Attached Figure Description
[0010] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating the implementation of the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 2 This is a flowchart illustrating the implementation of the first sub-process in the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 3 This is a flowchart illustrating the implementation of the second sub-process in the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 4 This is a flowchart illustrating the implementation of the third sub-process in the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 5 This is a flowchart illustrating the implementation of the fourth sub-process in the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 6 This is a flowchart illustrating the implementation of the fifth sub-process in the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 7 This is a flowchart illustrating the implementation of the sixth sub-process in the odor detection method based on a gradient boosting tree model provided in this application embodiment; Figure 8 This is a schematic diagram of an odor detection device based on a gradient boosting tree model provided in an embodiment of this application; Figure 9 This is a schematic diagram of the computer device provided in the embodiments of this application. Detailed Implementation
[0012] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0013] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0014] Existing electronic nose detection solutions have significant shortcomings in practical vehicle deployment. Gradient boosting tree models typically use floating-point precision to store node thresholds and related parameters, resulting in high storage overhead and computational latency when deployed on resource-constrained hardware. Furthermore, to characterize complex odor features, the model structure often contains numerous subtrees, further exacerbating hardware resource consumption and inference latency. Existing compression methods are prone to introducing quantization errors or structural information loss, reducing prediction accuracy and making it difficult to balance performance and deployment requirements. To address this issue, this application proposes an odor detection method based on a gradient boosting tree model. The method involves acquiring and standardizing the raw odor data from an electronic nose to generate a standard training dataset. The gradient boosting tree model is then iteratively trained using this dataset, incorporating a quantization sensing mechanism to adapt the model parameters to the target quantization bit width, generating a complete model trained with quantization sensing and the predicted outputs of each subtree. Based on the predicted outputs of each subtree, sets of weak and strong subtrees are selected. The weak subtree sets are then clustered and merged based on similarity, and the strong subtree sets are combined with the merged and reconstructed subtrees to generate a target gradient boosting tree model. Finally, the odor data from the electronic nose to be detected is acquired, and the odor data is detected using the target gradient boosting tree model to obtain the detection results.
[0015] For ease of understanding, the following explains some key terms in this embodiment: An electronic nose is a device that mimics the human olfactory system. It typically consists of an array of gas sensors and a pattern recognition system, and is used to identify and distinguish complex odors.
[0016] Gradient boosting tree model is an ensemble learning model that improves the overall prediction accuracy of the model by iteratively training a series of weak predictors and summing their predictions.
[0017] Quantization awareness is a strategy introduced during model training to adapt the model's parameters and intermediate computation results to a low-bit-width quantization representation during the training phase, thereby reducing quantization errors and improving the performance of the quantized model.
[0018] The target quantization bit width refers to the number of binary bits used after quantization of model parameters and data, such as 8 bits, 4 bits, etc. The lower the bit width, the less storage and computing resources are consumed.
[0019] Subtrees, each weak predictor in a gradient boosting tree model, are typically decision trees responsible for learning specific patterns or residuals in the data.
[0020] The set of weak subtrees refers to the set of subtrees in a gradient boosting tree model that contribute little to the overall model or have relatively weak predictive power.
[0021] A set of strong subtrees refers to the set of subtrees in a gradient boosting tree model that contribute significantly to the overall model or have relatively strong predictive power.
[0022] Similarity clustering is a data analysis technique that groups similar data points into different clusters by calculating the similarity between them. In this context, it is used to group similar subtrees of predicted outputs.
[0023] Merging and refactoring refers to integrating multiple similar or weak subtrees in some way and training a new, usually simpler, subtree to replace them, in order to achieve model compression.
[0024] This application introduces a quantization-aware mechanism into the training of the gradient boosting tree model, enabling the model parameters to adapt to low-bit-width representations, effectively reducing the storage overhead and computational latency of the model on automotive embedded hardware. Simultaneously, by evaluating the contribution of subtrees, performing similarity clustering, and merging and reconstruction, the model size is significantly compressed, reducing inference latency. Thus, while ensuring odor detection accuracy, a lightweight deployment of the gradient boosting tree model is achieved, improving the real-time performance and resource utilization efficiency of the automotive odor detection system.
[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0026] Please see Figure 1 , Figure 1This paper illustrates a specific implementation of an odor detection method based on a gradient boosting tree model.
[0027] It should be noted that if substantially the same result is obtained, the method of this invention is not based on... Figure 1 Limited to the order of the processes shown, this method includes the following steps: S1: Acquire the raw odor data of the electronic nose, and standardize the raw odor data to generate a standard training dataset.
[0028] Specifically, the raw odor data from the electronic nose is acquired and standardized to generate a standard training dataset. The raw odor data can be directly acquired through an electronic nose sensor array. For example, the sensor array can consist of various metal-oxide-semiconductor (MOS) sensors that respond to odor samples under specific temperature and humidity conditions, recording the conductivity or resistance changes of each channel as raw data. Standardization can employ a linear scaling method, mapping the raw data to the interval [0, 1] or [-1, 1]. For example, this can be achieved by calculating the maximum and minimum values for each channel and then applying the formula (x - min) / (max - min). Alternatively, Z-score standardization can be used, which involves calculating the mean and standard deviation for each channel and then applying the formula (x - mean) / stddev.
[0029] Please see Figure 2 , Figure 2 A specific implementation of step S1 is shown below: S11: Acquire the raw odor data from multiple channels collected by the electronic nose sensor array. S12: Normalize the raw odor data so that each channel of the raw odor data falls within a preset value range, thus forming the standard training dataset.
[0030] Specifically, the first step involves acquiring multi-channel raw odor data from the electronic nose sensor array. This step aims to obtain comprehensive and representative odor response data. Electronic nose sensor arrays typically consist of multiple gas sensors of different types, each with varying sensitivities and selectivity to specific gases or gas components. By acquiring multi-channel data, the response characteristics of odor samples on different sensors can be captured, thus forming a multi-dimensional odor fingerprint. For example, a metal-oxide-semiconductor (MOS) sensor array can be used, which exhibits different resistance changes to volatile organic compounds (VOCs) under different temperature and humidity conditions. Multiple MOS sensors can work together to acquire multi-channel resistance response signals. Alternatively, a quartz crystal microbalance (QCM) sensor array can be used. Its surface is coated with different sensitive materials; when odor molecules are adsorbed, the crystal oscillation frequency changes. By measuring the frequency drift of multiple QCM sensors, multi-channel frequency response data can be obtained.
[0031] Based on this, the raw odor data is normalized to ensure that each channel's data falls within a preset numerical range, forming a standard training dataset. Normalization is a crucial step in data preprocessing. Its purpose is to eliminate dimensional inconsistencies between different sensor channels caused by differences in physical characteristics, response ranges, or measurement units, and to suppress noise interference in the data. This ensures that all channel data have the same weight and comparability during model training. By mapping the data to a preset numerical range, the problem of some channels dominating model training due to excessively large values or being ignored due to excessively small values can be effectively avoided.
[0032] S2: Iteratively train the gradient boosting tree model based on the standard training dataset, and introduce a quantization-aware mechanism during the training process to adapt the model parameters of the gradient boosting tree model to the target quantization bit width, thereby generating the complete model and the prediction output of each subtree after quantization-aware training.
[0033] Specifically, a gradient boosting tree model is iteratively trained based on a standard training dataset. A quantization-aware mechanism is introduced during training to adapt the model parameters to the target quantization bit width, generating the complete model and the prediction outputs of each subtree after quantization-aware training. Gradient boosting tree models can be constructed using frameworks such as XGBoost, LightGBM, or CatBoost. During training, model parameters (such as node thresholds and leaf node values) are typically stored as floating-point numbers. The introduction of the quantization-aware mechanism allows for simulated quantization of the model parameters in each iteration of the training loop.
[0034] Please see Figure 3 , Figure 3A specific implementation of step S2 is shown below: S21: Perform the first round of training on the gradient boosting tree model based on the standard training dataset to obtain the first-round model and the set of node threshold parameters. S22: Calculate the first-round quantization parameters according to the target quantization bit width and the numerical range of the node threshold parameter set. S23: Perform simulated quantization and dequantization using the first-round quantization parameters, the standard training dataset, and the set of node threshold parameters to obtain the quantized dataset. S24: Iteratively train the first-round model again based on the quantized dataset to adapt the model parameters of the gradient boosting tree model to the target quantization bit width, generating the complete model trained with quantization awareness and the predicted outputs of each subtree.
[0035] Specifically, the gradient boosting tree model undergoes its first round of training based on a standard training dataset, aiming to construct an initial, non-quantization-aware gradient boosting tree model. This step typically employs standard gradient boosting algorithms, such as XGBoost and LightGBM, and is trained in floating-point precision to fully utilize the information from the standard training dataset, obtaining a first-round model with preliminary predictive capabilities. All node threshold parameters are then extracted, forming a set of node threshold parameters. This first-round model and the set of node threshold parameters provide the foundation for subsequent quantization-aware training.
[0036] Based on this, the first round of quantization parameters is calculated according to the target quantization bit width and the numerical range of the node threshold parameter set. The target quantization bit width refers to the number of bits that the model parameters and input data will be quantized to during deployment, such as 8 bits or 4 bits. The calculation of quantization parameters is crucial in the quantization process, as it determines how floating-point numbers are mapped to fixed-point numbers.
[0037] Subsequently, simulated quantization and dequantization are performed on the standard training dataset and the set of node threshold parameters using the first round of quantization parameters to obtain the quantized dataset. Simulated quantization and dequantization are the core steps of quantization-aware training, aiming to simulate the quantization effects experienced by the model during actual deployment during the training phase. Specifically, the process involves: first, converting the feature values of the standard training dataset and the floating-point parameters in the set of node threshold parameters into fixed-point representations based on the calculated first-round quantization parameters (simulated quantization); then, converting these fixed-point representations back to floating-point representations (dequantization). This process introduces quantization errors, allowing the model to "sense" the existence of these errors during training, thereby learning how to maintain performance under such quantization error conditions. The quantized dataset contains input data and model parameters processed with simulated quantization errors, providing a data foundation closer to the real deployment environment for subsequent iterative training.
[0038] Finally, the first-round model is retrained iteratively based on the quantized dataset. This allows the gradient boosting tree model's parameters to adapt to the target quantization bit width, generating the complete quantization-aware model and the prediction outputs of each subtree. During this stage, the model continues iterative training, for example, by adding new subtrees to fit the residuals. However, all training processes are based on the quantized dataset, which has undergone simulated quantization and dequantization. This means that during the learning process, parameter updates and structural adjustments take into account the impact of quantization errors, ensuring that the final complete model and the prediction outputs of its subtrees maintain better accuracy and stability when deployed on low-bit-width hardware.
[0039] This application introduces explicit quantization parameter calculation and simulated quantization steps during the training process of the gradient boosting tree model, enabling the model to fully simulate the real quantization environment during the training phase. This avoids the sudden quantization errors and significant accuracy degradation that may occur with traditional post-training quantization methods. Through iterative training based on the quantized dataset, the model parameters can proactively adapt to the target quantization bit width, thereby effectively reducing storage overhead and computational latency when deployed on resource-constrained automotive embedded hardware or dedicated acceleration circuits, while ensuring the accuracy and stability of odor detection, significantly improving the hardware deployment friendliness of the model.
[0040] Please see Figure 4 , Figure 4 A specific implementation of step S24 is shown below: S241: Calculate the predicted values of the first-round model on the quantized dataset, and calculate the residuals based on the predicted values and the true labels. S242: Using the residuals as the target, train new subtrees on the first-round model based on the quantized dataset, and update the first-round model with the new subtrees to obtain the current iteration model. S243: Extract the current node thresholds of all subtrees in the current iteration model to form a parameter set. S244: Calculate the quantization scaling factor and zero-point bias for the new round based on the global maximum and minimum values of the parameter set, and perform simulated quantization and dequantization based on the quantization scaling factor and the zero-point bias to obtain a new quantized dataset. S245: Retrain the model based on the quantized dataset to obtain the complete model trained with quantization awareness and the predicted outputs of each subtree.
[0041] Specifically, the steps of calculating the predicted values of the first-round model on the quantized dataset and calculating the residuals based on the predicted values and the true labels aim to evaluate the current model's performance on the simulated quantized data and quantify the deviation between its predictions and the true values. The residuals are the core of iterative training of gradient boosting tree models; they guide the training direction of subsequent subtrees to correct model errors. By calculating the residuals on the quantized dataset, the model can perceive the impact of quantization early in training, laying the foundation for subsequent quantization-aware training. For example, the quantized dataset can be input into the current first-round model to obtain the predicted output for each sample, and then these predicted outputs can be compared with the corresponding true labels to calculate the difference between them, which is the residual. Alternatively, a more complex loss function gradient can be used as an alternative to the residuals. For example, in some variants of gradient boosting trees, the residual is not directly the difference between the predicted and true values, but rather the negative gradient of the loss function with respect to the predicted values. This approach allows for more flexible adaptation to different task types and optimization objectives.
[0042] The core mechanism of gradient boosting tree model iterative training involves training new subtrees on the first-round model using the residuals as the target, and then updating the first-round model with these new subtrees to obtain the current iterative model. By training new subtrees to fit the residuals of the previous model, the model can gradually correct its own errors, thereby improving the overall prediction accuracy. Adding these new subtrees to the existing model creates a more powerful ensemble model. For example, a decision tree (such as a CART tree) can be used as a subtree. During training, the quantized dataset is used as input, and the calculated residuals are used as the target variable to construct a new decision tree. The goal of this new decision tree is to predict the residuals as accurately as possible. After training, this new subtree is added to the first-round model in a weighted manner (e.g., multiplied by the learning rate) to form the current iterative model. Alternatively, other types of weak learners can be used as subtrees, such as linear models or simpler tree structures (such as decision stubs). The training process is similar, targeting the residuals, training weak learners on the quantized dataset, and then integrating them into the existing model.
[0043] The step of extracting the current node thresholds of all subtrees in the current iterative model to form a parameter set is to obtain all the key parameters of the current model, which are the basis for the model's prediction decisions. In quantization-aware training, these node thresholds are core parameters that need to be quantized, and their numerical range and distribution directly affect the calculation of quantization parameters. For example, we can traverse every subtree in the current iterative model, visit its internal nodes for each subtree, and extract the threshold used to split the data for each node. All these extracted thresholds can be collected to form a parameter set containing all node thresholds. Alternatively, in addition to node thresholds, the output values of leaf nodes can also be included in the parameter set. In some implementations of gradient boosting trees, the output values of leaf nodes are also important parameters of the model and also need to be quantized. Therefore, collecting the node thresholds of all subtrees and the output values of leaf nodes together forms a more comprehensive parameter set.
[0044] The key step in achieving dynamic quantization awareness is calculating the quantization scaling factor and zero-point bias based on the global maximum and minimum values of the parameter set, and then performing simulated quantization and dequantization based on these scaling factors and zero-point biases to obtain a new quantized dataset. By dynamically calculating the quantization parameters (scaling factor and zero-point bias) according to the actual distribution of the current model parameters (global maximum and minimum values), it ensures that the quantization range always matches the actual numerical range of the model parameters, thereby minimizing quantization errors. Simulated quantization and dequantization operations simulate the behavior of real quantization hardware during training, allowing the model to adapt in advance to the accuracy loss caused by quantization. For example, first, the minimum and maximum values of all parameters are found in the parameter set, and then the quantization scaling factor and zero-point bias are calculated based on the target quantization bit width (e.g., 8-bit integer). Next, simulated quantization is performed on the floating-point numbers in the standard training dataset and the node threshold parameter set, followed by dequantization to obtain a new quantized dataset. Alternatively, in addition to using global maximum and minimum values, more refined quantization parameter calculation methods can be used, such as using moving averages to estimate the dynamic range of the parameters, or using hierarchical quantization to calculate independent quantization parameters for different parameter sets. Simulated quantization and dequantization operations can employ different rounding strategies (such as nearest neighbor rounding, round down, etc.) to simulate the quantization behavior of different hardware.
[0045] The ultimate goal of quantization-aware training is to retrain the model on the quantized dataset to obtain a complete quantization-aware trained model and the predicted outputs of each subtree. By continuing to train the model on the dynamically adjusted quantization parameters of the "quantization-aware" dataset, it ensures that the model adapts to the target quantization bit width throughout the training process. This allows the final model to maintain high accuracy and performance when deployed on resource-constrained hardware. For example, after obtaining a new quantized dataset, the iterative training process of the gradient boosting tree continues. This means that the model will calculate new residuals, train new subtrees, and update the model based on this new quantization-aware dataset. This process continues until a preset number of iterations is reached or a convergence condition is met. Ultimately, all subtrees of the model will be trained in a quantization-aware environment, forming a complete quantization-aware trained model. Alternatively, an additional quantization loss term can be introduced during retraining to further penalize quantization errors. For example, a term measuring the difference between the floating-point model output and the quantized model output can be added to the loss function. This way, the model not only fits the residuals during training but also minimizes the quantization error, thus adapting to the quantization bit width more effectively.
[0046] This application accurately captures model errors in a quantized environment, providing precise targets for subsequent corrections and ensuring the continuation of the gradient boosting tree model's inherent iterative optimization capabilities. The key lies in extracting the current node thresholds of all subtrees in the current iterative model to form a parameter set, and dynamically calculating the new round of quantization scaling factors and zero-point bias based on the global maximum and minimum values of this set. This mechanism allows the quantization parameters to reflect the numerical distribution of the current model parameters in real time and accurately, avoiding the error accumulation caused by fixed quantization parameters. Simulated quantization and dequantization are performed based on dynamically updated quantization parameters to generate a new quantized dataset, ensuring the model remains in a simulated quantization environment throughout subsequent training, thus fully adapting to the target quantization bit width during the training phase. Finally, the model is retrained based on this continuously updated quantized dataset, ensuring that the model parameters are highly matched to the target quantization bit width throughout the entire iteration process, significantly reducing quantization errors and improving the model's prediction accuracy and robustness after quantization deployment. Compared to schemes with fixed quantization parameters, this scheme can more effectively solve the problem of quantization error accumulation, enabling the model to maintain excellent performance when deployed on resource-constrained hardware, thereby meeting the needs of low-power, low-cost applications such as automotive and embedded systems.
[0047] In one specific embodiment, a uniform quantization method is used to represent this mapping relationship from floating-point numbers to quantized integers, expressed by the formula: (1); Where r is a floating-point value, q is the corresponding quantization value, S is the scaling factor, and Z is the zero-point offset.
[0048] Before quantizing the model's parameters, the scaling factor S and the zero-point offset Z must be determined. Assuming the target quantization bit width is w, the quantization range specified using unsigned integers is: =0, = .therefore, (2); (3); Based on the scaling factor S and the zero-point bias Z, the quantization and dequantization processes for a floating-point number can be obtained as follows: (4); in, `clip()` rounds the current value to the nearest integer, while `clip()` limits the result to 0. Within the range. Where q is the quantized integer representation of x, and... It is the value of q converted back to a floating-point number.
[0049] Specifically, after each iteration, the node threshold parameters of all subtrees in the current model are extracted. The corresponding quantization step size and zero-point bias are calculated based on the preset quantization bit width range. Quantization and dequantization operations are then performed simultaneously on the threshold parameters and the input training data. Assume the initial number of iterations is n, and the number of newly added trees in each iteration is k. In the first iteration, the initial model consists of k trees. In the original dataset After completing the training, The threshold parameters of all trees in the equation are extracted and used to calculate the corresponding threshold parameters according to equations (2) and (3). and Next, based on the obtained S and Z, the model is then... Thresholds and datasets Perform one quantization and one dequantization to obtain the corresponding simulated quantized model. and dataset This completes the first iteration. In the second iteration, ... Based on this, model F2 is used in the dataset Instead of training new k trees on dataset X, this allows the newly trained k trees to proactively adapt to the dataset at the desired quantization precision. Then, similarly from... Obtained from the threshold parameter in And Z2 and again against and The threshold is used for quantization and dequantization, completing the second iteration and continuing to iterate until the nth iteration.
[0050] In each iteration after the initial iteration, the newly generated subtrees are no longer trained based on the original high-precision data. Instead, they are fitted with residuals from the quantized and dequantized data and the threshold space, allowing the model to gradually adapt to the low-precision parameter representation during training. Through multiple iterations, this mechanism guides the model to automatically compensate for the errors introduced by quantization, avoiding the significant performance degradation caused by abrupt changes in parameter precision in traditional post-training quantization methods.
[0051] S3: Based on the prediction output of each subtree, select the set of weak subtrees and the set of strong subtrees, perform similarity clustering and merging reconstruction on the set of weak subtrees, and combine the set of strong subtrees with the merged and reconstructed subtrees to generate the target gradient boosting tree model.
[0052] Specifically, based on the predicted outputs of each subtree, sets of weak and strong subtrees are selected. The weak subtree sets are then subjected to similarity clustering and merging / reconstruction. Finally, the strong subtree sets are combined with the merged / reconstructed subtrees to generate the target gradient boosting tree model. The predicted output of a subtree can be the predicted value for each sample in the training dataset. The selection of weak and strong subtrees can be based on the subtree's contribution to the overall model's prediction results; for example, calculating the error reduction of each subtree on the validation set, with subtrees contributing less than a certain threshold considered weak subtrees. Merging / reconstruction can involve training a new decision tree for each subtree group to fit the average predicted output of all subtrees within that group. The combination of the strong subtree set and the reconstructed subtrees can be directly added to the final target gradient boosting tree model.
[0053] Please see Figure 5 , Figure 5 A specific implementation of step S3 is shown below: S31: Calculate the contribution of each subtree based on its predicted output, and divide the set of weak subtrees and the set of strong subtrees according to the contribution. S32: Calculate the similarity between the predicted output vectors of any two subtrees in the set of weak subtrees, and use a greedy strategy to cluster the subtrees in the set of weak subtrees based on the similarity to obtain multiple subtree groups. S33: For each subtree group, using the mean of the predicted output vectors of the subtrees in the subtree group as the target, retrain a new shallow subtree to replace it, obtaining the reconstructed subtree. S34: Combine the set of strong subtrees with all the reconstructed subtrees to generate the target gradient boosting tree model.
[0054] Specifically, the contribution of a subtree refers to the degree of independent influence of each subtree on the overall predictive performance of the model or a specific task objective. Its purpose is to quantify the importance of each subtree, providing a basis for subsequent model optimization. For example, its contribution can be assessed by calculating the correlation or error reduction between the predicted output of each subtree on the validation set and the true label. For classification tasks, the reduction in cross-entropy loss or Gini coefficient between the predicted output of each subtree and the true label can be calculated; for regression tasks, the reduction in mean squared error (MSE) can be calculated. Furthermore, it can also be indirectly assessed by analyzing the weight of subtrees in the model ensemble or their splitting importance in the feature space, for example, by using feature importance scores (such as gain, coverage, etc.) built into models like XGBoost. After obtaining the contribution, the purpose of dividing the model into weak and strong subtree sets is to identify subtrees that contribute less to the overall model performance and may be redundant, so as to perform subsequent compression optimization, while retaining subtrees that are crucial to model performance. For example, a preset contribution threshold can be set. Subtrees with a contribution below this threshold are assigned to the weak subtree set, while subtrees with a contribution at or above the threshold are assigned to the strong subtree set. This threshold can be set empirically or optimized through methods such as cross-validation. Alternatively, a sorting and proportional partitioning method can be used: all subtrees are sorted in descending order of contribution, and the top N% of subtrees by contribution are selected as the strong subtree set, with the rest as the weak subtree set.
[0055] Next, the similarity between the predicted output vectors of any two subtrees in the weak subtree set is calculated. A greedy strategy is then used to cluster the subtrees in the weak subtree set based on this similarity, resulting in multiple subtree groups. The similarity measure is used to assess the closeness of two subtrees in their predictive behavior. Its purpose is to identify functionally similar or redundant subtrees, providing a basis for subsequent merging and reconstruction. For example, cosine similarity can be used to measure the directional consistency between two predicted output vectors; it is simple to calculate and insensitive to vector scale, making it suitable for comparing prediction patterns. Alternatively, the reciprocal of the Euclidean distance or the Gaussian kernel function can be used to measure similarity, with closer distances indicating higher similarity. After calculating the similarity, a greedy strategy is used for clustering. This strategy is a heuristic algorithm that makes the best or optimal choice in the current state at each step, aiming to achieve a globally optimal result. Here, its role is to efficiently group similar weak subtrees into one class, forming subtree groups, thereby reducing computational complexity and avoiding manual adjustments. Specifically, a subtree can be randomly selected from the set of weak subtrees as a seed. Then, all subtrees with a similarity higher than a preset threshold to the seed subtree are grouped into the same subtree group, and these subtrees are removed from the set of weak subtrees. This process is repeated until the set of weak subtrees is empty. Alternatively, the subtree with the highest similarity to the center (or representative subtree) of an existing subtree group in the current set of weak subtrees can be iteratively added to that group, or the subtree with the highest similarity to any already grouped subtree can be selected as the seed for the new group.
[0056] Furthermore, for each subtree group, a new shallow subtree is retrained to replace it, using the mean of the predicted output vectors of the subtrees in the subtree group as the target, resulting in the reconstructed subtree. The purpose of this step is to replace multiple functionally similar weak subtrees in a subtree group with a shallow subtree that has a simpler structure and fewer parameters, thereby achieving model compression. Using the mean as the target comprehensively reflects the average prediction behavior of all subtrees within the subtree group, ensuring that the reconstructed subtree retains as much of the overall functionality of the original subtree group as possible.
[0057] Finally, the set of strong subtrees is combined with all the reconstructed subtrees to generate the target gradient boosting tree model. This step re-integrates the selected and reconstructed subtrees to form the final lightweight gradient boosting tree model. Its purpose is to significantly reduce the size and complexity of the model while maintaining its overall predictive performance.
[0058] This application further optimizes the structure of the gradient boosting tree model by iteratively training it and introducing a quantization-aware mechanism. Specifically, by calculating the contribution of each subtree, it can objectively distinguish between weak subtrees with minor impact on model performance and crucial strong subtrees, avoiding the mistreatment of key subtrees. Subsequently, by calculating the similarity between subtrees in the weak subtree set and using a greedy strategy for clustering, it can efficiently identify and merge functionally similar or redundant weak subtrees, effectively reducing redundant information in the model. For each subtree group, a new shallow subtree is retrained to replace it, using the mean of the predicted output vectors of its internal subtrees as the target. This process not only achieves the effective merging of multiple similar weak subtrees but also significantly reduces the depth and complexity of the model by using shallow subtrees, thereby greatly compressing the model size. Finally, the retained set of strong subtrees is combined with these reconstructed shallow subtrees to generate the target gradient boosting tree model. This structural optimization method significantly reduces the number of model parameters and computational load while preserving the core predictive capabilities of the model. It effectively solves the problem of insufficient model complexity reduction caused by weak subtree redundancy. This enables the model to effectively reduce storage overhead and computational latency when deployed on resource-constrained automotive embedded hardware or dedicated acceleration circuits, thereby improving the model's deployment efficiency and real-time performance, while avoiding the accuracy loss that may be introduced by traditional model pruning.
[0059] Please see Figure 6 , Figure 6 A specific implementation of step S32 is shown below: S321: Calculate the cosine similarity between the predicted output vectors of any two subtrees in the weak subtree set. S322: Select any subtree from the weak subtree set as a seed, and retrieve all subtrees with a cosine similarity not lower than a preset similarity threshold to form a new subtree group. S323: Remove all subtrees from the weak subtree set in the new subtree group, and select another seed, until the weak subtree set is empty, resulting in multiple subtree groups.
[0060] Specifically, the cosine similarity between the predicted output vectors of any two subtrees in the weak subtree set is calculated to quantify the similarity of these subtrees in their predictive behavior. Cosine similarity assesses directional consistency by measuring the cosine of the angle between two vectors, unaffected by vector length (i.e., prediction magnitude). For example, for each pair of subtrees in the weak subtree set, their predicted output sequences on a validation dataset or standard training dataset can be obtained and treated as predicted output vectors. Then, according to the definition of cosine similarity, the dot product of the two vectors is calculated and divided by the product of their respective magnitudes, resulting in a value between -1 and 1, where a value closer to 1 indicates higher similarity. Alternatively, a representative dataset can be predefined, on which the predicted outputs of all subtrees are generated, to ensure consistency in the similarity calculation baseline.
[0061] Based on this, the target weak subtrees are selected from the set of weak subtrees according to a preset similarity threshold and the cosine similarity. The purpose of this step is to focus on subtrees with sufficiently high similarity to ensure the effectiveness of subsequent clustering and merging. The preset similarity threshold is a key parameter that determines the strictness to which subtrees are considered "similar." For example, an empirical value, such as 0.8 or 0.9, can be set, indicating that two subtrees are considered sufficiently similar only when their cosine similarity reaches or exceeds this value. Alternatively, this threshold can be dynamically determined by performing statistical analysis (e.g., based on quantiles or standard deviations) on all similarity distributions within the set of weak subtrees to adapt to the characteristics of different datasets or model training states.
[0062] Furthermore, the greedy strategy is employed to cluster each target weak subtree into multiple subtree groups. The greedy strategy here manifests as making what appears to be the optimal choice at each step, aiming to achieve a global optimum. The advantage of this strategy lies in its high computational efficiency and ability to quickly form clusters. In its specific implementation, this strategy iteratively selects un-clustered subtrees as "seeds" and incorporates all sufficiently similar "target weak subtrees" into the same group, thereby gradually constructing multiple subtree groups.
[0063] In detail, a subtree is randomly selected from the set of weak subtrees as the seed, and all subtrees with a cosine similarity of at least a preset similarity threshold are retrieved to form a new subtree group. Selecting the seed is the starting point of the clustering process; any ungrouped weak subtree can be randomly chosen. Once a seed is selected, the system traverses all other ungrouped subtrees in the set of weak subtrees, calculating their cosine similarity to the seed. Any subtree with a similarity reaching or exceeding the preset threshold will be included in the new subtree group centered on that seed. For example, if the set of weak subtrees contains subtrees A, B, and C, and A is selected as the seed, if the similarity between A and B is higher than the threshold, and the similarity between A and C is also higher than the threshold, then the subtree group will contain A, B, and C. Another way to select the seed is to prioritize the subtree with the highest average similarity to other subtrees in the set of weak subtrees as the seed, aiming to form a tighter initial cluster.
[0064] Based on this, all subtrees in the new subtree group are removed from the weak subtree set, and another seed is selected, until the weak subtree set is empty, resulting in multiple subtree groups. This iterative process ensures that each weak subtree is ultimately assigned to one and only one subtree group. Once a subtree group is formed, all its members are removed from the unprocessed weak subtree set to avoid duplicate processing and cross-grouping. Subsequently, if the weak subtree set is still not empty, another seed is selected from the remaining subtrees, and the above retrieval and grouping process is repeated until all weak subtrees are successfully grouped. This mechanism guarantees the integrity and non-overlap of the clustering process.
[0065] This application effectively addresses the efficiency and accuracy issues that may arise during weak subtree clustering. By calculating the cosine similarity of the predicted output vectors, the functional similarity between subtrees can be objectively and accurately measured, avoiding biases from subjective judgments. A greedy clustering strategy is employed, resulting in high computational efficiency and the ability to quickly process large sets of weak subtrees, thereby reducing the computational overhead of model compression. Specifically, by iteratively selecting seeds and incorporating highly similar subtrees, high consistency among members within each subtree group is ensured, reducing errors introduced by merging dissimilar subtrees. This precise and efficient clustering method lays a solid foundation for subsequent subtree merging and reconstruction, enabling the merged model to maintain detection performance while significantly reducing model size and storage and computational resource requirements, making it particularly suitable for resource-constrained automotive embedded environments.
[0066] Please see Figure 7 , Figure 7 A specific implementation of step S33 is shown below: S331: For each subtree group, calculate the average of the predicted output vectors of all subtrees within the subtree group, and use this average as the merged output vector of the subtree group. S332: Using the standard training dataset as input and the merged output vector as the fitting target, train a new shallow subtree to replace all the original subtrees within the subtree group, thus obtaining the reconstructed subtree.
[0067] Specifically, when processing each subtree group, the average of the predicted output vectors of all subtrees within the subtree group is first calculated as the merged output vector of the subtree group. This step aims to effectively integrate the prediction information of multiple weak subtrees within the subtree group, forming a unified target that can represent the overall prediction behavior of the subtree group. By calculating the average, the prediction bias or noise that may exist in individual subtrees can be effectively smoothed, thereby more stably capturing the collective knowledge of the group of subtrees. Specifically, this can be implemented in either of the following ways: One implementation is to obtain the predicted output vectors of all subtrees within the subtree group for each sample in the standard training dataset, then sum these predicted output vectors element-wise and divide by the number of subtrees to obtain the merged output vector corresponding to the sample. Another implementation is to assign different weights to each subtree within the subtree group based on the subtree's performance during training or its contribution to the overall model, and then calculate the weighted average of these predicted output vectors to more accurately reflect the importance of each subtree.
[0068] Building upon this, a new shallow subtree is trained using the standard training dataset as input and the merged output vector as the fitting target. This step aims to construct a simple yet effective alternative model that simulates the predictive capabilities of atomic tree groups based on the original input data and the integrated prediction target. Here, a "shallow subtree" refers to a subtree with fewer decision levels, exhibiting lower structural complexity and facilitating model compression. Specifically, this can be achieved in either of the following ways: One approach is to use a decision tree regression algorithm (e.g., CART) with features from the standard training dataset as input and the merged output vector as the regression target to train a decision tree with a preset maximum depth (e.g., 1 to 5 layers). Another approach is to train a single, depth-constrained tree within an existing gradient boosting framework (such as LightGBM or XGBoost) by configuring parameters (e.g., the `max_depth` parameter) to fit the merged output vector onto the standard training dataset.
[0069] Ultimately, this new shallow subtree replaces all the original subtrees within the subtree group, resulting in the reconstructed subtree. This step is crucial for model compression, significantly reducing the overall model size and complexity by replacing multiple original weak subtrees within a subtree group with a newly trained shallow subtree. Specifically, this can be achieved in either of the following ways: One approach is to directly add the newly trained shallow subtree to the model structure when constructing the target gradient boosting tree model, and remove all corresponding original subtrees from the model. Another approach is to maintain a model structure mapping table, updating references that previously pointed to multiple original subtrees within the subtree group to points to the newly trained single shallow subtree, so that during model inference, only the reconstructed subtree is used for prediction.
[0070] This application effectively addresses the information loss and reconstruction errors that may result from directly training new trees when clustering and merging weak subtree sets. Specifically, by calculating the average of the predicted output vectors of all subtrees within a subtree group as the merged output vector, this application can fully integrate the prediction information of all subtrees within the group, forming a stable and representative fitting target, avoiding bias caused by ignoring the diversity within the group. Based on this, using a standard training dataset as input and this merged output vector as the fitting target, new shallow subtrees are trained. This allows the new subtrees to directly learn and inherit the collective prediction behavior of the atomic tree group, ensuring that the reconstructed subtrees accurately represent the prediction capabilities of the atomic tree group while maintaining model compression. This method not only effectively reduces the model structure size, lowers storage overhead and computational latency, but also improves the accuracy and generalization ability of the compressed model while ensuring detection performance, making it more suitable for resource-constrained automotive embedded hardware deployments.
[0071] In a specific embodiment of weak child number screening, suppose there are N samples in the standard training set, and T trees in the model. For the t-th tree, Representation tree t for samples If the predicted value is given, then its predicted output vector in the sample space is... It can be represented as: (5); To determine the "prediction strength" of each subtree in the sample distribution, the contribution of the t-th tree is defined as follows: (6); Subsequently, all trees were sorted according to their contribution, and a selection ratio was set based on the contribution level. Trees with Ct below the contribution index are classified as weak contribution trees and categorized into the weak subtree set. (7); Conversely, the remaining subtrees form a set of strong subtrees: (8); The selected trees tend to have lower prediction strength for the samples, and the fluctuations in their prediction values have little impact on the overall prediction, making them suitable candidates for subsequent subtree merging. The trees that are retained are strong trees, with larger prediction amplitudes in the sample space, which dominate the overall prediction performance of the model.
[0072] In the tree merging and model reconstruction implementation example, for two subtrees Their predicted output vectors in the sample space are Then, the degree of their approximation is defined using cosine similarity: (9); when The closer it gets to 1, and In vector space, the closer the directions are, the more similar the prediction responses of the two trees to the samples, making them suitable for merging. Here, a greedy subtree merging strategy based on a similarity threshold is adopted, which merges the weak subtree sets... Divide the data into several non-overlapping subsets, and then merge the subtrees of different subsets. This is represented here in the following form: (10); in, It is represented as one of the subsets, and any subset. Mutually exclusive. For non-empty... Select one of the subtree vectors Construct a subtree group (11); in, As the similarity threshold, then... from Remove from the list and repeat the above process until all weak subtrees have been assigned, thereby generating multiple subtree groups.
[0073] In the subtree merging and model reconstruction implementation, for each merged subtree group, its merge output function is defined as: (12); Subsequently, a regression tree of limited depth was fitted onto the standard training set. To approximate the above merging function: (13); in, Represents the hypothesis space of the regression tree. It is used with Approximate fit of candidate regression tree functions. Finally, the reconstructed model can be expressed as: (14).
[0074] S4: Acquire the odor data of the electronic nose to be detected, and detect the odor data of the electronic nose to be detected through the target gradient boosting tree model to obtain the detection result.
[0075] Specifically, the process involves acquiring odor data from the electronic nose to be detected and then using a target gradient boosting tree model to perform odor detection, yielding a result. The odor data can be odor samples collected in real-time from the in-vehicle environment. Detection using a target gradient boosting tree model involves inputting the data into a model that has undergone quantized perception training and subtree merging and reconstruction. The model then outputs a predicted value, such as an odor intensity level or comfort score. The detection result can be a numerical value or a classification label, such as "no odor," "slight odor," "moderate odor," or "strong odor."
[0076] Please refer to Figure 8 As a response to the above Figure 1 The implementation of the method shown in this application provides an embodiment of an odor detection device based on a gradient boosting tree model. This device embodiment is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0077] like Figure 8 As shown, the odor detection device based on the gradient boosting tree model in this embodiment includes: a training data generation module 51, a quantization perception module 52, a subtree merging and reconstruction module 53, and an odor data detection module 54, wherein: The training data generation module 51 is used to acquire the raw odor data of the electronic nose, and to standardize the raw odor data to generate a standard training dataset. The quantization-aware module 52 is used to iteratively train the gradient boosting tree model based on the standard training dataset, and introduce a quantization-aware mechanism during the training process to adapt the model parameters of the gradient boosting tree model to the target quantization bit width and the input data, thereby generating the complete model and the prediction output of each subtree after quantization-aware training. The subtree merging and reconstruction module 53 is used to filter out a set of weak subtrees and a set of strong subtrees based on the prediction output of each subtree, perform similarity clustering and merging and reconstruction on the set of weak subtrees, and combine the set of strong subtrees with the merged and reconstructed subtrees to generate a target gradient boosting tree model. The odor data detection module 54 is used to acquire the odor data of the electronic nose to be detected, and to detect the odor data of the electronic nose to be detected through the target gradient boosting tree model to obtain the detection result.
[0078] Furthermore, the quantization sensing module 52 includes: The first training unit is used to perform the first round of training on the gradient boosting tree model based on the standard training dataset, so as to obtain the first round model and the set of node threshold parameters. The quantization parameter generation unit is used to calculate the first round of quantization parameters based on the numerical range of the target quantization bit width and the node threshold parameter set; A quantization unit is used to perform simulated quantization and dequantization using the standard training dataset and the set of node threshold parameters in the first round of quantization to obtain a quantized dataset. The complete model generation unit is used to retrain the first-round model iteratively based on the quantized dataset, so that the model parameters of the gradient boosting tree model are adapted to the target quantization bit width with the input data, and generate the complete model after quantization-aware training and the prediction output of each of the subtrees.
[0079] Furthermore, the complete model generation unit includes: The residual calculation subunit is used to calculate the predicted value of the first round model on the quantized dataset, and calculate the residual based on the predicted value and the true label; The current iteration model generates a sub-unit, which is used to train a new subtree on the first round model with the residual as the target and the quantized dataset, and update the first round model with the new subtree to obtain the current iteration model; The parameter set constitutes a sub-unit, which is used to extract the current node threshold of all subtrees in the current iterative model to form the parameter set; The quantization scaling factor calculation subunit is used to calculate the new round of quantization scaling factor and zero-point bias based on the global maximum and minimum values of the parameter set, and to perform simulated quantization and dequantization based on the quantization scaling factor and the zero-point bias to obtain a new quantized dataset. The model training subunit is used to retrain the model based on the quantized dataset to obtain the complete model after quantization-aware training and the prediction output of each subtree.
[0080] Furthermore, the subtree merging and reconstructing module 53 includes: The contribution calculation unit is used to calculate the contribution of each subtree based on the prediction output of each subtree, and to divide the set of weak subtrees and the set of strong subtrees according to the contribution. The subarray generation unit is used to calculate the similarity between the predicted output vectors of any two subtrees in the weak subtree set, and to use a greedy strategy to cluster the subtrees in the weak subtree set based on the similarity to obtain multiple subtree groups. The reconstruction unit is used to retrain a new shallow subtree for each subtree group, using the mean of the predicted output vectors of the subtrees in the subtree group as the target, to obtain the reconstructed subtree. The subtree combination unit is used to combine the set of strong subtrees with all the reconstructed subtrees to generate the target gradient boosting tree model.
[0081] Furthermore, the subarray generation unit includes: The cosine similarity calculation subunit is used to calculate the cosine similarity between the predicted output vectors of any two subtrees in the weak subtree set; The seed selection subunit is used to select any subtree from the set of weak subtrees as a seed, retrieve all subtrees whose cosine similarity is not lower than a preset similarity threshold, and form a new subtree group; The subtree removal subunit is used to remove all subtrees in the new subtree group from the weak subtree set and select another seed until the weak subtree set is empty, thus obtaining multiple subtree groups.
[0082] Furthermore, the reconfiguration unit includes: The average value calculation subunit is used to calculate the average value of the predicted output vectors of all subtrees in each subtree group, and use it as the merged output vector of the subtree group. The shallow subtree training unit is used to train a new shallow subtree by taking the standard training dataset as input and the merged output vector as the fitting target, so as to replace all the original subtrees in the subtree group and obtain the reconstructed subtree.
[0083] Furthermore, the training data generation module 51 includes: The raw odor data acquisition unit is used to acquire the multi-channel raw odor data collected by the electronic nose sensor array; The preprocessing unit is used to normalize the raw odor data so that the data of each channel of the raw odor data are within a preset value range, thus forming the standard training dataset.
[0084] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 9 , Figure 9 This is a basic structural block diagram of the computer device in this embodiment.
[0085] Computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected via a system bus. It should be noted that... Figure 9 Only a computer device 6 with three components—memory 61, processor 62, and network interface 63—is shown. However, it should be understood that implementing all shown components is not required; more or fewer components may be implemented alternatively. Those skilled in the art will understand that the computer device described herein is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0086] Computer devices can include desktop computers, laptops, handheld computers, in-vehicle computing devices, and cloud servers. These devices allow for human-computer interaction with users through keyboards, mice, remote controls, touchpads, or voice-activated devices.
[0087] The memory 61 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as the hard disk or memory of the computer device 6. In other embodiments, the memory 61 may also be an external storage device of the computer device 6, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 6. Of course, the memory 61 may also include both internal storage units and external storage devices of the computer device 6. In this embodiment, the memory 61 is typically used to store the operating system and various application software installed on the computer device 6, such as the program code of an odor detection method based on a gradient boosting tree model. In addition, memory 61 can also be used to temporarily store various types of data that have been output or will be output.
[0088] In some embodiments, processor 62 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. This processor 62 is typically used to control the overall operation of computer device 6. In this embodiment, processor 62 is used to run program code stored in memory 61 or process data, for example, to run the program code of the odor detection method based on the gradient boosting tree model described above, to implement various embodiments of the odor detection method based on the gradient boosting tree model.
[0089] The network interface 63 may include a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the computer device 6 and other electronic devices.
[0090] This application also provides another embodiment, namely, a computer-readable storage medium storing a computer program that can be executed by at least one processor to cause the at least one processor to perform the steps of the odor detection method based on the gradient boosting tree model described above.
[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of the various embodiments of this application.
[0092] Obviously, the embodiments described above are merely some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the scope of this application. This application can be implemented in many different forms; rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of protection of this application.
Claims
1. An odor detection method based on a gradient boosting tree model, characterized in that, include: The raw odor data of the electronic nose is acquired and standardized to generate a standard training dataset. The gradient boosting tree model is iteratively trained based on the standard training dataset, and a quantization-aware mechanism is introduced during the training process to adapt the model parameters of the gradient boosting tree model to the target quantization bit width of the input data, thereby generating the complete model after quantization-aware training and the prediction output of each subtree. Based on the predicted output of each subtree, a set of weak subtrees and a set of strong subtrees are selected. Similarity clustering and merging reconstruction are performed on the set of weak subtrees. The set of strong subtrees is combined with the merged and reconstructed subtrees to generate a target gradient boosting tree model. The odor data of the electronic nose to be detected is acquired, and the odor data of the electronic nose to be detected is detected by the target gradient boosting tree model to obtain the detection result; The process of filtering weak subtree sets and strong subtree sets based on the prediction output of each subtree, performing similarity clustering and merging reconstruction on the weak subtree sets, and combining the strong subtree sets with the merged and reconstructed subtrees to generate a target gradient boosting tree model includes: The contribution of each subtree is calculated based on the predicted output of each subtree, and the set of weak subtrees and the set of strong subtrees are divided according to the contribution. Calculate the similarity between the predicted output vectors of any two subtrees in the weak subtree set, and use a greedy strategy to cluster the subtrees in the weak subtree set based on the similarity to obtain multiple subtree groups; For each subtree group, a new shallow subtree is retrained to replace the subtree with the mean of the predicted output vectors of the subtrees in the subtree group, so as to obtain the reconstructed subtree. The set of strong subtrees is combined with all the reconstructed subtrees to generate the target gradient boosting tree model; For each subtree group, using the mean of the predicted output vectors of the subtrees in the subtree group as the target, a new shallow subtree is retrained to replace it, resulting in the reconstructed subtree, including: For each subtree group, the average of the predicted output vectors of all subtrees within the subtree group is calculated as the merged output vector of the subtree group; Using the standard training dataset as input and the merged output vector as the fitting target, a new shallow subtree is trained to replace all the original subtrees in the subtree group, resulting in the reconstructed subtree.
2. The odor detection method based on a gradient boosting tree model according to claim 1, characterized in that, The step involves iteratively training the gradient boosting tree model based on the standard training dataset, and introducing a quantization-aware mechanism during training to adapt the model parameters of the gradient boosting tree model to the target quantization bit width, generating the complete model after quantization-aware training and the prediction output of each subtree, including: The gradient boosting tree model is trained in the first round based on the standard training dataset to obtain the first round model and the set of node threshold parameters. The first round of quantization parameters are calculated based on the numerical range of the target quantization bit width and the node threshold parameter set; Simulated quantization and dequantization are performed using the standard training dataset with the first round of quantization parameters and the set of node threshold parameters to obtain the quantized dataset. Based on the quantized dataset, the first round of model is retrained iteratively to adapt the model parameters of the gradient boosting tree model to the target quantization bit width of the input data, thereby generating the complete model trained with quantization awareness and the prediction output of each subtree.
3. The odor detection method based on a gradient boosting tree model according to claim 2, characterized in that, The step of iteratively training the first-round model based on the quantized dataset, adapting the model parameters of the gradient boosting tree model to the target quantization bit width, and generating the complete model trained with quantization awareness and the prediction outputs of each subtree, includes: Calculate the predicted value of the first-round model on the quantized dataset, and calculate the residual based on the predicted value and the true label; Using the residual as the target, a new subtree is trained on the first round model based on the quantized dataset, and the new subtree is updated in the first round model to obtain the current iteration model; Extract the current node thresholds of all subtrees in the current iterative model to form a parameter set; Calculate the new round of quantization scaling factor and zero offset based on the global maximum and minimum values of the parameter set, and perform simulated quantization and dequantization based on the quantization scaling factor and the zero offset to obtain a new quantized dataset. The model is retrained based on the quantized dataset to obtain the complete model trained by quantization perception and the prediction output of each subtree.
4. The odor detection method based on a gradient boosting tree model according to claim 1, characterized in that, The similarity between the predicted output vectors of any two subtrees in the weak subtree set is calculated. A greedy strategy is used to cluster the subtrees in the weak subtree set based on the similarity, resulting in multiple subtree groups, including: Calculate the cosine similarity between the predicted output vectors of any two subtrees in the set of weak subtrees; Select any subtree from the set of weak subtrees as a seed, retrieve all subtrees whose cosine similarity is not lower than a preset similarity threshold, and form a new subtree group; Remove all subtrees in the new subtree group from the weak subtree set, and select another seed until the weak subtree set is empty, thus obtaining multiple subtree groups.
5. The odor detection method based on a gradient boosting tree model according to any one of claims 1 to 4, characterized in that, The process of acquiring raw odor data from the electronic nose and standardizing the raw odor data to generate a standard training dataset includes: Acquire the raw odor data from multiple channels collected by the electronic nose sensor array; The original odor data is normalized so that the data of each channel of the original odor data are within a preset value range, thus forming the standard training dataset.
6. An odor detection device based on a gradient boosting tree model, characterized in that, include: The training data generation module is used to acquire the raw odor data of the electronic nose, and to standardize the raw odor data to generate a standard training dataset. The quantization-aware module is used to iteratively train the gradient boosting tree model based on the standard training dataset, and introduces a quantization-aware mechanism during the training process to adapt the model parameters of the gradient boosting tree model to the target quantization bit width, thereby generating the complete model trained by quantization-aware and the prediction output of each subtree. The subtree merging and reconstruction module is used to filter out a set of weak subtrees and a set of strong subtrees based on the prediction output of each subtree, perform similarity clustering and merging and reconstruction on the set of weak subtrees, and combine the set of strong subtrees with the merged and reconstructed subtrees to generate a target gradient boosting tree model. The odor data detection module is used to acquire odor data of the electronic nose to be detected, and to detect the odor data of the electronic nose to be detected through the target gradient boosting tree model to obtain the detection result; The subtree merging and reconstruction module includes: The contribution calculation unit is used to calculate the contribution of each subtree based on the prediction output of each subtree, and to divide the set of weak subtrees and the set of strong subtrees according to the contribution. The subarray generation unit is used to calculate the similarity between the predicted output vectors of any two subtrees in the weak subtree set, and to use a greedy strategy to cluster the subtrees in the weak subtree set based on the similarity to obtain multiple subtree groups. The reconstruction unit is used to retrain a new shallow subtree for each subtree group, using the mean of the predicted output vectors of the subtrees in the subtree group as the target, to obtain the reconstructed subtree. A subtree combination unit is used to combine the set of strong subtrees with all the reconstructed subtrees to generate the target gradient boosting tree model; The reconstruction unit includes: The average value calculation subunit is used to calculate the average value of the predicted output vectors of all subtrees in each subtree group, and use it as the merged output vector of the subtree group. The shallow subtree training unit is used to train a new shallow subtree by taking the standard training dataset as input and the merged output vector as the fitting target, so as to replace all the original subtrees in the subtree group and obtain the reconstructed subtree.
7. A computer device, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the odor detection method based on the gradient boosting tree model as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the odor detection method based on a gradient boosting tree model as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method for predicting multi-factor landslide settlement by gradient lifting regression optimization model
CN119066498A