Sleep stage staging method based on clustering and self-coding
By combining the K-Means clustering algorithm and the Autoencoder autoencoder, deep analysis and dimensionality reduction processing of sleep data are solved, and the problems of low efficiency and poor accuracy of sleep stage staging methods in the existing technology are achieved, and fast and accurate sleep state and stage recognition are achieved.
Patent Information
- Application Number
- CN202510338851.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-06-20
AI Technical Summary
The existing sleep stage staging methods cannot effectively extract sample data, and the staging is relatively low, and the staging speed is also slow.
Using clustering and autoencoder methods, the sleep data is deeply analyzed and dimensionally reduced through the K-Means clustering algorithm and the Autoencoder autoencoder, key feature information is extracted, and the sleep state and stage recognition is carried out.
It significantly improves the speed and accuracy of sleep state monitoring and analysis, improves the practicality and reliability of sleep staging methods, and can quickly and accurately identify sleep stages.
Smart Images

Figure FDA0005322548410000011 
Figure FDA0005322548410000012 
Figure FDA0005322548410000021
Abstract
Description
Technical Field
[0001] The invention relates to a sleep stage classification method based on clustering and autoencoding, and belongs to the technical field of sleep detection. Background Art
[0002] Human health problems involve many factors, among which sleep health problems, as the most common health problem, deserve special attention. Poor sleep quality for a long time can lead to the possibility of health problems such as metabolic imbalance, cardiovascular disease, respiratory disease, and psychological depression. Monitoring the sleep quality of middle-aged and elderly people and analyzing the factors affecting their sleep quality are of great practical significance for improving the physical health of the middle-aged and elderly population. Therefore, people have invented convenient, wearable, contactless and other equipment to monitor sleep conditions throughout the night. Sleep health monitoring technology can help them understand their own sleep health status. Among them, sleep stage staging is an important part of sleep health monitoring. However, the existing sleep stage staging method cannot effectively extract sample data, the staging effectiveness is low, and the staging speed is also slow. Summary of the invention
[0003] The present invention provides a sleep stage classification method based on clustering and autoencoding, which can effectively solve the above problems.
[0004] A sleep stage classification method based on clustering and autoencoding, comprising the following steps:
[0005] S1, obtaining original sleep monitoring data: obtaining vital sign parameters through vital sign parameter measurement equipment;
[0006] S2, remove outliers and standardize the collected data, and then perform dimensionality reduction on the data;
[0007] S3, extract the cluster points C of the characteristic attributes through the K-Mean clustering algorithm, and confirm the Euclidean distance dis of each cluster center, and divide them into the same cluster according to the similarity principle;
[0008] S4, identifying the sleep state and sleep stage according to the K value of the clustering point C and the error index α.
[0009] In some embodiments, in step S1, the vital sign parameters include respiratory rate and heart rate.
[0010] In some embodiments, in step S2, the abnormal value removal is to remove the situation data whose status is identified as "small movement", "continuous movement", "calm", "quiet", "respiratory arrest" or "fall".
[0011] In some embodiments, in step S2, the dimensionality reduction process of the data is to use an Autoencoder to perform dimensionality reduction on the data, so that the output data has a low dimensionality and maintains the same features as the input data.
[0012] In some embodiments, the steps of using an Autoencoder to perform dimensionality reduction on the data are as follows:
[0013] First step: Map the collected data sample x i to the hidden layer h through an activation function in the input layer, and the activation function is: where ω1 is the encoding weight and b1 is the corresponding bias unit;
[0014] Second step: The hidden layer restores the input data sample; the collected data is represented as x i =(x1, x2,... x n ), and the output is represented as y i =(y1, y2,... y n ), and the cost function is: where: s is the number of input sample data, n is the input dimension, represents the j-th component of sample i, represents the j-th component of the corresponding output of sample i;
[0015] Third step: Repeat the first step and the second step to obtain the output data as the input of the clustering algorithm.
[0016] In some embodiments, step S3 specifically includes:
[0017] S31, Designate S objects corresponding to the values x k of deep sleep, light sleep, rapid eye movement, and awake states in the data sample as the center points, x k =x 心率 +x 呼吸率 ;
[0018] S32, Calculate the similarity between the current data and all center points;
[0019] S33, Determine the class to which the sample belongs. When the similarity is not equal to the threshold, a new class is formed;
[0020] S34, Recalculate the center points obtained after clustering, and repeat steps S32 - S33 until each class does not change; specifically: Initialize K clustering centers (c1, c2,... c k ), 1 ≤ K ≤ n, where K is the number of classes, and then calculate the Euclidean distance from each object to each clustering center where, x k represents the K-th object, cj represents the j-th clustering center, x kt represents the t-th attribute of the j-th object, c jt represents the t-th attribute of the j-th clustering center; successively compare the distance from each object to each clustering center, and assign the object to the cluster of the nearest clustering center to obtain K clusters {S1, S2, S3,..., Sk}, and obtain the centroid values K(k1, k2,…k n ); k1, k2, k3, k4 respectively correspond to the states of deep sleep, light sleep, rapid eye movement, and awake state.
[0021] S35, determine the error index value α within the centroid range,
[0022] In some embodiments, step S4 specifically includes:
[0023] Sleep state recognition: Taking a 1-second time period as a window, judge the time stamp t according to K and rules i is the state of deep sleep, light sleep, rapid eye movement, and awake state:
[0024] Taking a 1-second time period as a window, when the collected value x k is greater than k4 + α3, it is judged as sleep;
[0025] When the state is "sleep", and within the T time period, x k appears k3 + α2 times more than k2 + α2 times and is greater than or equal to ω1, it is judged that the sleep stage is the "rapid eye movement" state;
[0026] When the state is "sleep", and within the T time period, x k appears k2 + α1 times more than k1 + α1 times and is greater than or equal to ω2, it is judged that the sleep stage is the "light sleep" state;
[0027] When the state is "sleep", and within the T time period, x k appears k1 + α1 times and is greater than or equal to ω3, it is judged that the sleep stage is the "deep sleep" state;
[0028] ω1, ω2, ω3 are empirical values.
[0029] The beneficial effects of the present invention are:
[0030] The present invention proposes a sleep stage staging method based on clustering and autoencoding technology. The method cleverly combines Autoencoder self-encoding and clustering algorithms to perform in-depth analysis and classification processing on the collected sleep data. Through this innovative technical means, the key feature information in the data sample can be efficiently extracted, and then the originally complex and high-dimensional sample data features can be effectively reduced in dimension to convert them into low-dimensional data, thereby significantly improving the monitoring and analysis speed of the sleep state. The method adopts the K-Means clustering algorithm to accurately identify the feature differences under different sleep states, and find the clustering center of each feature data by calculation. Based on these clustering centers, the system can perform detailed stage identification of sleep data, and scientifically divide the sleep data of the whole night into four different sleep stages: awake period, rapid eye movement period, light sleep period and deep sleep period. The algorithm of the present invention not only performs well in accuracy and can provide reliable staging results, but also has significant advantages in operating efficiency, greatly reducing the running time of the algorithm, showing the characteristics of high efficiency, and providing strong technical support for sleep research and clinical application. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 This is the overall steps of the sleep stage classification method based on clustering and autoencoding according to an embodiment of the present invention.
[0033] Figure 2 This is a dimensionality reduction process of the sleep stage classification method based on clustering and autoencoding according to an embodiment of the present invention.
[0034] Figure 3 Schematic diagram of K-mens clustering of the sleep stage classification method based on clustering and autoencoding according to an embodiment of the present invention.
[0035] Figure 4 Schematic diagram of sleep staging of a sleep stage classification method based on clustering and autoencoding according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention.
[0037] An embodiment of the present invention provides a sleep stage staging method based on clustering and autoencoding techniques, as Figure 1 shown, and its specific implementation process is as follows: First, perform comprehensive data preprocessing operations on the sleep-related vital sign data collected by professional equipment. This step includes, but is not limited to, data cleaning, standardization, etc. Then, use the K-Means algorithm to effectively cluster them into pre-set clusters according to the similarity characteristics between the data, and obtain the cluster point data and corresponding error indicators required for subsequent analysis of the model during this process. Subsequently, based on the K value of the obtained cluster point C and the error indicator, accurately identify the individual's sleep state and the sleep stage it is in.
[0038] The method includes the following detailed steps:
[0039] S1, Obtain the original sleep monitoring data: Use high-precision vital sign parameter measurement equipment to obtain multiple vital sign parameters in real time and accurately, including heart rate, respiratory rate, etc.;
[0040] S2, Strictly remove outliers from the collected data to ensure the quality and reliability of the data. Subsequently, perform standardization processing on the data to eliminate the influence of different dimensions, and further perform dimensionality reduction processing on the data to simplify the complexity of subsequent analysis;
[0041] S3, Adopt the K-Means clustering algorithm to deeply extract the feature attribute cluster point C in the data, and accurately calculate the Euclidean distance dis between each clustering center. According to the similarity principle of the data, reasonably divide them into the corresponding clusters;
[0042] S4, Based on the K value of the cluster point C and the error indicator α, comprehensively analyze and identify the specific sleep state of the individual and the sleep stage it is in.
[0043] It is worth mentioning that by introducing the K-Means clustering algorithm, compared with the traditional adaptive clustering algorithm, the present invention has a significant improvement in calculation speed and can complete the recognition task of sleep states more quickly. At the same time, the clustering points of each human body state effectively found through K-Means clustering can not only efficiently extract the key features in the data samples, but also specifically solve the technical problems of the long calculation running time of the sleep classification model and the low algorithm accuracy in the prior art, thereby greatly improving the practicability and reliability of the sleep staging method.
[0044] In some specific embodiments, in the process involved in step S1, the vital sign parameters cover a plurality of key physiological indicators, including but not limited to core parameters such as respiratory rate and heart rate. The monitoring and recording of these parameters are crucial for subsequent data analysis and state judgment and can provide a more accurate health assessment for users.
[0045] Respiratory rate feature extraction: According to the physiological characteristics of the respiratory rate, a filter is designed to extract features such as the amplitude, frequency, and phase of the respiratory signal. For example, a low-pass filter is used to remove the high-frequency noise in the respiratory signal and retain the fundamental frequency component of respiration, reflecting the rhythm and depth of respiration.
[0046] Heart rate feature extraction: According to the physiological characteristics of the heart rate, a special filter is designed to extract features such as the periodic change and peak value of the heart rate. For example, a band-pass filter can be used to extract the main frequency components in the heart rate signal, reflecting the beating rule of the heart.
[0047] In some specific embodiments, in the operation performed in step S2, the operation of removing outliers specifically refers to effectively removing the data of special situations such as "small movements", "continuous movements", "calm", "quiet", "respiratory arrest", or "fall" determined by the state recognition system. The purpose of this step is to ensure that the data finally used for analysis has high accuracy and reliability, exclude the invalid data that may be caused by external interference or individual abnormal behaviors, and thus improve the performance of the overall monitoring system and the accuracy of the results.
[0048] In some specific embodiments, the data dimensionality reduction operation involved in step S2 is specifically to perform dimensionality reduction on the data by using the Autoencoder technology. This processing process aims to reduce the dimensionality of the output data while ensuring that the low-dimensional data output can maintain highly consistent feature information with the original input data. The Autoencoder unit plays a key role in this process. Based on the preprocessed data, it constructs and applies the Autoencoder to perform efficient dimensionality reduction on the massive data. By combining the Autoencoder technology with the clustering analysis method, in-depth analysis and classification of sleep data can be carried out, and key features in the data samples can be effectively extracted. The significant advantage of this method is that it can reduce the high-dimensional sample data features to low dimensions, thereby significantly improving the efficiency of data processing and analysis, making the monitoring and analysis of the sleep state faster and more accurate.
[0049] In some embodiments, the steps of using the Autoencoder to perform dimensionality reduction on the data are as Figure 2 shown, specifically:
[0050] First step: Map the collected data sample x i to the hidden layer h through an activation function in the input layer. The activation function is: where ω1 is the encoding weight and b1 is the corresponding bias unit; the activation function usually adopts a non-linear function, such as ReLU, Sigmoid, etc., to increase the non-linear expression ability of the model. The encoding weight and bias unit determine how the input data is mapped to the hidden layer. The number of neurons in the hidden layer is usually less than that in the input layer, so as to achieve data compression and feature extraction. Through the non-linear transformation of the activation function, complex patterns and features in the data can be captured. Mapping the high-dimensional data to the low-dimensional hidden layer realizes the dimensionality reduction of the data, reduces the complexity of the data, and at the same time retains the important information in the data. This helps to improve the efficiency and performance of the model and reduce the risk of overfitting.
[0051] Second step: The hidden layer restores the input data sample; the collected data is represented as x i =(x1, x2,... x n ), and the output is represented as y i =(y1, y2,... y n ). The cost function is: where: s is the number of input sample data, n is the input dimension, represents the j-th component of sample i, represents the j-th component of the corresponding output of sample i.
[0052] The hidden layer attempts to reconstruct the input data sample, that is, the output of the hidden layer is mapped back to the output layer with the same dimension as the input layer through the decoder. The decoder usually uses a structure and activation function symmetric to the encoder. The cost function is used to measure the difference between the reconstructed output and the original input, such as the mean squared error (MSE) commonly. When the output error E is small enough, it indicates that the input sample data can be reconstructed and represented by the hidden layer, and then the output of the hidden layer is the feature of the data sample. The original data passes through the filtering layer for dimension screening and finally obtains the output layer. Through the decoding and reconstruction process, it can be verified whether the features extracted by the hidden layer are complete and accurate enough. If the reconstruction error is small, it means that the hidden layer has successfully retained the key information in the data and can be used for subsequent analysis tasks. This process helps to further optimize the parameters of the encoder and decoder, improve the dimensionality reduction effect and generalization ability of the model.
[0053] Step 3: Repeat Step 1 and Step 2, and use the obtained output data as the input of the clustering algorithm. Through the learning process of the autoencoder, the essential features in the data can be extracted, the dimension of the data can be reduced, and the key information of the data can be retained at the same time. This helps to improve the efficiency and performance of the model, reduce the consumption of computing resources, and improve the interpretability and generalization ability of the model. The dimension-reduced data can be better used for subsequent clustering, classification and other tasks, improving the accuracy and stability of the model.
[0054] In the embodiments of the present invention, the standardized and dimension-reduced data after data preprocessing create good conditions for subsequent clustering analysis. The dimension-reduced data not only reduces the computational complexity, but also can better reflect the essential features of the data, enabling the K-Means clustering algorithm to more accurately extract the clustering points and divide the cluster classes of the feature attributes. The information such as the clustering points and clustering centers obtained by the clustering analysis provides an important basis for further sleep stage recognition. The two cooperate closely and play a synergistic role, jointly laying a foundation for the accurate judgment of sleep stages.
[0055] In some embodiments, as Figure 3 shown, step S3 specifically includes:
[0056] S31, specifying the values x corresponding to deep sleep, light sleep, rapid eye movement, and awake states in the data sample k of S objects as the center points, x k = x 心率 + x 呼吸率 .
[0057] This step is the starting point of the K-Means clustering algorithm, and the selection of the center points will affect the subsequent clustering results. The initial center points can be preset according to the typical features or numerical ranges of different sleep states, and the following steps can be followed:
[0058] Collect and analyze data: Collect a large amount of labeled sleep monitoring data, including vital sign parameters in deep sleep, light sleep, rapid eye movement, and wakefulness. Conduct statistical analysis on this data to determine the typical characteristics and value ranges of each parameter in each sleep state.
[0059] Determine typical characteristic values: For each sleep state, calculate the mean, median, or other representative statistics of its corresponding vital sign parameters. These values can be used as the typical characteristic values of this sleep state.
[0060] Set initial center points: Use the typical characteristic values of each sleep state as the coordinates of the initial center points. For example, if the typical value of a certain vital sign parameter in deep sleep is A, in light sleep is B, in rapid eye movement is C, and in wakefulness is D, then the initial center points can be set as (A, B, C, D) respectively.
[0061] For example, the following are the typical values of vital sign parameters in different sleep states:
[0062] Deep sleep: Heart rate 60 beats per minute, respiratory rate 12 breaths per minute, body movement frequency 0.2 times per minute.
[0063] Light sleep: Heart rate 70 beats per minute, respiratory rate 15 breaths per minute, body movement frequency 0.5 times per minute.
[0064] Rapid eye movement: Heart rate 80 beats per minute, respiratory rate 18 breaths per minute, body movement frequency 1.0 times per minute.
[0065] Wakefulness: Heart rate 90 beats per minute, respiratory rate 20 breaths per minute, body movement frequency 1.5 times per minute
[0066] Then, the initial center points can be set as follows: Deep sleep center point: (60, 12, 0.2); Light sleep center point: (70, 15, 0.5); Rapid eye movement center point: (80, 18, 1.0); Wakefulness center point: (90, 20, 1.5).
[0067] S32, Calculate the similarity between the current data and all center points. Usually, the Euclidean distance is used as the measure of similarity. The Euclidean distance can measure the distance between two data points in space, and the smaller the distance, the higher the similarity. In this embodiment, the data has been dimensionally reduced before calculating the similarity. By extracting the main features of the data, the dimension of the data is reduced while retaining the essential structure of the data, improving the efficiency and accuracy of similarity calculation.
[0068] S33. Determine the class to which the sample belongs. When the similarity is not equal to the threshold, a new class is formed. This step can divide data points into different classes, achieving preliminary clustering of the data. At the same time, by setting the threshold, outliers or new classes in the data can be discovered, increasing the flexibility and adaptability of the clustering.
[0069] In this step, different thresholds will lead to different clustering results. How to determine a suitable threshold is a challenge. An adaptive threshold determination method can be adopted to automatically calculate a suitable threshold according to the distribution and characteristics of the data. For example, by analyzing the distance distribution between data points, a dynamic threshold can be determined to make the clustering in different density regions more reasonable. When determining the class to which the sample belongs, the density information or local neighborhood information of the data points is combined. For example, using the idea of the DBSCAN algorithm, for regions with higher density, a smaller similarity threshold can be adopted; while for regions with lower density, a larger threshold is used to better adapt to the distribution of the data.
[0070] S34. Recalculate the center points obtained after clustering, and repeat steps S32 - S33 until each class does not change; specifically: Initialize K clustering centers (c1, c2,... c k ), 1 ≤ K ≤ n, where K is the number of classes. Then, calculate the Euclidean distance from each object to each clustering center where, x k represents the Kth object, c j represents the jth clustering center, x kt represents the tth attribute of the jth object, and c jt represents the tth attribute of the jth clustering center; Compare the distances from each object to each clustering center in turn, and assign the object to the cluster of the nearest clustering center to obtain K clusters {S1, S2, S3,..., Sk}, and obtain the centroid values K(k1, k2,... k n ); k1, k2, k3, k4 correspond to the states of deep sleep, light sleep, rapid eye movement, and wakefulness respectively. By continuously updating the center points and reassigning the data points, the clustering result can be gradually optimized, making the data points in each class more closely clustered around the center point, improving the accuracy and stability of the clustering. The iterative process can effectively reduce the randomness impact caused by the selection of the initial center points.
[0071] S35. Determine the error index value α within the range of the centroid, The error index value can intuitively reflect the compactness and separability of the clustering, helping to evaluate the performance of the clustering algorithm. Through these indexes, it can be judged whether the clustering result is reasonable and whether the clustering parameters need to be adjusted.
[0072] In the embodiments of the present invention, the feature clustering points C extracted in the clustering analysis step, along with their associated K values and error metrics, directly provide the key discriminant basis for the subsequent sleep stage recognition step. The sleep stage recognition step utilizes these clustering results, in combination with a time window and set rules, to accurately determine the sleep state and stage at each time point. The effectiveness and accuracy of the clustering analysis directly affect the accuracy of sleep stage recognition, while sleep stage recognition further transforms the results of the clustering analysis into practically meaningful sleep stage information. The two complement each other, jointly achieving in-depth analysis and accurate judgment of sleep data, and playing a synergistic role.
[0073] In some specific embodiments, as Figure 4 detailedly shown, step S4 specifically encompasses the following meticulous aspects: First, the sleep state is recognized. This process uses a 1-second time period as an observation window and, based on the pre-set parameter K and corresponding rules, precisely analyzes the timestamp data to determine the sleep state at the current moment, specifically including deep sleep, light sleep, rapid eye movement, and wakefulness.
[0074] Specifically, with a 1-second time period as the observation window, when the collected data value x k is greater than a certain pre-set threshold k4 + α3, the system initially determines the current state as "sleep". Further, when the system determines that the current state is "sleep", it will conduct a more detailed analysis of the collected data within a specific time period T: If within this time period T, the ratio of the number of times the data value x k exceeds a certain threshold k3 + α2 to the number of times it is lower than another threshold k2 + α2 is greater than or equal to a certain empirical value ω1, then it is determined that the current sleep stage is the "rapid eye movement" state; if within this time period T, the ratio of the number of times the data value x k exceeds a certain threshold k2 + α1 to the number of times it is lower than another threshold k1 + α1 is greater than or equal to another empirical value ω2, then it is determined that the current sleep stage is the "light sleep" state; and if within this time period T, the number of times the data value x k itself exceeds a certain empirical value, then it is determined that the current sleep stage is the "deep sleep" state. The various thresholds and empirical values ω3 mentioned here are all obtained based on a large amount of experimental data and clinical experience, and have high reliability and accuracy. By setting different thresholds and empirical values, this step can flexibly adapt to the sleep data characteristics of different individuals, accurately identify and classify various sleep states, and has strong generality and adaptability.
[0075] The sleep stage classification method generated by the K-Means clustering algorithm proposed in the embodiments of the present invention deeply analyzes and identifies various feature differences in the sleep state, and accurately finds the clustering centers corresponding to each feature. On this basis, the clustering points determined based on the sleep data are further used to carry out detailed and accurate sleep stage identification work, so as to scientifically divide the whole night's sleep data into four main sleep stages: the wake stage, the rapid eye movement (REM) stage, the light sleep stage, and the deep sleep stage. The algorithm adopted by the present invention not only shows high accuracy in the identification process through the close coordination and mutual cooperation between steps, but also greatly reduces the running time consumption of the algorithm, significantly improves the overall running efficiency of the algorithm, and fully reflects its advantage of high efficiency.
[0076] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A sleep stage classification method based on clustering and autoencoding, characterized in that: The following steps are involved: S1, obtaining original sleep monitoring data: obtaining vital sign parameters through vital sign parameter measurement equipment; S2, remove outliers and standardize the collected data, and then perform dimensionality reduction on the data; S3, extract the cluster points C of the characteristic attributes through the K-Mean clustering algorithm, and confirm the Euclidean distance dis of each cluster center, and divide them into the same cluster according to the similarity principle; S4, identifying the sleep state and sleep stage according to the K value of the clustering point C and the error index α.
2. The sleep stage classification method based on clustering and autoencoding according to claim 1, characterized in that: In step S1, the vital sign parameters include respiratory rate and heart rate.
3. The sleep stage classification method based on clustering and autoencoding according to claim 1, characterized in that: In step S2, the abnormal value removal is to remove the situation data whose status is identified as "small movement", "continuous movement", "calm", "quiet", "respiratory arrest" or "fall".
4. The sleep stage classification method based on clustering and autoencoding according to claim 1, characterized in that: In step S2, the dimensionality reduction processing of the data is to use an Autoencoder to reduce the dimensionality of the data so that the output data has a low dimensionality and maintains the same characteristics as the input data.
5. The sleep stage classification method based on clustering and autoencoding according to claim 4, characterized in that: The steps of using Autoencoder to reduce the dimension of data are as follows: The first step: collect the data sample x i The input layer is mapped to the hidden layer h through the activation function, and the activation function is: Among them, ω1 is the encoding weight and b1 is the corresponding bias unit; Step 2: The hidden layer restores the input data sample; the collected data is represented by x i =(x1,x2,…x n ), the output represents y i =(y1,y2,…y n ), the cost function is: Among them: s is the number of input sample data, n is the input dimension, represents the jth component of sample i, Indicates the jth component of the output corresponding to sample i; Step 3: Repeat steps 1 and 2 to obtain the output data as the input of the clustering algorithm.
6. The sleep stage classification method based on clustering and autoencoding according to claim 1, characterized in that: Step S3 specifically includes: S31, specifies the value x corresponding to the deep sleep, light sleep, rapid eye movement, and awake state in the data sample k The S objects are taken as the center point, x k =x 心率 +x 呼吸率 ; S32, calculating the similarity between the current data and all center points; S33, determining the category to which the sample belongs, and forming a new category when the similarity is not equal to the threshold; S34, recalculate the center point obtained after clustering, and repeat steps S32 to S33 until each category does not change; specifically: initialize K cluster centers (c1, c2, ... c k ), 1≤K≤n, where K is the number of categories, and then calculate the Euclidean distance from each object to each cluster center Among them, x k represents the Kth object, c j represents the jth cluster center, x kt represents the tth attribute of the jth object, c jt represents the tth attribute of the jth cluster center; compare the distance from each object to each cluster center in turn, assign the object to the cluster closest to the cluster center, obtain K clusters {S1, S2, S3, ..., Sk}, and obtain the stronghold value K (k1, k2, ...k n ); k1, k2, k3, k4 correspond to the states of deep sleep, light sleep, rapid eye movement, and wakefulness, respectively. S35, determining the error index value α within the clustering point range, 7. The sleep stage classification method based on clustering and autoencoding according to claim 1, characterized in that: Step S4 specifically includes: Sleep state recognition: Use 1 second as the window and determine the timestamp t based on K and the rule i It is the state of deep sleep, light sleep, rapid eye movement, and awake state: With a 1 second time period as the window, when the collected value x k When it is greater than k4+α3, it is judged as sleep; When the state is "sleep", and x k When the number of occurrences of k3+α2 is greater than or equal to ω1 compared to the number of occurrences of k2+α2, the sleep stage is judged to be in the "rapid eye movement" state; When the state is "sleep", and x k When the number of occurrences of k2+α1 is greater than or equal to ω2 compared to the number of occurrences of k1+α1, the sleep stage is judged to be a "light sleep" state; When the state is "sleep", and x k When the number of occurrences of k1+α1 is greater than or equal to ω3, the sleep stage is judged to be in the "deep sleep" state; ω1, ω2, ω3 are empirical values.