Method for modeling multi-modal soft measurement of fermentation process based on hidden markov modal division
By combining Hidden Markov Models (HMMs) and LightGBM, multimodal soft measurement modeling of the fermentation process was achieved. This solved the problems of difficulty in real-time measurement of key parameters during fermentation and poor adaptability of traditional models, improved prediction accuracy and model transparency, and provided a theoretical basis for process optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING UNIV OF CHEM TECH
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-05
AI Technical Summary
Key parameters during fermentation are difficult to measure accurately in real time. Traditional single-modal soft measurement models have poor adaptability, and cluster analysis methods lack time-series analysis capabilities, resulting in discontinuous modality division results that are difficult to conform to the gradual change pattern of the fermentation process.
A multimodal soft measurement modeling method based on Hidden Markov Models is adopted. Through data preprocessing, Hidden Markov Model parameter configuration and training, Viterbi algorithm decoding and LightGBM model construction, the modal division and stage-specific prediction of the fermentation process are realized. The interpretability of the model is improved by combining the SHAP analysis method.
It significantly improved the overall prediction accuracy and model adaptability of key parameters, enhanced the interpretability of the model, and provided reliable data-driven support for process optimization of fermentation.
Smart Images

Figure CN122157825A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of soft measurement modeling technology for fermentation processes, and particularly relates to a multimodal soft measurement modeling method for fermentation processes based on Hidden Markov Mode Division. Background Technology
[0002] Because key parameters such as product concentration during fermentation rely heavily on manual offline analysis, which introduces significant time lag and makes real-time, precise control of the fermentation process difficult, there is an urgent need to develop a precise soft-sensor prediction model as the demand for process precision continues to grow.
[0003] Traditional soft sensor models are mainly divided into mechanistic modeling and data-driven modeling. Mechanistic models are built upon first principles such as fermentation kinetics, mass balance, and energy balance, aiming to describe the physicochemical mechanisms of the process, such as the Monod equation, providing a solid foundation for fermentation process modeling. Although mechanistic models can fit experimental data well under specific conditions, they inevitably fall short in describing complex nonlinear relationships and suffer from a heavy reliance on in-depth understanding of the process mechanisms. Data-driven methods, on the other hand, do not rely on explicit modeling of the precise internal mechanisms such as fermentation kinetics and mass-energy conservation equations. Data-driven methods achieve soft sensing of key variables by mining and establishing functional relationships between variables. With the development of advanced data analysis techniques such as machine learning, data-driven soft sensor methods are showing increasing advantages and potential in handling complex and nonlinear fermentation process data.
[0004] Data-driven soft sensor model development requires no in-depth biological knowledge and is highly efficient. However, traditional single-modal soft sensor modeling also faces challenges such as weak handling of complex multimodal scenarios and poor interpretability. To improve the accuracy of soft sensor models, researchers have proposed re-modeling the fermentation process by dividing it into stages, thereby further enhancing the model's precision.
[0005] The mainstream methods for dividing fermentation processes into stages mainly include cluster analysis-based methods and modeling-based identification methods. Cluster analysis-based methods, which seek the inherent relationships between data samples to achieve stage division, are widely used in fermentation process stage division. Common clustering methods include K-Means, FCM, and DPC. However, most cluster analysis methods have two problems: First, they have poor temporal analysis capabilities. Traditional clustering relies solely on the similarity of data distribution, ignoring the dynamic temporal characteristics of fermentation data. Although some improved algorithms introduce temporal weights, their definition of temporal changes is highly subjective and lacks universality, making them difficult to apply widely. Second, they suffer from modal disorder. Clustering methods cannot guarantee the continuous monotonicity of cluster division, making it difficult to match the temporal continuity of the fermentation process. This leads to overlapping and misclassification of stages, failing to reflect the gradual changes in the actual fermentation process.
[0006] The modeling-based identification method establishes a multivariate statistical analysis model to extract the changes in data features in the time domain. The Hidden Markov Model used in this invention is a classic time series model. It describes the switching probability between modes through the state transition matrix, ensuring the continuity and rationality of the mode sequence in time. Summary of the Invention
[0007] To address the urgent need for accurate soft measurement models in fermentation processes due to the difficulty in measuring key parameters online, and the poor adaptability of traditional single-modal soft measurement models caused by fermentation state switching, this invention discloses a multimodal soft measurement modeling algorithm for fermentation processes based on Hidden Markov Mode Partitioning.
[0008] This invention proposes a multimodal soft-sensor modeling method for fermentation processes based on a hidden Markov model, characterized by the following steps:
[0009] Step 1: Data preparation and preprocessing: Collect historical datasets of the fermentation process, preprocess the historical datasets to eliminate the influence of different physical dimensions and numerical magnitudes of the process parameters; divide the preprocessed datasets into training sets and test sets according to a preset ratio;
[0010] Step 2: Hidden Markov Model Parameter Configuration and Initialization: Based on the process characteristics of the fermentation process and the algorithm optimization objective, configure the hyperparameters of the Hidden Markov Model and initialize the model parameters λ=(π, A, B), where π is the initial state probability distribution, A is the state transition matrix, and B is the observation probability distribution;
[0011] Step 3: Hidden Markov Model Parameter Training Based on Expectation-Maximization Algorithm: The Hidden Markov Model is iteratively trained using the Expectation-Maximization Algorithm. The probability distribution of each hidden state at each time step is calculated through the E-step, and the model parameters π, A, and B are re-estimated through the M-step until the model likelihood function converges, thus obtaining the optimized Hidden Markov Model parameters.
[0012] Step 4: Fermentation process modal segmentation based on Viterbi algorithm - The trained Hidden Markov Model is applied to the test set or online collected fermentation process data. The Viterbi algorithm is used to decode the hidden state sequence to obtain the fermentation modal label corresponding to each time step, thereby realizing the dynamic stage segmentation of the fermentation process.
[0013] Step 5: Multimodal soft sensor modeling based on modality segmentation—Based on the modality labels obtained in Step 4, the original dataset is divided into multiple stage-specific subsets; for each modality, a soft sensor sub-model based on LightGBM is constructed, and differentiated hyperparameter configuration and model training are performed to predict key quality variables in the fermentation process;
[0014] Step 6: SHAP-based contribution analysis of fermentation process parameters—Based on the prediction results of the LightGBM soft sensor model for each modality, the contribution of each input feature to the prediction results is calculated using the SHAP interpretability analysis method. This quantifies the influence of each process parameter at different fermentation stages and in the overall process, providing interpretable basis for process optimization.
[0015] This invention also discloses a multimodal soft-sensor modeling system for fermentation processes based on a hidden Markov model, characterized in that it includes:
[0016] Data acquisition and preprocessing module: used to collect historical datasets of the fermentation process, standardize and preprocess the data to eliminate the influence of units, and divide the dataset into training and testing sets;
[0017] Hidden Markov Model Construction and Training Module: This module is used to configure the hyperparameters of the Hidden Markov Model according to the characteristics of the fermentation process, initialize the model parameters, and train the model using the expectation-maximization algorithm to obtain the optimized Hidden Markov Model parameters.
[0018] Fermentation process modality segmentation module: This module applies the trained Hidden Markov Model to online or offline fermentation process data, and uses the Viterbi algorithm to decode the modality label at each sampling time, thereby realizing dynamic stage identification of the fermentation process.
[0019] Multimodal soft measurement modeling module: Based on the modality division results, it constructs LightGBM soft measurement sub-models for each fermentation stage, configures differentiated hyperparameters and trains them to predict key quality variables in real time;
[0020] The LightGBM soft measurement submodel was chosen because it is an efficient gradient boosting tree framework that greatly improves training efficiency while ensuring prediction accuracy, and is especially suitable for processing high-dimensional, time-series data generated during the fermentation process.
[0021] Interpretability Analysis Module: Based on the prediction results of each modality LightGBM model, it uses the SHAP method to calculate the contribution of input features, generate feature importance analysis and visualization results, and provide decision support for process control.
[0022] Beneficial effects
[0023] (1) This invention proposes a method for modal segmentation of fermentation process based on Hidden Markov Model. In view of the multimodal characteristics of fermentation process, the method utilizes the state modeling and decoding capability of Hidden Markov Model for multivariate time series data to adaptively identify the inherent stage evolution law of the process, realize modal identification and stage segmentation of fermentation process, and lay the foundation for establishing a stage-specific multimodal soft measurement model.
[0024] (2) In view of the significant differences in dynamic characteristics among different modes of the fermentation process, this invention proposes a stage-specific modeling algorithm based on LightGBM. This algorithm, based on the mode segmentation results of the Hidden Markov Model, constructs an independent prediction model for each mode according to the process characteristics and dynamic behavior of each mode during fermentation. It fully considers the multimodal characteristics of the fermentation process, significantly improving the overall prediction accuracy and model adaptability of key parameters.
[0025] (3) Based on the SHAP interpretable computation method, this invention deeply analyzes the contribution of key process variables in different fermentation stages and the overall fermentation process to the prediction results, revealing the intrinsic correlation and mechanism of action of the variables, and providing reliable data-driven support for process optimization and precise control. By generating feature importance ranking and contribution distribution maps, not only is the interpretability and transparency of the model enhanced, but also theoretical references are provided for process optimization. Attached Figure Description
[0026] Figure 1 The flowchart shows the modality partitioning algorithm based on Hidden Markov Models.
[0027] Figure 2 Flowchart of a multimodal soft measurement modeling method based on hidden Markov mode partitioning results;
[0028] Figure 3 Overall flowchart of a multimodal soft measurement algorithm for fermentation process based on Hidden Markov Mode Division;
[0029] Figure 4 The modal segmentation results of the zinc-enriched yeast fermentation process based on the hidden Markov model are shown in the figure.
[0030] Figure 5 A comparison chart of the trends between predicted and actual values from a soft measurement model for zinc-enriched yeast.
[0031] Figure 6 Bar charts showing the importance of SHAP features for each of the 1-3 modes of zinc-enriched yeast fermentation;
[0032] Figure 7 SHAP summary diagrams for each of the 1-3 modes of zinc-enriched yeast fermentation. Detailed Implementation
[0033] This invention proposes a mode partitioning method based on Hidden Markov Models (HMMs). Process parameters such as dissolved oxygen concentration and exhaust gas content during fermentation can be monitored online, corresponding to the observed sequences in the HMM. However, key state variables such as product concentration are difficult to detect online; this characteristic corresponds to the hidden sequences in the HMM. The HMM algorithm flowchart is shown below. Figure 1 As shown.
[0034] This invention constructs a multimodal soft sensor framework, establishing stage-specific LightGBM multimodal soft sensor models for different modes of the fermentation process (i.e., the result labels of mode segmentation based on Hidden Markov Models). Each sub-model employs differentiated hyperparameter configurations according to the process characteristics of the corresponding stage, fully considering the dynamic characteristics differences of each stage of the fermentation process, significantly improving the overall prediction accuracy of key parameters. The multimodal soft sensor algorithm flowchart is shown below. Figure 2 As shown.
[0035] This invention introduces the SHAP interpretability analysis method, effectively solving the problem of insufficient interpretability in the application of machine learning black-box models in fermentation processes. This invention fully considers the needs of data analysts for transparency in model decision-making, as well as the practical needs of process engineers for understanding the contribution of each process parameter. By calculating the SHAP contribution of each process variable to the prediction results, it profoundly reveals the intrinsic interaction mechanism between process parameters such as dissolved oxygen concentration and exhaust gas content and state variables such as product concentration during fermentation. Unlike the traditional single-model SHAP analysis of soft sensor models throughout the entire process, this invention analyzes the contribution of variables at different stages of fermentation, significantly enhancing the interpretability and reliability of the model, and providing important theoretical basis and practical guidance for process optimization. The overall algorithm flowchart is shown below. Figure 3 As shown.
[0036] A multimodal soft sensor modeling algorithm for fermentation processes based on Hidden Markov Models (HMMs) is first used to classify the fermentation process into modes. Based on the mode classification results, soft sensor models corresponding to the characteristics of different stages of the fermentation process are constructed to achieve online prediction of key parameters. The algorithm steps are as follows:
[0037] Step 1: Data Preparation and Preprocessing
[0038] Based on historical datasets of the fermentation process, a Hidden Markov Model (HMM) was constructed, dividing the batch data of the fermentation process into different modalities. To train the HMM, the dataset was divided into training and test sets in a reasonable proportion.
[0039] The historical dataset is preprocessed to eliminate the influence of different physical dimensions and numerical magnitudes of the parameters. This algorithm uses a Z-score-based standardization algorithm to preprocess the historical dataset. This algorithm calculates the sample mean and standard deviation of each feature dimension and converts the original data into a standard normal distribution with a mean of zero and a variance of one. The standardization formula is shown in Equation (1).
[0040] (1)
[0041] Where Z represents the standardized feature value, X represents the original feature value, μ represents the sample mean of this feature dimension in the dataset, and σ represents the sample standard deviation of this feature dimension in the dataset. This preprocessing method effectively eliminates the interference of different physical dimensions on model training while preserving the original data distribution characteristics, which is conducive to the model more accurately uncovering the inherent laws and data characteristics of multivariate coupling relationships in the fermentation process. Standardization not only improves the model's convergence speed but also enhances its ability to capture data features, laying a good data foundation for subsequent multimodal partitioning.
[0042] Step 2: Configuration and initialization of internal parameters based on the Hidden Markov Model
[0043] Based on the technological characteristics of the fermentation process and the algorithm optimization objectives, the key hyperparameters of the Hidden Markov Model are configured. The setting of hyperparameters is based on the need to balance the algorithm's global search capability with local convergence efficiency, and is typically determined by optimizing the data size and complexity of the observed sequence, combined with pre-experiments or prior knowledge. Through reasonable parameter configuration, the algorithm can be effectively guided to perform efficient searches in the solution space, increasing the likelihood of obtaining the globally optimal model parameters.
[0044] The hidden state number N is set using an empirical or uniformly distributed initialization strategy, and the model parameters are initialized accordingly. Where π represents the initial probability distribution, and in this algorithm represents the probability of the fermentation process starting from each state; A represents the state transition matrix, A={ } represents the probability of transitioning from state i to state j, and the sum of each row is 1, i.e. In this algorithm, B represents the transition probability between fermentation states; B represents the observation probability distribution, B={ } represents the probability distribution of the observations in state j, and in this algorithm, it represents the probability distribution of the observations in each state of the fermentation process. This represents the probability of transitioning from fermentation state i to state j, reflecting the transition pattern of fermentation stages; Let be the probability of observing sequence k under fermentation state j, describing the process characteristics of each stage; N is the total number of hidden states.
[0045] Step 3: Training Hidden Markov Model Parameters Based on Expectation-Maximization (EM) Algorithm
[0046] In the training of Hidden Markov Models, the model parameters are iteratively optimized using the Expectation-Maximization (EM) algorithm. The "E-step" and "M-step" are well-known common-sense terms in the fields of machine learning and statistical learning, and are standard components of the Expectation-Maximization algorithm.
[0047] The Expectation Maximization (EM) algorithm consists of two steps: the E-step (expectation step) calculates the probability distribution of each fermentation state at each time point given the current model parameters. This is equivalent to "soft partitioning" the fermentation process, accurately capturing the stage transition characteristics of the fermentation process, as shown in Equation 2; the M-step (maximization step) uses the state membership probabilities (γ and p) calculated in the E-step as weights to perform weighted estimation of the model parameters, as shown in Equation 3. The specific steps are as follows:
[0048] (2)
[0049] (3)
[0050] in Let be the probability of being in fermentation state i at time t, reflecting the stage membership degree of the fermentation process; Forward probability, the probability of the observed sequence up to time t; For backward probability, the probability of the observation sequence from time t to the end; Let be the probability of transitioning from state i to state j; T be the total duration. Let be the probability of transitioning from fermentation state i to state j at time t.
[0051] The core of this algorithm is to evaluate the interpretability of each new set of model parameters for actual fermentation data. For each iteration, the new parameter solution is used to calculate its corresponding likelihood value P(O|λ). In this embodiment, this value represents the probability of the observed entire batch of sensor data sequence O occurring under the currently assumed fermentation process stage division and parameter settings. A higher likelihood value means that the state evolution path and observation patterns described by the model closely match the actual fermentation process, resulting in optimized hidden Markov model parameters. .
[0052] Step 4: Fermentation process modal partitioning model based on Viterbi algorithm
[0053] After obtaining the parameters of the trained model, the Viterbi algorithm is used to decode the hidden state sequence in order to achieve state estimation for the test set or online input data.
[0054] The Viterbi algorithm is a dynamic programming algorithm used to solve the decoding problem of Hidden Markov Models (HMMs). Its core task is: given an observation sequence O and a trained HMM... Find the hidden state sequence that is most likely to have produced the observed sequence. The algorithm principle is shown in Equation 4. The algorithm execution consists of two steps: forward recursion and delayed backtracking. The forward recursion algorithm is based on the real-time observation sequence and dynamically calculates the probability of the optimal path to each fermentation state at each moment. The optimal path is the stage evolution sequence that, from the model's perspective, can most reasonably explain the changes in all sensor readings from the start of fermentation to the current moment. Based on historical observation information (such as trends of decreasing dissolved oxygen and increasing carbon dioxide in exhaust gas), combined with the observation data within the window, the algorithm determines which stage the current moment is more likely to be in and records the source state of the optimal path. The algorithm principle is shown in Equation 5. After the recursion, the delayed backtracking algorithm backtracks according to the stored path pointers to determine the optimal state at the current moment. The algorithm principle is shown in Equation 6.
[0055] (4)
[0056] (5)
[0057] (6)
[0058] in, For hidden sequences, For the most likely hidden sequence, Here are the model parameters, and O represents the observation sequence; This represents the maximum probability that the system will be in state j along the optimal path at time t; O t The observed value at time t, i.e., the sensor reading. Let be the probability of transitioning from state i to state j; Let be the probability of observing the observation sequence k in state j; The optimal predecessor state of state j at time t.
[0059] The algorithm calculates the maximum probability path probability for each state at each time step through forward recursion and records path backtracking information. Finally, it determines the state sequence with the highest probability in the entire observation sequence through backward tracing.
[0060] Based on the application of the Viterbi algorithm for mode segmentation of the fermentation process described above, the online reading sequences of sensors in the test set or fermentation process are read to infer the stage of the fermentation process, providing a reference for soft measurement modeling and process optimization.
[0061] The state sequences decoded by the Viterbi algorithm are post-processed and optimized to enhance their physical plausibility and subsequent interpretability. The processing mainly includes two core steps: First, a minimum duration constraint is applied to merge state fragments with excessively short durations or those inconsistent with the kinetics of the fermentation process into adjacent stable modes, ensuring that each identified mode has a physically plausible duration. Based on this constraint, state labels are remapped, and mode labels are renumbered according to the order in which states first appear on the timeline, thus matching the model partitioning results.
[0062] Step 5: Multimodal soft measurement modeling based on mode partitioning
[0063] Based on the multimodal segmentation results, stage-specific soft measurement models for each modality are constructed. According to the modality segmentation results, a corresponding modality label is assigned to each modality. Dedicated LightGBM sub-models for different modalities are established for soft measurement prediction. The dataset is a stage-labeled dataset based on Hidden Markov Model modality segmentation. During model training, the dataset is divided into training and test sets in an appropriate ratio. The soft measurement prediction models for each modality are trained using the training set, and the model performance is validated using the test set.
[0064] During model training, each modality's LightGBM model employs differentiated hyperparameter combinations to adapt to the process characteristics and data distribution patterns of that modality. Hyperparameters include the maximum tree depth, number of leaf nodes, and learning rate, whose values are independently optimized based on the data characteristics of each modality. For example, for rapidly changing modalities, a larger learning rate is typically required to quickly track the dynamic process, coupled with a smaller maximum tree depth to prevent overfitting; while for modalities with stable changes, a smaller learning rate and a deeper tree structure can be used to improve prediction accuracy. The model training process employs an early stopping strategy and cross-validation. By setting the number of early stopping iterations, training is automatically terminated when the model performance no longer improves over several consecutive iterations, preventing overfitting and ensuring good generalization ability. The model input consists of standardized, easily measurable process parameters (such as dissolved oxygen concentration and exhaust gas content), and the output is the predicted value of the corresponding key quality variable (such as product concentration).
[0065] To evaluate model performance, a multi-dimensional evaluation system was constructed, including root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²), and validated on an independent test set.
[0066] Step 6: Contribution analysis of various modal parameters during fermentation
[0067] Based on the prediction results of the constructed modal soft measurement models, this study uses the SHAP interpretable framework to analyze the feature contribution. By calculating the SHAP value of each input feature to the model prediction, the feature contribution and influence direction are quantified.
[0068] SHAP value analysis is conducted from two dimensions: local and global. At the local level, by analyzing the SHAP values of each variable within each fermentation mode, the dynamic influence mechanism of key process parameters on product accumulation at that stage is revealed. At the global level, by synthesizing the SHAP value distribution of all samples, the overall contribution trend of each parameter to key quality variables throughout the fermentation process is assessed. Through SHAP analysis, not only can the dominant process parameters and their local effects in different fermentation stages be identified, but their global impact on the entire fermentation process can also be clarified. This provides a quantitative reference for understanding the multimodal process characteristics of fermentation and for optimizing process control.
[0069] The original SHAP theoretical formula, in principle, requires retraining the model for each feature subset S when calculating the predicted value, leading to an exponential increase in computational complexity with the number of features. For the soft measurement model built based on the LightGBM model, this patent uses the TreeSHAP algorithm to calculate the SHAP value. This algorithm is a highly efficient and accurate interpretation method specifically designed for tree models. Its core lies in avoiding enumeration of feature subsets and model retraining by analyzing the structure of the pre-trained tree model, thereby calculating the SHAP value in polynomial time. The key to the algorithm is the efficient reconstruction of the calculation of the predicted value f(S) of the feature subset in the basic SHAP formula, the specific calculation principle of which is shown in Equation 7.
[0070] (7)
[0071] Where T represents a single decision tree in the tree ensemble model; v is an internal node of decision tree T; It is the set of nodes in tree T used for splitting feature i; These are the path-dependent weights for the order in which features appear and their interactions; is the contribution of feature i at node v to the model prediction; M is the total number of trees.
[0072] SHAP value analysis reveals the mechanisms by which key process parameters affect product synthesis at different fermentation stages from both local and global perspectives. By quantifying and visualizing the contribution of each parameter, the interpretability of the model is significantly enhanced. This method not only identifies the dominant parameters and their influence patterns at each stage but also provides a basis for understanding the overall role of parameters in multi-stage fermentation, thus offering reliable data-driven support for process optimization and precise control.
[0073] The proposed HMM-LightGBM hybrid modeling framework constructs a complete multimodal soft measurement system for fermentation processes. Through the aforementioned process, this method builds a multimodal soft measurement system suitable for fermentation processes. Based on Hidden Markov Models (HMMs), unsupervised fermentation mode segmentation is achieved, and coupled with LightGBM to establish stage-specific prediction models. This not only significantly improves the accuracy of online prediction of key parameters but also, through interpretability analysis, reveals the key process characteristics and control laws of different fermentation stages from a data-driven perspective, thus providing a reliable theoretical reference for the precise sensing and optimized control of fermentation processes.
[0074] Example 1
[0075] This embodiment is based on the actual production of zinc-enriched yeast fermentation in a factory. It uses a multimodal soft measurement modeling method for the fermentation process based on Hidden Markov Model (HMM) mode division. First, the fermentation process is divided into modes using a HMM. Based on the mode division results, a soft measurement model of the fermentation process corresponding to the characteristics of different stages is constructed to achieve online prediction of key parameters.
[0076] Due to limitations in experimental conditions, this study selected five batches of zinc-enriched yeast fermentation data with superior results to systematically validate the proposed method.
[0077] The dataset partitioning follows these principles: two batches are selected for training the Hidden Markov Model (HMM) to complete model parameter estimation; three batches are selected to form the state label set, which is then input into the trained HMM for state decoding to obtain data with stage division labels; finally, the three batches of state label sets are divided into a training set (two batches) and a test set (one batch) for building and evaluating the multimodal soft measurement model.
[0078] The specific implementation steps are as follows:
[0079] Step 1: Data preparation and preprocessing based on zinc-enriched yeast fermentation
[0080] Data preprocessing was performed on the historical dataset of zinc-enriched yeast fermentation to eliminate the influence of different physical dimensions and numerical magnitudes on various parameters monitored online during zinc-enriched yeast fermentation, such as dissolved oxygen and exhaust gas content. This algorithm employs a Z-score-based standardization algorithm to preprocess the historical dataset. While preserving the original data distribution characteristics, it effectively eliminates the interference of different physical dimensions on model training, which is beneficial for the model to more accurately uncover the inherent laws and data characteristics of multivariate coupling relationships in the zinc-enriched yeast fermentation process. The Z-score standardization method is used to preprocess multi-source process parameters, eliminating dimensional differences, improving data consistency, and providing high-quality input for subsequent modality segmentation and modeling.
[0081] Step 2: Configuration and initialization of internal parameters based on the Hidden Markov Model
[0082] A Hidden Markov Model (HMM) is constructed, dividing the fermentation process into two modes based on technological knowledge. According to the technological characteristics of zinc-enriched yeast fermentation and the algorithm optimization objective, key hyperparameters of the HMM are configured, including the number of iterations n; model parameters are initialized. Where π represents the initial probability distribution, which in this embodiment represents the probability of starting the zinc-enriched yeast fermentation process from each state; A represents the state transition matrix, which in this embodiment represents the transition probability between the zinc-enriched yeast fermentation states; B represents the observation probability distribution, which in this embodiment represents the probability distribution of the observed values in each state of the zinc-enriched yeast fermentation process; and the number of hidden states N in the Hidden Markov Model is set to 2.
[0083] Step 3: Training Hidden Markov Model Parameters Based on Expectation-Maximization (EM) Algorithm
[0084] The Hidden Markov Model was trained using zinc-rich yeast fermentation data. The model training was achieved through the Expectation-Maximization (EM) algorithm for parameter reestimation, and the model parameters were trained using the Expectation-Maximization (EM) algorithm.
[0085] In the model training for the zinc-enriched yeast fermentation process, the algorithm calculates the probability distribution of each hidden state at each time step of the fermentation process given the current model parameters in the E-step (expectation step). This essentially performs a "soft partitioning" of the fermentation stages based on current process knowledge, quantifying the probability of the process being in different states. In the M-step (maximization step), the algorithm uses the stage membership probabilities (γ and p) obtained in the E-step as weights to re-estimate the model parameters. This is equivalent to iteratively learning the transition rules between fermentation states (state transition matrix A) and the typical characteristics of process parameters (such as dissolved oxygen concentration and exhaust gas content) at each stage (observation probability distribution B) based on the results of the "soft partitioning". The EM iteration process is executed 150 times (50-200 times), or continues until the change in the model likelihood function value is less than the threshold and converges. Based on the above steps, the parameters of the hidden Markov model that conform to this experiment are obtained. .
[0086] Step 4: Application of the fermentation process modal partitioning model based on the Viterbi algorithm
[0087] After obtaining the parameters of the Hidden Markov Model (HMM) trained and optimized for the zinc-enriched yeast fermentation process, this model was applied to online monitoring and batch analysis. The test set (including process variables such as dissolved oxygen concentration and exhaust gas concentration) of the time-series data or historical datasets collected online by sensors in the fermenter was standardized to form the observation sequence input model.
[0088] In the specific implementation process, for online real-time monitoring, a Viterbi algorithm with a fixed time window is used to decode the sequence and infer the most likely hidden fermentation mode corresponding to each sampling moment. Under the premise of allowing a fixed time delay window, the hidden state sequence with the highest probability at the current moment is found in real time using the observation information within a finite time window.
[0089] The algorithm execution consists of two steps: forward recursion and delayed backtracking. The forward recursion algorithm, based on real-time observation sequences, dynamically calculates the probability of the optimal path to each fermentation state at each moment. The optimal path, in the model's view, is the stage evolution sequence that most reasonably explains the changes in all sensor readings from the start of fermentation to the current moment. Based on historical observation information (e.g., trends of decreasing dissolved oxygen and increasing carbon dioxide in exhaust gas), combined with observation data within the window, the algorithm determines which stage the current moment is most likely in and records the source state of the optimal path. The delayed backtracking algorithm, after the forward recursion, backtracks based on the stored path pointers to determine the optimal state at the current moment. The design ensures the accuracy of the state estimation while remaining fully acceptable within the process response timescale of zinc-enriched yeast fermentation, meeting the real-time requirements of online monitoring.
[0090] Based on the above-described method, real-time sensor data can be converted into a stage sequence with clear fermentation process significance in zinc-enriched yeast fermentation, enabling the output of the current fermentation stage status and thus identifying the fermentation process online. This provides key input for subsequent stage-specific soft measurement modeling and real-time process optimization.
[0091] Post-processing optimization is performed on the state sequences decoded by the Viterbi algorithm to enhance their physical rationality and subsequent interpretability. This processing mainly targets the kinetic characteristics of zinc-enriched yeast fermentation, ensuring that the mode partitioning results conform to its technological laws. The post-processing process includes the following two core steps: First, a minimum duration constraint is applied to merge state fragments with excessively short durations or those that do not conform to the kinetic characteristics of the fermentation process into adjacent stable modes, ensuring that each identified mode has a physically reasonable duration; second, state labels are remapped based on the partitioning results, and mode labels are numbered according to the order in which the states first appear on the time axis.
[0092] After this processing, the final multimodal partitioning results with clear technological significance are output. These results not only provide accurate state labels for subsequent phased soft sensor modeling, but can also be directly used in production monitoring systems to indicate the fermentation process in real time, providing a reliable basis for process optimization and precise control. The modal partitioning results are shown in the figure below. Figure 4 As shown.
[0093] Step 5: Multimodal soft measurement modeling based on mode partitioning
[0094] Based on the multimodal segmentation results, dedicated soft measurement models are constructed for each modality. Modality labels are assigned to each modality according to the segmentation results. Dedicated LightGBM models are built for soft measurement prediction under different modalities. The dataset is a stage-labeled dataset based on Hidden Markov Model modality segmentation.
[0095] Due to limitations in experimental conditions, three batches of datasets from the zinc-rich yeast fermentation process were selected to train the multimodal soft measurement model. The datasets were divided into training and testing sets, with two batches serving as the training set and one batch as the testing set.
[0096] During model training, each modality of the LightGBM model employs a differentiated combination of hyperparameters to adapt to the process characteristics and data distribution patterns of that modality. Hyperparameters include the maximum tree depth, number of leaf nodes, and learning rate, whose values are independently optimized based on the data characteristics of each modality. An early stopping strategy and cross-validation method are used during model training. By setting the number of early stopping rounds (30–50 rounds), training automatically terminates when the validation set performance no longer improves over several consecutive iterations, preventing overfitting and ensuring the model has good generalization ability. The model input consists of standardized, easily measurable process parameters (such as dissolved oxygen and tail gas content), and the output is the predicted value of the corresponding key quality variable (such as product zinc concentration).
[0097] To evaluate model performance, a multi-dimensional evaluation system was constructed, including root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²), and validated on an independent test set. Experimental results show that, compared with the traditional global single model, this multimodal modeling method significantly improves both prediction accuracy and generalization ability. A comparison of the trends between the predicted and actual values of the soft sensor model is shown in the figure below. Figure 5 As shown.
[0098] Step 6: Contribution analysis of various modal parameters during fermentation
[0099] Based on the prediction results of the constructed soft sensor model for each mode of zinc-enriched yeast fermentation, this study uses the SHAP interpretable framework to analyze the feature contribution. By calculating the SHAP value of each input feature to the model prediction, the feature contribution and influence direction are quantified.
[0100] SHAP value analysis is conducted from both local and global dimensions: at the local level, by analyzing the SHAP values of various variables within the zinc-enriched yeast fermentation modality, the dynamic influence mechanism of key process parameters on zinc accumulation in the fermentation product at this stage is revealed; at the global level, by synthesizing the SHAP value distribution of all samples, the overall contribution trend of each parameter to zinc accumulation in the product throughout the entire zinc-enriched yeast fermentation process is assessed. Through SHAP analysis, not only can the dominant process parameters and their local effects in each stage of zinc-enriched yeast fermentation be identified, but their global impact on the complete zinc-enriched yeast fermentation process can also be clarified. This provides a quantitative reference for understanding the process characteristics of each modality in zinc-enriched yeast fermentation and for optimizing process control.
[0101] This method can accurately identify the dominant process parameters affecting microbial synthesis and their mechanisms of action at different fermentation stages. The analysis results are visualized using SHAP analysis plots, significantly enhancing the model's interpretability and providing reliable decision support for precise control of the fermentation process. SHAP analysis plots for each modality are shown below. Figure 6 As shown.
[0102] The established multimodal soft-sensing modeling method was applied to the monitoring and optimization of zinc-enriched yeast fermentation. In practical applications, the trained model was deployed in a fermentation process monitoring system to process online data such as dissolved oxygen and exhaust gas content in real time. Fermentation stages were identified based on a Hidden Markov Model (HMM), and the corresponding stage-specific LightGBM model was then invoked to achieve online soft-sensing of the zinc-enriched yeast fermentation process. This model demonstrated good predictive performance and stage adaptability in multiple fermentation batches, providing process engineers with real-time and reliable estimates of key quality parameters.
[0103] By implementing the above process systematically, this method proposes a multimodal soft measurement algorithm suitable for zinc-enriched yeast fermentation, which realizes high-precision online prediction of key parameters. Through interpretable mode division and feature analysis, it reveals the key process characteristics and control laws of different stages of zinc-enriched yeast fermentation.
[0104] This invention leverages the ability of Hidden Markov Models (HMMs) to model sequential states and capture state transition patterns, dividing the fermentation process into modalities. For each mode, a LightGBM sub-model is constructed to learn the nonlinear dynamic characteristics of each stage. This effectively overcomes the limitations of insufficient accuracy in single-modal soft-sensor models and the poor time-series analysis capabilities of traditional clustering methods. Furthermore, this invention provides an effective technical solution for optimizing fermentation process control and increasing yield by using readily measurable process parameters (such as dissolved oxygen concentration and exhaust gas content) to estimate key state variables (such as product concentration) that are difficult to detect online in real time. It has significant engineering application value.
[0105] The basic principles, main features, and advantages of the present invention have been shown and described above. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A multimodal soft-sensor modeling method for fermentation processes based on hidden Markov models, characterized in that, Includes the following steps: Step 1: Data preparation and preprocessing: Collect historical datasets of the fermentation process, and preprocess the historical datasets to eliminate the influence of different physical dimensions and numerical magnitudes on the parameters of each process; The preprocessed dataset is divided into training and testing sets according to a preset ratio; Step 2: Hidden Markov Model Parameter Configuration and Initialization: Based on the process characteristics of the fermentation process and the algorithm optimization objective, configure the hyperparameters of the Hidden Markov Model and initialize the model parameters λ=(π, A, B), where π is the initial state probability distribution, A is the state transition matrix, and B is the observation probability distribution; Step 3: Hidden Markov Model Parameter Training Based on Expectation-Maximization Algorithm: The Hidden Markov Model is iteratively trained using the Expectation-Maximization Algorithm. The probability distribution of each hidden state at each time step is calculated through the E-step, and the model parameters π, A, and B are re-estimated through the M-step until the model likelihood function converges, thus obtaining the optimized Hidden Markov Model parameters. Step 4: Fermentation process modality segmentation based on Viterbi algorithm: The trained Hidden Markov Model is applied to the test set or online collected fermentation process data. The Viterbi algorithm is used to decode the hidden state sequence to obtain the fermentation modality label corresponding to each time step, thereby realizing the dynamic stage segmentation of the fermentation process. Step 5: Multimodal soft measurement modeling based on modality segmentation—Based on the modality labels obtained in Step 4, the original dataset is divided into multiple stage-specific subsets; For each modality, a soft sensor sub-model based on LightGBM was constructed, and differentiated hyperparameter configuration and model training were performed to predict key quality variables in the fermentation process. Step 6: SHAP-based contribution analysis of fermentation process parameters: Based on the prediction results of the LightGBM soft sensor model for each mode, the contribution of each input feature to the prediction results is calculated using the SHAP interpretability analysis method. This quantifies the influence of each process parameter at different fermentation stages and in the overall process, providing interpretable basis for process optimization.
2. The method according to claim 1, characterized in that, The data preprocessing in step 1 employs the Z-score standardization method. By calculating the sample mean and standard deviation for each feature dimension, the original data is transformed into a standard normal distribution with a mean of zero and a variance of one. The standardization formula is as follows: ; Where Z is the standardized feature value, X is the original feature value, μ is the sample mean of the feature dimension in the dataset, and σ is the sample standard deviation of the feature dimension in the dataset.
3. The method according to claim 1, characterized in that, The initialization of model parameters in step 2 includes: Set the number of hidden states N and initialize the model parameters. Where π represents the initial probability distribution, and π represents the probability of the fermentation process starting from each state; A represents the state transition matrix, A={ } represents the probability of transitioning from state i to state j, and the sum of each row is 1, i.e. , where B represents the transition probability between fermentation states; B represents the observation probability distribution, B={ } represents the probability distribution of the observation in state j, and represents the probability distribution of the observation in each state during the fermentation process, where This represents the probability of transitioning from fermentation state i to state j, reflecting the transition pattern of fermentation stages; Let be the probability of observing sequence k under fermentation state j, describing the process characteristics of each stage; N is the total number of hidden states.
4. The method according to claim 1, characterized in that, In step 3, the E-step of the expectation-maximization algorithm calculates the probability distribution of each fermentation state at each time point given the current model parameters, as shown in Equation 1; the M-step uses the state membership probabilities γ and p calculated in the E-step as weights, as shown in Equation 2. (1) (2) in Let be the probability of being in fermentation state i at time t, reflecting the stage membership degree of the fermentation process; Forward probability, the probability of the observed sequence up to time t; For backward probability, the probability of the observation sequence from time t to the end; Let be the probability of transitioning from state i to state j; T is the total duration. Let be the probability of transitioning from fermentation state i to j at time t; For each iteration, a new parameter solution is generated, and the corresponding likelihood value P(O|λ) is calculated. This value represents the probability of the actual occurrence of the entire batch of sensor data sequence O under the current assumed fermentation process stage division and parameter settings. A higher likelihood value means that the state evolution path and observation patterns described by the model match the actual fermentation process more closely, resulting in optimized hidden Markov model parameters. .
5. The method according to claim 1, characterized in that, Step 4 of the Viterbi algorithm includes two steps: forward recursion and delayed backtracking. Forward recursion: Based on real-time observation sequences, the probability of the optimal path to each fermentation state at each moment is dynamically calculated, which can most reasonably explain the stage evolution sequence of the change pattern of all sensor readings from the start of fermentation to the current moment; based on historical observation information and combined with the observation data in the window, it is determined which stage the current moment is more likely to be in, and the source state of the optimal path is recorded. Delayed backtracking: Backtracking backwards based on the stored path pointers to determine the state sequence with the highest probability in the entire observation sequence; Post-processing optimization is performed on the decoded state sequence, including: applying minimum duration constraints to merge state segments with excessively short durations or those that do not conform to the kinetic characteristics of the fermentation process into adjacent stable modes; The modality labels are renumbered according to the order in which the states first appear on the timeline.
6. The method according to claim 1, characterized in that, In step 5, when constructing a multimodal soft measurement model based on LightGBM, each modality of the LightGBM model adopts a differentiated combination of hyperparameters to adapt to the process characteristics and data distribution patterns under that modality. The hyperparameters include the maximum depth of the tree, the number of leaf nodes, and the learning rate. During model training, an early stopping strategy and cross-validation method are adopted. By setting the early stopping round number parameter, training is automatically terminated when the model performance no longer improves in consecutive iterations, in order to prevent overfitting and ensure generalization ability.
7. The method according to claim 1, characterized in that, SHAP's interpretive analysis unfolds from two dimensions: local and global. At the local level, by analyzing the SHAP values of each variable in each fermentation mode, the dynamic influence mechanism of key process parameters on the product accumulation of this stage is revealed. At the global level, the overall contribution trend of each parameter to key quality variables throughout the fermentation process is assessed by combining the SHAP value distribution of all samples. The basic formula for calculating the SHAP value is shown in Equation 3: (3) Where i represents a feature. Let represent the SHAP value of feature i, F represent the set of all features, and S represent any subset of features that does not contain feature i. This indicates that only a subset of the model's predictions are used. This represents the model prediction using all features.
8. The method according to claim 1, characterized in that, The method is applied to microbial fermentation processes, including zinc-enriched yeast fermentation. The key quality variables include product concentration and zinc content, and the easily measurable process parameters include dissolved oxygen concentration and exhaust gas content.
9. The method according to claim 1, characterized in that, In step 5, the model performance evaluation adopts a multi-dimensional evaluation system that includes root mean square error, mean absolute error, and coefficient of determination, and is verified on an independent test set.
10. A multimodal soft-sensor modeling system for fermentation processes based on a hidden Markov model, characterized in that, include: Data acquisition and preprocessing module: used to collect historical datasets of the fermentation process, standardize and preprocess the data to eliminate the influence of units, and divide the dataset into training and testing sets; Hidden Markov Model Construction and Training Module: This module is used to configure the hyperparameters of the Hidden Markov Model according to the characteristics of the fermentation process, initialize the model parameters, and train the model using the expectation-maximization algorithm to obtain the optimized Hidden Markov Model parameters. Fermentation process modality segmentation module: This module applies the trained Hidden Markov Model to online or offline fermentation process data, and uses the Viterbi algorithm to decode the modality label at each sampling time, thereby realizing dynamic stage identification of the fermentation process. Multimodal soft measurement modeling module: Based on the modality division results, it constructs LightGBM soft measurement sub-models for each fermentation stage, configures differentiated hyperparameters and trains them to predict key quality variables in real time; Interpretability Analysis Module: Based on the prediction results of each modality LightGBM model, it uses the SHAP method to calculate the contribution of input features, generate feature importance analysis and visualization results, and provide decision support for process control.