Automatic sleep staging method and device based on ballistocardiogram signal and double-layer stacking model
Through the method based on the heart impact signal and double-layer stacking model, the problems of long-term signal dependence and high-dimensional characteristic noise in the prior art are solved, and more accurate and reliable sleep staging is achieved, which is suitable for long-term sleep health monitoring in home environments.
Patent Information
- Application Number
- CN202510662837.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-08-26
AI Technical Summary
The existing sleep staging method based on BCG signals does not fully consider the long-term dependence of the signal, making it difficult to accurately model the dynamic correlation between BCG and physiological state. At the same time, there are noise and redundant features in high-dimensional features, which affect the performance of the classifier. The model has insufficient accuracy and robustness, making it difficult to deal with actual scenarios of uneven distribution of sample categories.
Using a method based on the core impact signal and a double-layer stacking model, signal preprocessing is performed through the maximum overlap discrete wavelet transformation and Butterworth low-pass filter, combined with multi-scale feature extraction and feature selection, a dual-stack model is built, and a gradient enhancement decision tree and random forest are used for model training, and an adaptive weight adjustment strategy is introduced to improve classification accuracy.
It effectively improves the accuracy and robustness of sleep staging, enhances the model's ability to distinguish different sleep stages, solves the problems of high-dimensional feature noise and redundancy, alleviates the impact of sample imbalance on classification performance, and improves the overall reliability and applicability of the model.
Smart Images

