The model consists of nine steps in sequential order. Clustering is performed in steps 3 to 5 using the user’s sleep data to define patterns. Currently, the user’s sleep data are rearranged into patterns. Steps 6 to 9 express detailed sleep patterns by adding user satisfaction data through additional surveys. The user’s satisfaction data, obtained through the survey, are used to respecify the recommendation presented to the user. The CDSRS uses a hybrid learning method to learn and test the dataset, evaluate the learning model, and provide more appropriate recommendations based on the user’s sleep evaluation through top-N recommendations with higher accuracy than traditional filtering techniques. Fusion care is defined by combining user feedback evaluations with sleep data. The preferred sleep pattern is constructed by determining the healthcare service paradigm and data content. Additionally, a personalized profile is created through the service model, which suggests individualized services by analyzing noise and BMI during sleep.
3.2. Learning Methods of the Deep Sleep System
The key idea behind the system’s process is to analyze the user profile and preferences by using clustered recommendations in a motion bed environment and to calculate the similarity index between the user and sleep patterns based on feedback evaluations to achieve optimization. The CDSRS is composed of various features and learning methods, as shown in
Figure 3.
The algorithm used in the data analysis and user profile server is the K-means clustering technique, which is used for pattern analysis because there is no similarity between sleep data (snoring, noise, BMI, sleep time). The process involves two steps: finding the K-value using the Elbow Method in step 1 and verifying the appropriate K-value using the silhouette validation algorithm in step 2 [
35].
Table 1 describes the definition of the algorithm, including specific parameters.
The process shown in
Figure 4 suggests sleep to the user based on a predefined pattern. First, we create a profile using the user’s sleep data. We then create a sleep matrix with the K-means classification model for the classification of less relevant sleep data such as BMI, sleep time, and snoring. If the profile is created, you will continue to the next step, but if not, you will reconfigure the profile. The CF model is then used to make recommendations, receive user feedback, and reconstruct profiles using hybrid learning methods. After that, a test is conducted with a learning and evaluation model using Knn, and finally, the output is received as a top-N classification model. If the result of the algorithm obtains the list you want, the algorithm ends; otherwise, it goes back to the profile configuration step.
The CDSRS algorithm consists of the following. The input value is the user’s sleep data, which contains data such as sleep time, moving, sound, and snoring; see
Figure 5 for more information. The output value is a list of recommendations from the top-N classification of hybrid learning methods. In this case, the user can control the motion bed by selecting the desired item from the recommendation list. The first of the algorithms constructs a user’s profile with the user’s sleep data. Then, it uses the K-means classification model to create a sleep matrix in a similar group. When a sleep matrix is created, it uses a CF algorithm to calculate similarity and provide recommendation services. Otherwise, it returns to the profile configuration step. In this process, you will receive an evaluation and add it to your profile, gaining sleep pattern analysis data for hybrid learning. Once the appropriate values are obtained, we test them using the evaluation model and, finally, train the top-N classification model. However, the obtained Nan values will be retrained with the Knn algorithm. The last return value is the top-N recommendation you set, and if the number of recommendations you want is achieved, the process ends; otherwise, it returns to the profile configuration step. The process of the CDSRS algorithm is as follows in Algorithm 1.
Algorithm 1: CDSRS |
Input | User’s sleep data |
Output | Top-N Categorized Recommendation List |
1. | Create profile with Sleep Data |
2. | Use K-means Classification model |
3. | IF System create Sleep Matrix (SM) with Sleep Data |
4. | then, Use CF to Deep Sleep Service recommendation based on (SM) similarity |
5. | Save & Update User’s Rating |
6. | Else: Back to line 2 |
7. | Training Sleep Recommendation model |
8. | IF System have recommendation results |
9. | then, Test set to Evaluate model |
10. | If Loss value is Nan: |
11. | then, Train Set Using Knn |
12. | Back to line 10 |
13. | else: |
14. | Learning Top-N Classification Model |
15. | return (Top-N Sleep Recommendations) |
16. | Else: |
17. | Train set Using Knn |
18. | Test set to Evaluate model |
19. | If Loss value is Nan: |
20. | then, Train Set Using Knn |
21. | else: |
22. | Learning Top-N Classification Model |
23. | return (Top-N Sleep Recommendations) |
24. | Save & Update Profile |
25. | IF Top-N Sleep recommendations == User wants |
26. | then, Process End |
27. | return (Top-N Sleep Recommendations) |
28. | Else: Back to line 1 |
In lines 1 to 2, Algorithm 2 integrates information such as BMI, noise, etc., to calculate similarity and improve patterns. In lines 3 to 5, we repeat the similarity calculation between the sleep matrix (SM) and the user (U) to configure the user-defined profile using Algorithm 3. The resulting data are no longer independent, and this method is called hybrid learning, which combines profile and user evaluation results. This hybrid learning method solves the cold start problem for new users.
Finally, in lines 9 to 24, the user’s assessment of the proposed sleep recommendation is used by Algorithm 4 to analyze the data into a top-N classification. This learning method reconstructs user profiles and excludes less relevant sleep data. This allows you to improve your personalized recommendations through repeated feedback assessments.
Algorithm 2: CSPD (Clustering for Sleep Pattern Definition) |
Input | User’s sleep data |
Output | sum_of_squared_distance, k |
1. | sum_of_squared_distance = [] |
2. | for k = 1, k in range(1,9) do |
3. | ; |
4. | return (sum_of_squared_distance, k) |
5. | |
6. | ; |
7. | def i in X,C,D: |
8. | |
9. | |
10. | Label = KMeans(n_clusters = k) |
11. | return (s(i),k) |
Algorithm 3: PUSA (Prediction User Similarity Algorithm in Sleep Pattern Label) |
Input | sim(U1,U2),SM(Sleep Rating Matrix) |
Output | sim_score |
1. | |
2. | If labeln not in [SM]: |
3. | Break; |
4. | else: |
5. | Return sum([pow(RatingMatrix [U1][SM]–RatingMatrix [U2][SM],2)]) |
6. | For labeln in RatingMatrix [U1] |
7. | If labeln in RatingMatrix [,U2] |
8. | then, Ignore score sim < 1 |
9. | Return (sim_score) |
Algorithm 4: PHRA(Prediction of Hybrid Learning Top-N Rating Algorithm) |
Input | RatingMatrix |
Output | Top-N recommendation list |
1. | RatingMatrix = Sleep Pattern Rating Matrix |
2. | |
3. | For U in RatingMatrix: |
4. | if U not in RatingMatrix |
5. | Break |
6. | else: |
7. | result [RM] = Rpredict |
8. | return result |
9. | Sort list (RatingMatrix SM list) |
10. | Return (Top-N recommendation list) |
3.2.1. User Profile Configuration
The profile module consists of pattern analysis, profile management, and feedback reflection. Each module is composed of a user profile and sleep content that reflects the user’s sleep time, BMI, snoring measurement, and noise level during sleep. This basic step helps generate recommendations for personalization and sleep preference collection related to the learning method.
Figure 5, below, illustrates the profile structure, explaining the collection and analysis of user data, which helps create customized sleep recommendation content.
First, the user file consists of the user’s ID data, UID, PW, name, sleep data, BMI, birth, and gender. Sleep data are collected through the bed and consist of sleep time, moving, sound, and snoring. For personalized referral systems, we preprocess the UID to configure the sleep matrix and reconstruct it into SMID, pattern label, and rating data. Finally, the algorithm constructs the data in the rating matrix based on the pattern label and the user evaluation.
The creation of a profile is a core feature of personalized sleep recommendation services, which is aided by the learning method. Users can evaluate the first recommended sleep and choose recommendations for sleep content through analysis. This allows users to agree with the analysis of their profile information, enabling the process to be repeated and providing more appropriate content.
With vast amounts of data, classification and definition must be accurately determined, as ambiguous and unrelated data can lead to unclear analysis results. This can result in a loss of meaning and features even if users are classified. Therefore, evaluation and reflection are added to the profile construction process to ensure an accurate optimization process. This reconstruction of the profile helps with user satisfaction and the processing of the profile.
3.2.2. Cold Start Problem
The cold start problem refers to the situation where a recommendation system cannot provide appropriate recommendations to new users because of insufficient pre-existing information. To solve this problem, the CDSRS uses a hybrid learning approach to reconfigure the user’s profile through feedback, even for new users, so that appropriate recommendations can be made.
3.2.3. Defining User Sleep Patterns
The sleep data collected with the AI bed consists of snoring, noise during sleep, BMI, and sleep duration. However, given the nature of sleep data, there is a lack of correlation between the variables. This can lead to inadequate recommendations even after classifying the data. Therefore, we use the K-means algorithm to create meaningful correlations. The K-means algorithm is used to classify data into k clusters, which define the user’s sleep patterns and help find similarities between users and predict additional patterns.
The pseudocode below describes the process of defining sleep patterns, which has a significant impact on recommendations. First, lines 1 to 4 calculate the distance using sleep data and determine the number of centroids (k-value). Lines 5 to 10 go through the silhouette validation process to derive an appropriate k-value out of multiple values. Line 11 returns the silhouette value and the k-value.
Figure 6 shows a graph of changes in the k-value according to the sum of squared distances. We judge that the appropriate k-value is around three to five, and to verify this, the silhouette validation method is used. At this point, the k-value is defined as the number of sleep patterns.
Figure 7 represents the process of determining the appropriate number of sleep patterns before recommending similar sleep to users. The silhouette score increases or decreases as the value of k increases. When the k-value is five, the optimal silhouette score is obtained, and it is confirmed that it decreases when the k-value is six, so the efficiency is best when the number of clusters is five.
Through the above process, user profile information is generated. By clustering the data, the meaning of the data becomes clearer, and user satisfaction can be confirmed through recommendations.
3.2.4. Collaborative Filtering
Collaborative filtering predicts users’ interests based on evaluations and feedback gathered from multiple users. With this method, we increase the similarity between users and generated recommendations using sleep-data-based profiles. The resulting process is conceptually simple. When given a user, we normalize their sleep data, calculate the distance from the cluster centroids, and find the cluster corresponding to the user’s sleep pattern. Then, we recommend similar users from that cluster. The algorithm does not need to compute the similarity between all users. The idea is to recommend the most similar sleep patterns between a specific cluster and its corresponding users. This is performed by constructing a user sleep rating matrix, as shown in
Table 2.
PUSA uses the Euclidean distance calculation. However, it can be difficult to compare values with just the Euclidean distance formula. Therefore, the algorithm normalizes the data values to create a rating matrix. Additionally, the algorithm explains how to calculate the similarity between two users in the given user SM. The similarity value ranges from −1 to 1, with 1 indicating high similarity and −1 indicating that the users are dissimilar. The defined sim (U1, U2) is used to calculate the similarity between each SM and the users.
Lines 1 to 5 of Algorithm 3 explain how to calculate the similarity between users using Euclidean distance. Lines 6 to 8 transform the values to be in a range of −1 to 1 to construct an SM (Sleep matrix), which represents the ratings given by all users for the same sleep patterns, as shown in
Table 3. In this algorithm, the recommendation is based on distance similarity between users and is used as the default setting for user preferences. Values from other patterns are ignored.
3.2.5. User-Based filtering
User-based filtering considers user preferences and ratings to recommend relevant preferences, bringing in the user’s sleep-related attributes and calculating the similarity with evaluation items provided in the user’s sleep data profile. Conceptually, the algorithm operates by determining the sleep patterns that the user is most likely to rate similarly based on past evaluations. In this scenario, the user-based recommendation system continuously relearns using the user profile. The algorithm equation calculates the predicted score by multiplying the user’s evaluation weight by the sim similarity. This is the algorithm that predicts the recommended sleep patterns and scores using the top-N method based on the user’s rated sleep pattern evaluation, as shown in lines 1 to 7 [
36]. The final formula for the learning method is Algorithm 4.
Several models can be used to obtain similarity values within a group of sleep patterns and obtain predicted values using sleep pattern evaluations. This is because we want to assign importance levels that vary according to user evaluations. Sleep data analysis considering user evaluations is related to the user’s sleep time, snoring, and primarily recommended sleep evaluations. Through this, the filtering process can create more accurate similar users compared with the initially calculated similar users. The pseudocode in lines 8 to 9 describes the SM list using the predicted values calculated with user evaluations and similarity. This algorithm is effective in the sleep evaluation matrix, so it is ultimately used to normalize weight evaluations.
The proposed algorithm relies on user feedback and engagement, as it is based on user evaluations for profile processing. The learning method’s model is based on user feedback information and user profile feedback. The personalized inference engine analyzes and processes the sleep group, while the recommendation and the adaptation device are integrated with the inference function. The profile is composed of five attributes: sleep duration, snoring severity, noise, BMI, and five sleep patterns. User-based collaborative filtering is utilized in the recommendation algorithm to address the cold start problem.