Figure CN120531331A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of biological signal processing technology and sleep monitoring, and in particular to an automatic sleep staging method and device based on a ballistocardiogram signal and a double-layer stacking model. Background Art
[0002] Sleep is crucial to maintaining individual health. Long-term lack of sleep may lead to a variety of diseases and weaken the body's immune function. Traditional sleep monitoring mainly relies on polysomnography (PSG). However, its high cost and contact characteristics limit its widespread application in daily environments. Therefore, the development of low-cost, non-contact sleep monitoring methods is of great significance to improving sleep health management. Ballistocardiography (BCG) is a physiological signal derived from tiny body movements caused by the mechanical movement of the heart. By embedding the BCG sensor in the mattress, the human body's sleep status information can be continuously obtained without disturbing the monitored person. Compared with traditional biological signal acquisition methods, BCG has the advantages of non-contact, non-invasive, and low cost, and is more suitable for long-term sleep health monitoring in a home environment.
[0003] Existing sleep staging methods based on BCG signals mainly face the following two problems:
[0004] 1. Existing methods do not fully consider the long-term temporal dependence of BCG signals when extracting bioinformatic features, making it difficult to accurately model the dynamic association between BCG and physiological status. At the same time, high-dimensional features contain noise and redundant features, which in turn affect classifier performance.
[0005] 2. Existing sleep staging models have deficiencies in accuracy and robustness, and are difficult to cope with actual scenarios such as uneven distribution of sample categories, thus limiting their applicability and prediction accuracy in different individuals and datasets.
[0006] In view of the defects of the existing technology, it is necessary to propose a technical solution to solve the problems of the existing technology. Summary of the Invention
[0007] In view of this, it is indeed necessary to provide an automatic sleep staging method and device based on cardiac signal and double-layer stacking model, which can fully explore the characteristics of biological signals, improve the model's ability to distinguish different sleep stages, and enhance the efficiency of model operation and classification accuracy.
[0008] In order to overcome the defects of the prior art, the technical solution of the present invention is as follows:
[0009] An automatic sleep staging method based on a ballistocardiogram signal and a double-layer stacking model comprises the following steps:
[0010] Step S1: Obtain the original BCG signal and perform preprocessing, wherein the original BCG signal is subjected to multi-scale decomposition and reconstruction based on the maximum overlap discrete wavelet transform (MODWT) to obtain the heartbeat interval sequence JJi; at the same time, the original BCG signal is processed based on the Butterworth low-pass filter (BLF) method to obtain the respiratory interval sequence BBi;
[0011] Step S2: performing feature processing on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained in step S1 to construct a simplified feature matrix that is highly correlated with the sleep stage;
[0012] Step S3: Construct a double stacking model based on the Stack strategy and train it. Use the trained model to process the simplified feature matrix obtained in step S2 to perform sleep staging.
[0013] As a further improvement, in step S1, the embedded BCG sensor collects non-contact raw BCG signals all night long. Then, the raw BCG signals are decomposed and reconstructed at multiple scales based on MODWT to extract the heart rate information of the target frequency band. The amplitude difference is enhanced through normalization, rectification, and squaring. The characteristic J peak is extracted by combining the sliding window cutting method to generate the heartbeat interval sequence JJi. At the same time, the low-frequency component of the respiratory signal is extracted based on BLF, and the characteristic B peak is obtained by the dual threshold detection method to construct the respiratory interval sequence BBi, thereby achieving effective separation of heart rate and respiratory signals.
[0014] As a further improvement, step S2 includes the following steps:
[0015] Step S21: Based on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained in step S1, the heart rate variability HRV features and respiratory variability RRV features are extracted from the dimensions of time domain, frequency domain, Poincaré graph morphology and complexity index;
[0016] Step S22: adopting a multi-scale time window temporal feature extraction method, intercepting signal segments at different time scales through a sliding window technique, extracting its stable time domain features at each scale, and constructing HRV and RRV feature matrices;
[0017] Step S23: Using the ReliefF algorithm, feature selection is performed on the constructed HRV and RRV feature matrices to eliminate redundant and noisy features, achieve dimensionality reduction, and construct a streamlined feature matrix that is highly correlated with the sleep stage.
[0018] As a further improvement, the double stacking model based on the Stack strategy constructed in step S3 adopts a two-layer structure, wherein the first layer is composed of multiple base models, which is used to process the simplified feature matrix output by step S2 to obtain diversified prediction vectors; the second layer is a meta-model, which is used to receive the prediction vectors output by the first-layer base models, and perform weighted fusion on these vectors to output the final sleep staging results.
[0019] As a further improvement, the training process of the double stacking model constructed in step S3 is as follows:
[0020] First, the obtained streamlined feature matrix is paired with the corresponding sleep stage labels to construct a sleep stage dataset for model training;
[0021] Subsequently, a two-layer stacking model based on a stacking ensemble strategy was constructed. The first layer consisted of multiple base models. The gradient boosting decision tree (GBDT) model was combined with ABC-LogitBoost to complete the discriminative learning of high-dimensional features through adaptive category selection and zero-sum constraints. During training, the parameters of each base model were gradually optimized using the training dataset. Then, the output of the first-layer base model was used as input features to train the second-layer meta-model. The fusion weights were optimized through supervised learning to achieve two-stage collaborative training. In particular, an adaptive weight adjustment strategy based on category frequency was introduced during the training process.
[0022] The second-layer meta-model uses the random forest RF model for integration and fusion, and adopts the majority voting method to achieve the final classification prediction of sleep stages.
[0023] As a further improvement, the double stacking model in step S3 performs the following steps:
[0024] Step S31: Input the obtained simplified feature matrix into the first-layer base model. The base model independently discriminates the input features, fully utilizing their respective advantages to process high-dimensional and complex sleep features, and obtains multi-dimensional classification results.
[0025] Step S32: The output results of the first-layer base model are integrated and used as the input of the second-layer meta-model. The preliminary discrimination results are integrated and optimized through the integrated voting mechanism of multiple decision trees.
[0026] Step S33: In the inference stage, by introducing an adaptive weight adjustment mechanism based on the frequency of category samples, the recognition priority of minority class samples is dynamically improved, and the intrinsic correlation of the characteristics of the cardiac shock signal is fully explored to ensure the balanced discrimination of the model in different sleep stages.
[0027] As a further improvement, step S23 further includes:
[0028] Step S231: First, construct the original feature matrix Q based on HRV and RRV multi-dimensional features, and input it into the ReliefF algorithm to calculate the weight coefficient W of each feature i , the formula is as follows:
[0029]
[0030] Among them, H represents the set of neighboring instances of the feature, ||x i -x h || is feature x i and its neighboring instances x h The distance metric between them, ||y i -y h || is the label difference of the target variable y. The weight value W i Represents feature x i The degree of contribution to the target variable y.
[0031] Step S232: normalize the obtained weights:
[0032]
[0033] Among them, W i norm is the normalized weight, which makes each eigenvalue uniform to the same scale.
[0034] Step S233: Normalized features are sorted by weight, and the top five features are selected from each round to form a candidate subset. This subset is then fed into a two-layer stacked classifier for training and evaluation. Redundant features are gradually eliminated based on classification accuracy, ultimately selecting the optimal feature combination to form a streamlined feature matrix D, which is then used for subsequent physiological state recognition or sleep staging.
[0035] As a further improvement, step S32 further includes:
[0036] Step S321: Design the GBDT model as the first-layer base model (Base-Model) to optimize the processing effect of high-dimensional features.
[0037] Specifically, in the first-layer base model, the training set is:
[0038]
[0039] where x i Represents the feature vector of the i-th sample, y i is its corresponding label, and C is the number of categories. The output of the GBDT model is:
[0040]
[0041] where hm (x) represents the mth regression tree, γ m The corresponding weight.
[0042] Step S322: In the Base-Model, the adaptive selection of base categories and the zero-sum constraint strategy of ABC-LogitBoost are combined to improve the accuracy and robustness of multi-classification tasks. The update formula of ABC-LogitBoost is:
[0043]
[0044] Where ν is the learning rate, For weak classifiers The coefficients of , satisfy the zero-sum constraint to maintain the discriminant stability of the model.
[0045] Step S323: Take the mode of all validation sets and test sets predicted by all Meta-Models as features to form new training sets and test sets as inputs of the second layer of Meta-Mode for final prediction.
[0046] As a further improvement, step S33 further includes:
[0047] Step S331: In the second-layer meta-model, the present invention selects the RF model to perform final prediction.
[0048] Specifically, in the second-layer meta-model, the outputs of all base models in the first layer are used as new features:
[0049]
[0050] On this basis, the RF model predicts the second layer input as follows:
[0051]
[0052] in Represents the final sleep stage result, T b represents the b-th decision tree, and mode represents the majority voting function.
[0053] Step S332: To address the imbalance of data samples, an adaptive weight adjustment strategy is adopted. This strategy effectively improves the model's classification ability for minority classes by optimizing the attention paid to small sample classes, thereby improving the overall classification accuracy. The weight adjustment strategy for class imbalance is expressed as:
[0054]
[0055] where p(y i ) is category yi The frequency of occurrence in the training set increases the model's attention to minority class samples.
[0056] The present invention also discloses an automatic sleep staging device based on a cardiac ballistic signal and a double-layer stacking model, comprising:
[0057] A preprocessing unit is used to obtain the original BCG signal and perform preprocessing, wherein the original BCG signal is subjected to multi-scale decomposition and reconstruction based on the maximum overlap discrete wavelet transform (MODWT) to obtain the heartbeat interval sequence JJi; at the same time, the original BCG signal is processed based on the Butterworth low-pass filter (BLF) method to obtain the respiratory interval sequence BBi;
[0058] A feature processing unit is used to perform feature processing on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained by the preprocessing unit to construct a simplified feature matrix that is highly correlated with the sleep stage;
[0059] The sleep staging processing unit is constructed based on a double stacking model of the Stack strategy and is obtained after training, and is used to process the simplified feature matrix obtained by the feature processing unit to output the sleep staging.
[0060] As a further improvement, the dual stacking model based on the Stack strategy constructed in the sleep staging processing unit adopts a two-layer structure. The first layer consists of multiple base models, which are used to process the simplified feature matrix output by the feature processing unit to obtain diversified prediction vectors; the second layer is a meta-model, which is used to receive the prediction vectors output by the base models of the first layer, and perform weighted fusion on these vectors to output the final sleep staging results.
[0061] As a further improvement, the training process of the double stacking model constructed in the sleep staging processing unit is as follows:
[0062] First, the obtained streamlined feature matrix is paired with the corresponding sleep stage labels to construct a sleep stage dataset for model training;
[0063] Subsequently, a two-layer stacking model based on a stacking ensemble strategy was constructed. The first layer consisted of multiple base models. The gradient boosting decision tree (GBDT) model was combined with ABC-LogitBoost to complete the discriminative learning of high-dimensional features through adaptive category selection and zero-sum constraints. During training, the parameters of each base model were gradually optimized using the training dataset. Then, the output of the first-layer base model was used as input features to train the second-layer meta-model. The fusion weights were optimized through supervised learning to achieve two-stage collaborative training. In particular, an adaptive weight adjustment strategy based on category frequency was introduced during the training process.
[0064] The second-layer meta-model uses the random forest RF model for integration and fusion, and adopts the majority voting method to achieve the final classification prediction of sleep stages.
[0065] Compared with the prior art, the present invention has the following technical effects:
[0066] The present invention adopts a multi-scale sliding window combined with HRV / RRV statistical feature construction method. This feature extraction mechanism realizes a comprehensive characterization of the changing patterns of physiological signals at different time scales, thereby solving the problem that a single scale cannot cover the complex fluctuation characteristics of sleep states.
[0067] This method extracts dynamic indicators such as temporal mean, standard deviation, coefficient of variation, and slope over multiple window lengths to construct a time-sensitive multi-scale feature set, effectively enhancing the ability to describe dynamic cardiopulmonary characteristics during different sleep stages. This method improves the temporal information density and physiological interpretability of the feature set, providing input support for subsequent classifiers with stronger discriminatory capabilities.
[0068] The present invention adopts a double-layer stacked integrated model structure based on the Stacking strategy, combining GBDT and ABC-LogitBoost as the underlying learners and RF as the meta-model. This model structure realizes the diversity fusion and robust enhancement of the model prediction results, thereby solving the problem of serious overfitting and weak generalization ability of a single model. The underlying model models the nonlinear relationship in the cardiopulmonary feature space from the perspectives of gradient fitting and weighted gain, and the output results are fused by the meta-model to form a more stable decision boundary. In conjunction with the adaptive category weight mechanism, it effectively alleviates the impact of sleep stage sample imbalance on classification performance, significantly improves the model's ability to recognize minority class stages, and enhances the overall reliability and practicality of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 A framework flow chart of an automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0070] Figure 2 A detailed flow chart of step S1 in the automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0071] Figure 3 A detailed flow chart of step S22 in the automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0072] Figure 4 A detailed flow chart of step S23 in the automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0073] Figure 5 This is a graph of experimental data of step S233 in the automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0074] Figure 6 The selected feature matrix and its feature weights retained after the experiment in step S233 of the automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0075] Figure 7 The double-layer stacking model diagram provided in step S3 of the automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention;
[0076] Figure 8 A comparison chart of the classification accuracy of the present invention and five traditional algorithms;
[0077] Figure 9 This is a structural block diagram of the automatic sleep staging device based on BCG signals and a double-layer stacking model provided by the present invention.
[0078] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0079] The technical solution provided by the present invention will be further described below with reference to the accompanying drawings.
[0080] Existing automatic sleep staging methods based on BCG signals still have deficiencies in the separation of heart rate and respiratory signals, feature extraction, and noise redundancy processing. This makes it difficult to fully capture the complex correlation between signals and sleep stages, resulting in low model classification accuracy and robustness. However, a method that integrates dynamic feature extraction with multi-scale time window analysis can more effectively reconstruct heart rate and respiratory signals and improve the accuracy and stability of feature extraction. Furthermore, the combination of feature screening algorithms and model integration strategies provides a more reliable solution for sleep staging.
[0081] To this end, the present invention provides an automatic sleep staging method based on BCG signals and a double-layer stacking model, comprising the following steps:
[0082] Step S1: Obtain the original BCG signal and perform preprocessing, wherein the original BCG signal is subjected to multi-scale decomposition and reconstruction based on the maximum overlap discrete wavelet transform (MODWT) to obtain the heartbeat interval sequence JJi; at the same time, the original BCG signal is processed based on the Butterworth low-pass filter (BLF) method to obtain the respiratory interval sequence BBi;
[0083] Step S2: performing feature processing on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained in step S1 to construct a simplified feature matrix that is highly correlated with the sleep stage;
[0084] Step S3: Construct a double stacking model based on the Stack strategy and train it. Use the trained model to process the simplified feature matrix obtained in step S2 to perform sleep staging.
[0085] See also Figure 1 , shown is a process architecture diagram of an automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention. Generally speaking, the present invention includes three major steps: Step S1: preprocessing the original BCG signal based on the MODWT and BLF methods; Step S2: extracting stable HRV and RRV features based on the multi-scale time window feature extraction method to establish a mapping relationship between the BCG signal and different sleep stages; Step S3: designing and training a double-stacked model based on the Stack strategy to improve the accuracy of sleep staging.
[0086] In step S1, the embedded BCG sensor first collects contactless raw signals throughout the night. Subsequently, the raw BCG is subjected to multi-scale decomposition and reconstruction based on the MODWT to extract heart rate information in the target frequency band. Amplitude differences are enhanced through normalization, rectification, and squaring. A sliding window cutting method is used to extract the characteristic J peak and generate the heartbeat interval sequence JJi. Simultaneously, a BLF is used to extract the low-frequency components of the respiratory signal, and a dual threshold detection method is used to obtain the characteristic B peak and construct the respiratory interval sequence BBi. This processing effectively separates the heart rate and respiratory signals, providing a stable and reliable input foundation for subsequent feature extraction and sleep staging.
[0087] In the above step S2, feature processing is performed on the JJi (heart beat interval) sequence and BBi (respiratory interval) sequence extracted in step S1, specifically including: extracting HRV and RRV features from multiple dimensions such as time domain, frequency domain, Poincaré plot morphology and complexity index, combining the multi-scale sliding window method to extract stable time domain features at different time scales, and finally using the ReliefF algorithm for feature selection and dimensionality reduction to construct a simplified feature matrix that is highly correlated with sleep stages.
[0088] In the above-mentioned step S3, step S3 includes constructing a dual stacking model based on the Stack strategy. The first layer is composed of multiple base models, which are independently trained for the simplified feature matrix output by step S2 to obtain diversified prediction results; the second layer is a meta-model, which receives the output of the first-layer base model as input, optimizes the fusion weights through supervised learning, and improves the overall classification performance and generalization ability. In the training phase, the parameters of each base model are first optimized separately, and then their predicted probabilities are used as training samples for the meta-model to achieve two-stage collaborative training. In the inference phase, the simplified feature matrix is first input into each base model to generate a prediction vector, and then the meta-model performs weighted fusion on these vectors to output the final sleep staging result, thereby achieving efficient and accurate stage discrimination.
[0089] See also Figure 2 , shown is a detailed flow chart of step S1 in an automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention, which further includes the following steps:
[0090] Step S11: performing non-contact sleep monitoring on a human body all night long through a mattress embedded with a BCG signal sensor, and collecting complete raw BCG signal data;
[0091] Step S12: pre-processing the collected original BCG signal to extract target signal components related to heart rate and respiration;
[0092] The step S12 further comprises:
[0093] Step S121: Use MODWT to perform multi-scale decomposition on the input heart rate signal. Suppose the original discrete signal is X t , where t=1,2…,N, can be expressed as follows through MODWT:
[0094]
[0095] Among them, W j,t Represents the detail coefficient (i.e., wavelet coefficient) at the jth layer, reflecting the high-frequency components of the signal at the corresponding scale; V J,t Represents the approximation coefficient of the Jth layer, representing the low-frequency component.
[0096] The wavelet coefficient W of MODWT j,t and approximation coefficient V j,t It is calculated by the following convolution formula:
[0097]
[0098] in, and are the coefficients of the wavelet filter and the scaling filter of the jth layer of MODWT, L is the filter length, t is the current processing time point, and l is the position index of the filter coefficient. mod represents the boundary processing of the filtering cycle.
[0099] In order to extract and denoise the target frequency band of the signal, the third-level wavelet coefficient W is selected 3,t The corresponding frequency range is [1,2] Hz, which is used as the characteristic frequency band for inverse transformation and reconstruction:
[0100]
[0101] Among them, IMODWT represents the inverse transform operation of MODWT. It represents the signal reconstructed from the third-level wavelet coefficients, effectively retaining the information in the [1,2] Hz frequency band and filtering out interference from other frequency bands.
[0102] Step S123: Dynamically segment the data 0.4 seconds after each J peak, extracting peaks within a time interval of at least 0.8 seconds. This preprocessing helps accurately capture the characteristic bands of the heart rate signal and accurately locate the J peak. Finally, the first-order deviation of the entire set of extracted J peaks is calculated to obtain the JJi interval sequence.
[0103] Step S124: Process the original BCG signal using the BLF method, set the cutoff frequency to 0.6 Hz, filter out non-respiration-related components above this frequency, and extract the stable respiratory signal component. Output signal X resp (t) The formula is as follows:
[0104]
[0105] Among them, x BCG (t) represents the original BCG signal; and represents the Fourier transform and its inverse transform; H(f) is the frequency response function of the bandpass filter, which satisfies H(f) = 1 when f ≤ 0.6 Hz and 0 otherwise;
[0106] Step S125: By integrating the peak height and spacing dual threshold strategy, the characteristic peak B of the respiratory signal is effectively extracted. Furthermore, the first-order difference of the complete B peak sequence is calculated to obtain a highly time-effective BBi interval sequence that reflects the dynamic changes of the respiratory rhythm.
[0107] The above step S2 includes the following steps:
[0108] Step S21: Based on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained in step S1, the heart rate variability HRV features and respiratory variability RRV features are extracted from the dimensions of time domain, frequency domain, Poincaré graph morphology and complexity index;
[0109] Step S22: adopting a multi-scale time window temporal feature extraction method, intercepting signal segments at different time scales through a sliding window technique, extracting its stable time domain features at each scale, and constructing HRV and RRV feature matrices;
[0110] Step S23: Using the ReliefF algorithm, feature selection is performed on the constructed HRV and RRV feature matrices to eliminate redundant and noisy features, achieve dimensionality reduction, and construct a streamlined feature matrix that is highly correlated with the sleep stage.
[0111] Step S21 further includes:
[0112] Step S211: Specifically, in the present invention, a set of parameter systems for describing the statistical characteristics of the time-domain volatility of the characteristic peak interval sequence is constructed. The system includes but is not limited to the following indicators:
[0113] The root mean square difference (RMSSD) is used to reflect the short-term fluctuation intensity of the adjacent interval changes in the characteristic peak interval sequence. The specific formula is as follows:
[0114]
[0115] The standard deviation of NN intervals (SDNN) characterizes the global volatility of the entire characteristic peak interval sequence. The calculation formula is as follows:
[0116]
[0117] The Standard Deviation of Successive Differences (SDSD) quantifies the dispersion of the first-order deviations of successive differences in a sequence of characteristic peak intervals. Unlike RMSSD, SDSD emphasizes the degree of deviation from the statistical distribution of these differences and better reflects the stability of difference fluctuations.
[0118]
[0119] The coefficient of variation of NN intervals (CVNN) measures the ratio of the standard deviation of the characteristic peak interval to its mean and is used to evaluate the relative strength of interval fluctuations. Its expression is as follows:
[0120]
[0121] The coefficient of variation of successive differences (CVSD) reflects the level of change in the fluctuation of successive differences relative to their mean. It is defined as follows:
[0122]
[0123] The percentage of NN intervals greater than 50ms (pNN50) is the proportion of samples in the characteristic peak interval sequence whose absolute value of the difference between adjacent intervals is greater than 50 milliseconds. Its expression is as follows:
[0124]
[0125] XX in the above formula i Represents the characteristic peak interval sequence used to construct the scatter plot. For the heart rate signal, XX i Corresponding to the cardiac interval sequence JJi; for the respiratory signal, XX i This corresponds to the respiratory cycle period sequence BBi. Furthermore, N is the total number of samples, and i is the coefficient index of the current sample. The above sequences are all time-series inputs that reflect the rhythmic variation characteristics of the corresponding physiological signals and are used for subsequent two-dimensional delay mapping processing and dynamic behavior modeling.
[0126] Step S212: The present invention uses the Welch method to perform frequency domain analysis on the heart rate and respiratory signals, and uses power spectral density (PSD) estimation to extract spectral features, thereby improving stability and accuracy under low signal-to-noise ratio conditions to reflect the dynamic characteristics of the physiological system.
[0127] The frequency distribution includes, but is not limited to, the following frequency bands: Low Frequency (LF, 0.04-0.15 Hz), Medium Frequency (MF, 0.1-0.15 Hz), High Frequency (HF, 0.15-0.4 Hz), and Total Low Frequency (TLF, 0.04-0.1 Hz). Furthermore, the normalized values of the above frequency bands, namely LFn, MFn, HFn, and TLFn, are calculated to quantitatively assess the relative power distribution of each frequency band, thereby revealing the state of autonomic nervous system activity and other potential physiological characteristics.
[0128] Furthermore, the method calculates ratios between multiple frequency bands, including the LF to HF ratio (LFHF), which reflects the regulatory balance between the sympathetic and parasympathetic nervous systems; the MF to LF ratio (MFLF), which describes the dynamic relationship between intermediate and low frequencies in biological signals; and the TLF to LF ratio (TLFLF), which reveals the overall trend of low-frequency activity. This suite of features effectively enhances the ability to analyze complex physiological states, with excellent stability and discrimination.
[0129] Step S213: Further, the embodiment of the present invention is based on the dynamic characteristics analysis method of physiological time series signals of Poincaré diagram to quantitatively evaluate the synergistic relationship between HRV and RRV. Specifically, it includes: extracting the characteristic peak intervals in the heart rate signal and the respiratory signal, using the delay mapping strategy to convert the two adjacent interval values (X i , X i+1 ) are constructed as point pairs and a Poincaré scatter plot is drawn in a two-dimensional coordinate system to visualize the dynamic change characteristics of the time series signal.
[0130] In the scatter plot, by geometrically quantifying the distribution form, density, and discreteness of the point cloud, key characteristic parameters reflecting the cardiopulmonary regulation mechanism are extracted. The parameters include but are not limited to: SD1 (standard deviation in the direction perpendicular to the main diagonal), SD2 (standard deviation in the direction of the main diagonal), the ratio of SD1 to SD2 (SD1 / SD2), and the graph coverage area S (S = π·SD1·SD2). The above parameters can accurately depict the coupling state of heart rate and respiratory rhythm, reflect the level of individual autonomic nervous system regulation, have strong stability and sensitivity to individual differences, and are suitable for application scenarios such as sleep stage identification, health monitoring, and physiological behavior assessment.
[0131] Step S214: In this invention, sample entropy (SE) is used as a characteristic parameter to measure the complexity and regularity of a time series. SE is calculated by calculating the similarity probability of subsequences of length m and m+1 under a tolerance and taking the negative logarithm to assess the degree of disorder of local patterns in the sequence.
[0132]
[0133] Among them, B m (r) represents the similarity probability of a subsequence of length m under a given tolerance r. By calculating the similarity between different behavioral patterns, the complexity of time series can be quantified and an effective feature extraction method can be provided for the analysis of nonlinear data such as physiological signals.
[0134] See also Figure 3 FIG. 1 is a detailed flow chart of step S22 in an automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention, which further includes the following steps:
[0135] Step S221: setting multiple time window sizes, including 30 seconds, 1 minute, 2 minutes and 5 minutes, to meet the analysis requirements of different physiological characteristics.
[0136] Step S222: Under each window size, start sliding from the starting point of the signal, move at a certain step size each time, and extract the time domain features within the window.
[0137] T i ={30s,1min,2min,5min}
[0138] Among them, T i Indicates the window length of different time scales.
[0139] Step S223: Fusing the features extracted from windows of different time scales to provide multi-dimensional biological information. Wherein, the total length of the signal is L, the step size of the sliding window is S, and the window position of the sliding window can be expressed by the following formula:
[0140] W i,j =[j·S,j·S+W i ]
[0141] Where j is the index of the sliding window (j = 0, 1, 2, ..., N-1, N is the number of times the window slides), W i,j Indicates the position of the jth window at the i-th time scale. The step size S determines the distance of each window sliding. For each sliding window W i,j , calculate the characteristics of the signal within the window.
[0142] In step S22, due to the use of a multi-scale sliding window feature extraction method, it is possible to obtain multi-angle descriptions of the same physiological state from different time resolutions, realize the collaborative modeling of short-term fluctuation information and long-term trend information, and effectively improve the feature representation ability and adaptability to complex physiological rhythms.
[0143] Figure 4 FIG. 1 is a detailed flow chart of step S23 in an automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention, which further includes the following steps:
[0144] Step S231: First, construct the original feature matrix Q based on HRV and RRV multi-dimensional features, and input it into the ReliefF algorithm to calculate the weight coefficient W of each feature i , the formula is as follows:
[0145]
[0146] Among them, H represents the set of neighboring instances of the feature, ||x i -x h || is feature x i and its neighboring instances x h The distance metric between them, ||y i -y h || is the label difference of the target variable y. The weight value W i Represents feature x i The degree of contribution to the target variable y.
[0147] Step S232: normalize the obtained weights:
[0148]
[0149] Among them, W i norm is the normalized weight, which makes each eigenvalue uniform to the same scale.
[0150] Step S233: Normalized features are sorted by weight, and the top five features are selected from each round to form a candidate subset. This subset is then fed into a two-layer stacked classifier for training and evaluation. Redundant features are gradually eliminated based on classification accuracy, ultimately selecting the optimal feature combination to form a streamlined feature matrix D, which is then used for subsequent physiological state recognition or sleep staging.
[0151] In step S23, a feature screening mechanism based on the ReliefF algorithm is adopted. This mechanism automatically mines the most discriminative key features for the classification task from the high-dimensional multi-scale HRV and RRV original feature matrices by introducing a local density-weighted distance metric and calculating the nonlinear correlation between features and target labels. This solves the problem of a large number of redundant and irrelevant features in the high-dimensional feature space and avoids the impact of the "curse of dimensionality" on the stability and efficiency of model training. Through normalization processing and candidate subset iterative optimization mechanism, combined with model performance indicators to reversely guide the feature selection process, this method further achieves feature space compression and optimal subset construction, effectively enhancing the compactness of feature representation and the generalization ability of the classifier.
[0152] The dual stacking model based on the Stack strategy constructed in the above step S3 adopts a two-layer structure, wherein the first layer is composed of multiple base models, which is used to process the simplified feature matrix output by step S2 to obtain diversified prediction vectors; the second layer is a meta-model, which is used to receive the prediction vectors output by the base models of the first layer, and perform weighted fusion on these vectors to output the final sleep staging results.
[0153] The training process of the double stacking model constructed in step S3 is as follows:
[0154] First, the obtained streamlined feature matrix is paired with the corresponding sleep stage labels to construct a sleep stage dataset for model training;
[0155] Subsequently, a two-layer stacking model based on a stacking ensemble strategy was constructed. The first layer consisted of multiple base models. The gradient boosting decision tree (GBDT) model was combined with ABC-LogitBoost to complete the discriminative learning of high-dimensional features through adaptive category selection and zero-sum constraints. During training, the parameters of each base model were gradually optimized using the training dataset. Then, the output of the first-layer base model was used as input features to train the second-layer meta-model. The fusion weights were optimized through supervised learning to achieve two-stage collaborative training. In particular, an adaptive weight adjustment strategy based on category frequency was introduced during the training process.
[0156] The second-layer meta-model uses the random forest RF model for integration and fusion, and adopts the majority voting method to achieve the final classification prediction of sleep stages.
[0157] See also Figure 7 FIG. 1 is a detailed flow chart of step S3 in an automatic sleep staging method based on BCG signals and a double-layer stacking model provided by the present invention, which further includes the following steps:
[0158] Step S31: First, the streamlined feature matrix obtained in step S233 is input into the first-layer base model. This layer is composed of multiple models with strong classification capabilities, including GBDT and the ABC-LogitBoost model that combines adaptive class selection and a zero-sum constraint strategy. The base models independently discriminate against the input features, leveraging their respective strengths to process high-dimensional and complex sleep features, thereby obtaining multi-dimensional classification results.
[0159] Step S32: Then, the output results of the first-layer base model are integrated and used as the input of the second-layer meta-model. The meta-model adopts the random forest model and integrates and optimizes the preliminary discrimination results through the integrated voting mechanism of multiple decision trees.
[0160] Step S33: During the inference phase, to address the problem of unbalanced category distribution, the model introduces an adaptive weight adjustment mechanism based on category sample frequency to dynamically increase the recognition priority of minority class samples, ensuring balanced discrimination across different sleep stages.
[0161] The step S32 further includes:
[0162] Step S321: Design the GBDT model as the first-layer base model (Base-Model) to optimize the processing effect of high-dimensional features.
[0163] Specifically, in the first-layer base model, the training set is:
[0164]
[0165] where x i Represents the feature vector of the i-th sample, y i is its corresponding label, and C is the number of categories. The output of the GBDT model is:
[0166]
[0167] where h m (x) represents the mth regression tree, γ m The corresponding weight.
[0168] Step S322: In the Base-Model, the adaptive selection of base categories and the zero-sum constraint strategy of ABC-LogitBoost are combined to improve the accuracy and robustness of multi-classification tasks. The update formula of ABC-LogitBoost is:
[0169]
[0170] Where ν is the learning rate, For weak classifiers The coefficients of , satisfy the zero-sum constraint to maintain the discriminant stability of the model.
[0171] Step S323: Take the mode of all validation sets and test sets predicted by all Meta-Models as features to form new training sets and test sets as inputs of the second layer of Meta-Mode for final prediction.
[0172] The step S33 further comprises:
[0173] Step S331: In the second-layer meta-model, the present invention selects the RF model to perform final prediction.
[0174] Specifically, in the second-layer meta-model, the outputs of all base models in the first layer are used as new features:
[0175]
[0176] On this basis, the RF model predicts the second layer input as follows:
[0177]
[0178] in Represents the final sleep stage result, T b represents the b-th decision tree, and mode represents the majority voting function.
[0179] Step S332: To address the imbalance of data samples, an adaptive weight adjustment strategy is adopted. This strategy effectively improves the model's classification ability for minority classes by optimizing the attention paid to small sample classes, thereby improving the overall classification accuracy. The weight adjustment strategy for class imbalance is expressed as:
[0180]
[0181] where p(y i ) is category y i The frequency of occurrence in the training set increases the model's attention to minority class samples.
[0182] See also Figure 9 , shown is a structural block diagram of an automatic sleep staging device based on BCG signals and a double-layer stacking model provided by the present invention, comprising:
[0183] A preprocessing unit is used to obtain the original BCG signal and perform preprocessing, wherein the original BCG signal is subjected to multi-scale decomposition and reconstruction based on the maximum overlap discrete wavelet transform (MODWT) to obtain the heartbeat interval sequence JJi; at the same time, the original BCG signal is processed based on the Butterworth low-pass filter (BLF) method to obtain the respiratory interval sequence BBi;
[0184] A feature processing unit is used to perform feature processing on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained by the preprocessing unit to construct a simplified feature matrix that is highly correlated with the sleep stage;
[0185] The sleep staging processing unit is constructed based on a double stacking model of the Stack strategy and is obtained after training, and is used to process the simplified feature matrix obtained by the feature processing unit to output the sleep staging.
[0186] In the above technical solution, the dual stacking model based on the Stack strategy constructed in the sleep staging processing unit adopts a two-layer structure, wherein the first layer is composed of multiple base models, which is used to process the simplified feature matrix output by the feature processing unit to obtain diversified prediction vectors; the second layer is a meta-model, which is used to receive the prediction vectors output by the first-layer base model, and perform weighted fusion on these vectors to output the final sleep staging result.
[0187] In the above technical solution, the training process of the double stacking model constructed in the sleep staging processing unit is as follows:
[0188] First, the obtained streamlined feature matrix is paired with the corresponding sleep stage labels to construct a sleep stage dataset for model training;
[0189] Subsequently, a two-layer stacking model based on a stacking ensemble strategy was constructed. The first layer consisted of multiple base models. The gradient boosting decision tree (GBDT) model was combined with ABC-LogitBoost to complete the discriminative learning of high-dimensional features through adaptive category selection and zero-sum constraints. During training, the parameters of each base model were gradually optimized using the training dataset. Then, the output of the first-layer base model was used as input features to train the second-layer meta-model. The fusion weights were optimized through supervised learning to achieve two-stage collaborative training. In particular, an adaptive weight adjustment strategy based on category frequency was introduced during the training process.
[0190] The second-layer meta-model uses the random forest RF model for integration and fusion, and adopts the majority voting method to achieve the final classification prediction of sleep stages.
[0191] The BCG signal and sleep stage label data used in this invention are jointly provided by Bobo Technology (Suzhou) Co., Ltd. and Sir Run Run Shaw Hospital Affiliated to Zhejiang University School of Medicine. The original signal data comes from 10 independent records, and the data acquisition is based on a sleep monitor with BCG technology (model: MD-EA, medical device registration certificate number: Su Xie Zhuzhu 20232070772). The device is used to monitor sleep in different populations all night. All data were collected from subjects at Sir Run Run Shaw Hospital Affiliated to Zhejiang University School of Medicine, and the research project has been approved by the ethics committee of the hospital (approval number: scientific research 20190520-67). During the data calibration process, three practicing physicians at Sir Run Run Shaw Hospital Affiliated to Zhejiang University School of Medicine marked the original sleep data by stages, with each sleep stage being a unit of 30 seconds. In order to ensure the accuracy and consistency of the data, the research team eliminated the segments with significant differences in the evaluation results of the three physicians and considered these segments to be invalid data. After this screening process, 10,614 valid sample data were finally obtained to ensure that the data quality met the requirements of subsequent analysis. The present invention completes key steps such as BCG signal preprocessing, feature extraction, and construction and training of a double-layer stacking model based on the Matlab platform in a local computing environment equipped with 16GB of memory and a 2.20GHz–2.21GHz Intel Core i7-8750H processor, ensuring the feasibility and stability of the algorithm design and verification, and providing a hardware foundation and development support for the engineering application of the method. In order to ensure the fairness of the test and eliminate possible sorting biases, the distribution of training and test data was randomly processed in this research and development. Subsequently, the data set was divided into an 8:2 ratio, 80% of which was used for model training to provide sufficient learning data, and 20% was used as an independent test set to evaluate the model performance. Accuracy (ACC), precision (PRE), recall (Recall), F1 (F1-Score), and Kappa were used as evaluation indicators.
[0192] In order to verify the technical effect of the present invention, a comparative experiment was conducted between the present invention and the existing method to evaluate its effectiveness:
[0193] Preferably, the present invention extracts 167 HRV and RRV features, and uses the ReliefF algorithm to evaluate the importance of the features, screening out features related to sleep stages. The feature weights are calculated by five-fold cross validation, and the model reaches a peak at about 50 features (e.g. Figure 5 When there are less than 50 features, the model’s ability to distinguish is insufficient; when there are too many features, redundancy and noise lead to performance degradation. Finally, the top 50 features (such as Figure 6(as shown in the figure), removing irrelevant information and improving model efficiency and generalization. These features effectively reflect the differences in sleep stages and provide a basis for accurate staging.
[0194] Table 1 Feature weight statistics of the multi-scale time window method of the present invention
[0195]
[0196] By analyzing HRV and RRV features, this paper proposes a multi-scale time window feature extraction method to more precisely reveal the relationship between BCG signals and sleep stages. The experimental results (Table 1) show that feature weights are evaluated using the ReliefF algorithm. Longer time windows (e.g., 5 minutes) exhibit higher feature weights when extracting features, reaching 0.5902, significantly higher than the traditional 30-second window (0.2082). The average weight of the top-50 feature set is 0.6158, significantly higher than the 0.4076 for the 30-second window, indicating that selecting a representative feature set can effectively improve model performance.
[0197] The present invention is compared with the classification models used in mainstream sleep staging research, such as bidirectional long short-term memory network (BiLSTM), convolutional neural network (CNN), convolutional neural network-long short-term memory (CNN-LSTM), residual neural network (ResNet), RF, GBDT, etc.
[0198] See Table 2 and Figure 8 , showing the experimental results comparison between the present invention and the above five traditional algorithms. Among them, Table 2 shows the performance differences of each algorithm under different indicators, Figure 8 The performance gap between the present invention and the traditional algorithm is intuitively demonstrated through accuracy (ACC) comparison and B-spline curve.
[0199] Table 2 Sleep staging results of the model based on BCG signals
[0200]
[0201] Table 2 above lists the comparative results of the algorithm of the present invention and five traditional algorithms in terms of performance evaluation indicators such as ACC, PRE, Recall and F1 value. Compared with other models, the present invention has achieved significant improvements in many indicators. Compared with BiLSTM, ACC increased by nearly 20 percentage points, and the F1 value increased by about 28 percentage points, showing a significant performance leap; compared with CNN and CNN-LSTM, the F1 value increased by about 8% and 11% respectively, further demonstrating the advantages of the present invention in time series modeling; even compared with the stronger ResNet and RF models, the present invention still has a higher recall rate in key sleep stages such as REM and N3, and the comprehensive F1 value is also 1.55% and 1.47% higher, reflecting its strong capabilities in fine-grained classification and sample balance processing, which fully verifies the advanced nature and practical value of the model of the present invention.
[0202] Figure 8 The accuracy comparison results of the algorithm of the present invention and traditional algorithms such as BiLSTM, CNN, CNN-LSTM, ResNet, and GBDT in the sleep staging task based on BCG signals are intuitively displayed, vividly reflecting the accuracy optimization effect of the present invention in the sleep staging task.
[0203] The above embodiments are only intended to help understand the method and core concept of the present invention. It should be noted that, without departing from the principles of the present invention, a number of improvements and modifications may be made to the present invention by those skilled in the art, and such improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0204] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An automatic sleep staging method based on cardiac ballistic signal and double-layer stacking model, characterized in that: The following steps are involved: Step S1: Obtain the original BCG signal and perform preprocessing, wherein the original BCG signal is subjected to multi-scale decomposition and reconstruction based on the maximum overlap discrete wavelet transform (MODWT) to obtain the heartbeat interval sequence JJi; at the same time, the original BCG signal is processed based on the Butterworth low-pass filter (BLF) method to obtain the respiratory interval sequence BBi; Step S2: performing feature processing on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained in step S1 to construct a simplified feature matrix that is highly correlated with the sleep stage; Step S3: Construct a double stacking model based on the Stack strategy and train it. Use the trained model to process the simplified feature matrix obtained in step S2 to perform sleep staging.
2. The automatic sleep staging method based on the ballistocardiographic signal and the double-layer stacking model according to claim 1, characterized in that: In step S1, the embedded BCG sensor collects non-contact raw BCG signals overnight. Then, the raw BCG signals are decomposed and reconstructed at multiple scales based on MODWT to extract the heart rate information of the target frequency band. The amplitude difference is enhanced through normalization, rectification and squaring. The characteristic J peak is extracted by combining the sliding window cutting method to generate the heartbeat interval sequence JJi. At the same time, the low-frequency component of the respiratory signal is extracted based on BLF, and the characteristic B peak is obtained through the dual threshold detection method to construct the respiratory interval sequence BBi, thereby achieving effective separation of heart rate and respiratory signals.
3. The automatic sleep staging method based on the ballistocardiographic signal and the double-layer stacking model according to claim 2, characterized in that: The step S2 comprises the following steps: Step S21: Based on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained in step S1, the heart rate variability HRV features and respiratory variability RRV features are extracted from the dimensions of time domain, frequency domain, Poincaré graph morphology and complexity index; Step S22: adopting a multi-scale time window temporal feature extraction method, intercepting signal segments at different time scales through a sliding window technique, extracting its stable time domain features at each scale, and constructing HRV and RRV feature matrices; Step S23: Using the ReliefF algorithm, feature selection is performed on the constructed HRV and RRV feature matrices to eliminate redundant and noisy features, achieve dimensionality reduction, and construct a streamlined feature matrix that is highly correlated with the sleep stage.
4. The automatic sleep staging method based on the ballistocardiographic signal and the double-layer stacking model according to claim 3, characterized in that: The dual stacking model based on the Stack strategy constructed in step S3 adopts a two-layer structure, in which the first layer is composed of multiple base models, which is used to process the simplified feature matrix output by step S2 to obtain diversified prediction vectors; the second layer is a meta-model, which is used to receive the prediction vectors output by the first-layer base models, and perform weighted fusion on these vectors to output the final sleep staging results.
5. The automatic sleep staging method based on the ballistocardiographic signal and the double-layer stacking model according to claim 4, characterized in that: The double stacking model training process constructed in step S3 is as follows: First, the obtained streamlined feature matrix is paired with the corresponding sleep stage labels to construct a sleep stage dataset for model training; Subsequently, a two-layer stacking model based on the stacking ensemble strategy was constructed. The first layer consisted of multiple base models. The gradient boosting decision tree (GBDT) model was combined with ABC-LogitBoost to complete the discriminative learning of high-dimensional features through adaptive category selection and zero-sum constraints. During training, the parameters of each base model are gradually optimized using the training dataset. Next, the output of the first-layer base model is used as input features to train the second-layer meta-model. The fusion weights are optimized through supervised learning, achieving two-stage collaborative training. An adaptive weight adjustment strategy based on category frequency is introduced during the training process. The second-layer meta-model uses the random forest RF model for integration and fusion, and adopts the majority voting method to achieve the final classification prediction of sleep stages.
6. The automatic sleep staging method based on the ballistocardiographic signal and the double-layer stacking model according to claim 5, characterized in that: In step S3, the double stacking model performs the following steps: Step S31: Input the obtained simplified feature matrix into the first-layer base model. The base model independently discriminates the input features, fully utilizing their respective advantages to process high-dimensional and complex sleep features, and obtains multi-dimensional classification results. Step S32: The output results of the first-layer base model are integrated and used as the input of the second-layer meta-model. The preliminary discrimination results are integrated and optimized through the integrated voting mechanism of multiple decision trees. Step S33: In the inference stage, by introducing an adaptive weight adjustment mechanism based on the frequency of category samples, the recognition priority of minority class samples is dynamically improved, and the intrinsic correlation of the characteristics of the cardiac shock signal is fully explored to ensure the balanced discrimination of the model in different sleep stages.
7. An automatic sleep staging device based on cardiac ballistic signals and a double-layer stacking model, characterized in that: include: A preprocessing unit is used to obtain the original BCG signal and perform preprocessing, wherein the original BCG signal is subjected to multi-scale decomposition and reconstruction based on the maximum overlap discrete wavelet transform (MODWT) to obtain the heartbeat interval sequence JJi; at the same time, the original BCG signal is processed based on the Butterworth low-pass filter (BLF) method to obtain the respiratory interval sequence BBi; A feature processing unit is used to perform feature processing on the heartbeat interval sequence JJi and the respiratory interval sequence BBi obtained by the preprocessing unit to construct a simplified feature matrix that is highly correlated with the sleep stage; The sleep staging processing unit is constructed based on a double stacking model of the Stack strategy and is obtained after training, and is used to process the simplified feature matrix obtained by the feature processing unit to output the sleep staging.
8. The automatic sleep staging device based on the ballistocardiographic signal and the double-layer stacking model according to claim 7, characterized in that: The dual stacking model based on the Stack strategy constructed in the sleep staging processing unit adopts a two-layer structure. The first layer consists of multiple base models, which are used to process the simplified feature matrix output by the feature processing unit to obtain diversified prediction vectors; the second layer is a meta-model, which is used to receive the prediction vectors output by the base models of the first layer, and perform weighted fusion on these vectors to output the final sleep staging results.
9. The automatic sleep staging device based on the ballistocardiographic signal and the double-layer stacking model according to claim 8, characterized in that: The training process of the double stacking model built in the sleep stage processing unit is as follows: First, the obtained streamlined feature matrix is paired with the corresponding sleep stage labels to construct a sleep stage dataset for model training; Subsequently, a two-layer stacking model based on the stacking ensemble strategy was constructed. The first layer consisted of multiple base models. The gradient boosting decision tree (GBDT) model was combined with ABC-LogitBoost to complete the discriminative learning of high-dimensional features through adaptive category selection and zero-sum constraints. During training, the parameters of each base model are gradually optimized using the training dataset. Next, the output of the first-layer base model is used as input features to train the second-layer meta-model. The fusion weights are optimized through supervised learning, achieving two-stage collaborative training. An adaptive weight adjustment strategy based on category frequency is introduced during the training process. The second-layer meta-model uses the random forest RF model for integration and fusion, and adopts the majority voting method to achieve the final classification prediction of sleep stages.