A user behavior habit prediction method based on wearable devices
By introducing time and feature attention mechanisms into the LSTM network and combining with the fully connected network, the Attention-LSTM composite model is constructed, which solves the problem that it is difficult for a single LSTM network model to obtain important time characteristics and the importance of different characteristics in the short term, and improves the accuracy of user behavior habit prediction.
Patent Information
- Application Number
- CN202210084498.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-01-25
AI Technical Summary
The existing single LSTM network model is difficult to obtain the important time characteristics and the importance of different characteristics in the short term of user data, which affects the prediction results of user behavior habits.
The Attention-LSTM composite model is adopted, and the time attention mechanism and feature attention mechanism are added to the LSTM network to obtain the timing information of the input data and the importance of different characteristics, and the model is output through the fully connected network.
It improves the accuracy of user behavior habit prediction, can better capture short-term dependencies and feature importance in user data, and enhances the model's ability to predict users' future behavior habits.
Smart Images

Figure CN114492990B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of wearable devices, and in particular to a method for predicting user behavior habits based on wearable devices. Background Art
[0002] According to the World Health Organization, insufficient physical activity is one of the 10 major risk factors for death worldwide, causing about 3.2 million deaths each year. Staying up late, obesity, and insufficient exercise are the norm for many people today. Monitoring and predicting people's own behavior habits is conducive to timely correcting people's unhealthy behavior habits, and can also provide a good data foundation for subsequent sports health management and chronic disease prediction, and provide a reference for user recommendation systems.
[0003] Human behavior habits can be measured by a variety of variables, such as sleep data, heart rate values, exercise volume and other physiological data, as well as exercise-related data. They are all highly personalized data and are of great significance for monitoring physical health. However, collecting highly personalized data requires a lot of resources. In recent years, the widespread emergence and popularization of wearable devices have provided great convenience for data to be obtained anytime and anywhere, greatly reducing the cost of data collection. In addition, it can use the rapidly developing data mining technology to achieve a more efficient and convenient intelligent prediction system, providing a new research direction for user behavior habit prediction.
[0004] Existing user behavior prediction methods include Markov (MC) models, traditional long short-term memory networks (LSTM), etc. However, since Markov assumes that the current state only depends on the state of the previous moment and ignores long-term historical information, the model is unable to model long-term dependencies in the data. In theory, LSTM can predict user behavior habits based on arbitrarily long past observations. However, traditional LSTM prediction methods ignore some important features when memorizing sequence patterns. On the one hand, user behavior habits may change in the short term, and the importance of data in time series is different. On the other hand, each user activity is different in terms of the possible start time and the possible duration. There are individual differences in user activities, and there are also differences in the importance of different features. The traditional single LSTM network model cannot well obtain these different importances in time series and features, which in turn affects the prediction results of the LSTM network on user behavior habits. Summary of the invention
[0005] The technical solution of the present invention: overcome the shortcomings of the prior art and provide a method for predicting user behavior habits based on wearable devices to overcome the defect that the current single LSTM network model is difficult to obtain important time features of user data in the short term, and solve the problem that it cannot distinguish the importance of different features well. In addition, combined with the advantage of wearable devices that can obtain a large amount of data at a relatively low cost, the accuracy of predicting users' future behavior habits is ultimately improved.
[0006] The technical solution of the present invention is a method for predicting user behavior habits based on wearable devices, the method comprising:
[0007] Step 1: Collect the physiological data, exercise-related data and basic feature data of the user during daily activities. The gyroscope sensor, acceleration sensor and electrocardiogram sensor of the wearable device are used to collect the characteristic data of the user's heart rate, sleep and exercise during daily activities. Combined with the collected basic feature data of the user: height, weight, age and gender, a multivariate feature vector X is constructed. t ={x1,...,x d ,...,x D}, where X t Represents the feature vector of a user's data relative to a certain day, containing D features, where D represents the feature dimension, x d Represents a certain dimension feature.
[0008] Step 2: preprocess the collected data.
[0009] 80% of the data in the collected data set is used as the training set, and 20% of the data is used as the test set. The training set and the test set are preprocessed, and the deviation standardization method is used to normalize the input data. The normalization formula is:
[0010]
[0011] Among them, x * is the normalized data, which ranges from [0, 1], x i is the original data, x max is the maximum value of the original data, x min is the minimum value of the original data;
[0012] Using the sliding window method, continuous data of length m is extracted from the training set, and the continuous data is used as the model training set X train , and finally X train The data format is converted into [N, m, D], where N represents the number of samples, m represents the length of the sequence data, and D represents the feature dimension; the data from the m+1th to the m+Tth of the Z features related to heart rate, sleep, and exercise are extracted as X trainLabel Y train , T=1,2,…,n, n represents the number of days, when T=1, Y train The data format is [N, Z], where Z represents the feature dimension of the label. When T is not 1, Y train The data format is [N, T*Z], and the test set X test The data format is converted to [C, m, D], where C represents the number of test samples and the label Y test The data format corresponds to that of the training set.
[0013] Step 3: Establish the Attention-LSTM composite model.
[0014] The established Attention-LSTM composite model is mainly integrated by the following three models:
[0015] The first part is an improved LSTM model based on the attention mechanism at different moments. The LSTM network adds a time attention module, that is, assigns attention weights to the temporal information. This model uses a 3-layer LSTM network. Assume that one output of the LSTM hidden layer is h t , then the attention weight α at time t t The calculation formula is as follows:
[0016] α t =W α T h t +b α
[0017] [α′1,...,α′ t ,...,α' L ]=softmax([α1,...,α t ,...,α L ])
[0018] Among them, W α T is the transpose of the parameter matrix, b α is the corresponding bias vector, h t is the hidden layer output vector of LSTM at time t, L is the sequence length, and then all weights are combined into a vector and input into the softmax function to obtain the final weight α′ at each moment. t , the output H based on the attention weight v The calculation formula is as follows:
[0019]
[0020] Among them, α′ t is the final weight at time t, and finally H vExpand to a one-dimensional vector H;
[0021] The second part is an improved LSTM model based on the attention mechanism of different features. The LSTM network adds a feature attention module, that is, assigns attention weights to each feature. This model uses a 2-layer LSTM network to take all the features x at all times of the input data. f The vector composed of f , feature x f The weight β f The calculation formula is as follows:
[0022] β f =W αd T h f +ν β
[0023] [β′1,...,β' f ,...,β' F ]=softmax([β1,...,β f ,...,β F ])
[0024] Among them, W αd T is the transpose of the parameter matrix, ν β is the bias vector, x f is a certain dimension feature of the input data, F represents the feature dimension of the input data, and then all weights are combined into a vector and input into the softmax function to obtain the final weight β' of each feature f , the output H based on the attention weight vd The calculation formula is as follows:
[0025]
[0026] Among them, β' f is feature x f The final weight, then H vd Input into the LSTM network to learn the time series pattern, and finally expand the final output of the LSTM network into a one-dimensional vector H";
[0027] The third part is a user behavior habit prediction integration model based on a fully connected network (FC). The outputs H and H” of the two LSTM improved models are spliced and input into the user behavior habit prediction integration model. The outputs of the two improved LSTM models are dynamically combined through the prediction integration model to improve the feature extraction capability without losing the feature’s temporal information, thereby outputting the final result.
[0028] Among them, the activation function of the last layer uses the linear activation function Linear, and the others use the activation function Relu.
[0029] Step 4: Use user data to train the Attention-LSTM composite model.
[0030] The training process is as follows: first, the weights of each layer of the model are randomly initialized, and then data is input. The LSTM model improved based on the Attention mechanism at different times and the LSTM model improved based on the Attention mechanism with different features output a one-dimensional feature vector H and H” respectively; then H and H” are concatenated as the input of the user behavior habit prediction integration model, and the output of the Attention-LSTM composite model is obtained by forward propagation. The loss is calculated based on the loss function and the true label, where the loss function uses the root mean square error; then the weights of each layer are updated by backpropagation, and the model is fitted and optimized through multiple iterations of gradient descent. The training process uses the adam optimizer to finally obtain a composite network model that has completed the training.
[0031] Step 5: Predict user behavior habits through the trained Attention-LSTM composite model, where the user behavior habits include the physiological data and exercise-related data trends during the user's daily activities.
[0032] The current and historical data of users collected by wearable devices are intercepted with data of the same length m as that when training the Attention-LSTM composite model, and the data format is converted to [sample, m, D], where sample represents the number of predicted samples. The data is input into the trained Attention-LSTM composite model to predict the trend of various features in the behavioral habits in the next T days. When T is not 1, after the prediction, the prediction result should be converted from two-dimensional to three-dimensional.
[0033] The advantages of the present invention compared with the prior art are:
[0034] (1) The present invention can predict the trends of the features related to exercise, heart rate and sleep in user behavior habits in the future. The current single LSTM network model will ignore some important features when memorizing sequence patterns. On the one hand, user behavior habits may change in the short term, and the importance of data in time series is different. On the other hand, there are individual differences in user activities, and there are also differences in importance between different features. The present invention introduces an Attention mechanism based on different moments and different features to obtain the time series information of input data and assign different attention weights to different features. Then, the output results of the two improved LSTM models are dynamically combined through a user behavior habit prediction integration model based on a fully connected network, which improves the feature extraction capability without losing the time series information of the features. In addition, combined with the advantage of wearable devices that can obtain a large amount of data at a lower cost, the accuracy of predicting the user's future behavior habits is ultimately improved.
[0035] (2) The present invention, in combination with wearable devices, can monitor and predict people's behavioral habits, which is conducive to timely correcting people's unhealthy behavioral habits. The addition of the attention mechanism also improves the interpretability of the neural network, thereby providing users with targeted suggestions based on certain features.
[0036] (3) In addition, the present invention will further promote the application of wearable device sensor technology in the fields of sports health management, disease prediction, user recommendation system, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of a method for predicting user behavior habits based on a wearable device of the present invention;
[0038] Figure 2 It is a schematic diagram of a network structure based on an attention mechanism and a long short-term memory network (Attention-LSTM) composite model of the present invention;
[0039] Figure 3 This is a structural diagram of the LSTM neural unit. DETAILED DESCRIPTION
[0040] The specific implementation modes of the present invention will be described below in conjunction with the accompanying drawings, and a method for predicting user behavior habits based on a wearable device provided by an embodiment of the present invention will be introduced in detail.
[0041] The flowchart of the method for predicting user behavior habits based on wearable devices in an embodiment of the present invention is as follows: Figure 1 As shown, the following steps are included:
[0042] Step 1: Collect the physiological data, exercise-related data and basic feature data of the user during daily activities. Use the gyroscope sensor, acceleration sensor and electrocardiogram sensor of wearable devices (smart bracelets, smart watches, etc.) to collect the heart rate, sleep and exercise-related feature data of the user during daily activities. Combined with the collected basic feature data of the user: height, weight, age and gender, construct a multivariate feature vector X t ={x1,...,x d ,...,x D}, where X t Represents the feature vector of a user's data relative to a certain day, containing D features, where D represents the feature dimension, x d represents a certain dimensional feature. In the embodiment of the present invention, D=8, and the feature vector is X t ={x1,x2,x3,x4,x5,x6,x7,x8}, where the eight features from x1 to x8 are: height (m), weight (kg), age, gender (0 for female, 1 for male), average daily heart rate, average daily exercise steps, average daily exercise duration, and average daily sleep duration.
[0043] Step 2: preprocess the collected data.
[0044] Step 2.1: 80% of the data in the collected data set is used as the training set, and 20% of the data is used as the test set. The training set and the test set are normalized. The normalization formula is:
[0045]
[0046] Among them, x * is the normalized data, which ranges from [0, 1], x i is the original data, x max is the maximum value of the original data, x min is the minimum value of the original data.
[0047] Step 2.2: Use the sliding window method to extract continuous data of length m from the training set, and use the continuous data as the model training set X. train , and finally X train The data format is converted to [N, m, 8], where N represents the number of samples, m represents the length of the sequence data, and 8 represents the feature dimension. In this embodiment, Z=4, and the m+1th to m+Tth data of the four features of the user's daily average heart rate, daily average number of exercise steps, daily average exercise duration, and daily average sleep duration are extracted as X train Label Y train , T=1,2,…,n, n represents the number of days; when T=1, Y trainThe data format is [N, 4], where 4 represents the feature dimension of the label. When T is not 1, Y train The data format is [N, T*4], and the test set X test The data format is converted to [C, m, 8], where C represents the number of test samples and the label Y test The data format corresponds to that of the training set.
[0048] Step 3: Establish the Attention-LSTM composite model. Figure 2 : is a schematic diagram of the network structure of the Attention-LSTM composite model of the present invention, and the network structure schematic diagram includes three parts:
[0049] The first part is an LSTM model improved based on the Attention mechanism at different times. User behavior habits may change in a short period of time, and the importance of data in time series varies. The LSTM network adds a time attention module to assign attention weights to time series information. Too many LSTM layers can easily lead to overfitting of the model and difficulty in convergence. Therefore, the LSTM model improved based on the Attention mechanism at different times includes a 3-layer LSTM network.
[0050] The second part is an improved LSTM model based on the Attention mechanism of different features. There are individual differences in user activities, and there are also differences in importance between different features. The LSTM network adds a feature attention module to assign attention weights to each feature. This model contains a 2-layer LSTM network;
[0051] The LSTM units in the above two improved modules are used to model user data. The LSTM unit structure is as follows: Figure 3 As shown, the input of each neuron is the input x of the network at the current moment. t , the unit state c at the previous moment t-1 And the output value h at the previous moment t-1 , the output of each neuron is the output value h at the current moment t and the current cell state c t ; The three gating units are forget gate z f , controls the cell state c at the previous moment t-1 Which information is retained until the current time c t , input gate z i , for the current input x t Optionally save to cell state c t , output gate z ° , determines the cell state c t How many outputs are there to the current h t , z tIt is the unit state input. The specific update of each gate and each unit state is as follows:
[0052] Forget gate: z f =σ(W f ·[h t-1 ,x t ]+b f )
[0053] Input gate: z i =σ(W i ·[h t-1 ,x t ]+b i )
[0054] Output gate: z o =σ(W f ·[h t-1 ,x t ]+b o )
[0055] Unit state input: z t =tanh(W·[h t-1 ,x t ]+b)
[0056] Unit status: c t =z f ⊙c t-1 +z i ⊙z t
[0057] Hidden state output at the current moment: h t =z ° ⊙tanh(c t )
[0058] Among them, W f ,W i ,W o ,W represents the weight matrix, b f ,b i ,b o ,b represents the bias vector, square brackets represent vector concatenation, tanh represents the hyperbolic tangent activation function, and σ represents the sigmoid activation function;
[0059] The LSTM model is improved based on the Attention mechanism at different times. After the Attention mechanism is applied to the LSTM network, an output of the LSTM hidden layer is set to h t , then the attention weight α at time t t The calculation formula is as follows:
[0060] α t =W αT h t +b α
[0061] [α′1,...,α′ t ,...,α' L ]=softmax([α1,...,α t ,...,α L ])
[0062] Among them, W α T is the transpose of the parameter matrix, b α is the corresponding bias vector, h t is the hidden layer output vector of LSTM at time t, L is the sequence length, and then all weights are combined into a vector and input into the softmax function to obtain the final weight α′ at each moment. t , the output H based on the attention weight v The calculation formula is as follows:
[0063]
[0064] Among them, α′ t is the final weight at time t, and finally H v Expand to a one-dimensional vector H;
[0065] The LSTM model improved by the Attention mechanism based on different features. Before the Attention mechanism is applied to the LSTM network, all the features x of the input data at all times are f The vector composed of f , feature x f The weight β f The calculation formula is as follows:
[0066] β f =W αd T h f +ν β
[0067] [β′1,...,β′ f ,...,β' F ]=softmax([β1,...,β f ,...,β F ])
[0068] Among them, W αd T is the transpose of the parameter matrix, ν β is the bias vector, x fis a certain dimensional feature of the input data, and F represents the characteristic dimension of the input data. In this embodiment, x f ∈{x1,x2,x3,x4,x5,x6,x7,x8}, that is, F = 8, and then all the weights are combined into a vector and input into the softmax function to obtain the final weight β' of each feature f , the output H based on the attention weight vd The calculation formula is as follows:
[0069]
[0070] Among them, β' f is feature x f The final weight, then H vd Input into the LSTM network to learn the time series pattern, and finally expand the final output of the LSTM network into a one-dimensional vector H";
[0071] The third part is a user behavior habit prediction integration model based on a fully connected network (FC). The outputs H and H” of the two LSTM improved models are spliced and input into the user behavior habit prediction integration model. The outputs of the two improved LSTM models are dynamically combined through the prediction integration model to improve the feature extraction capability without losing the feature’s temporal information, thereby outputting the final result.
[0072] Among them, the activation function of the last layer uses the linear activation function Linear, and the others use the activation function Relu.
[0073] Step 4: Use user data to train the Attention-LSTM composite model.
[0074] Considering that the last layer of the Attention-LSTM composite model is a fully connected layer, its output can only be a two-dimensional matrix at most. Therefore, when the prediction length T is 1, that is, predicting the user's time series feature data for the next day, the format of the label data can be [N, 4]. When T is not 1, that is, predicting the user's time series feature data for the next T days, the format of the label data needs to be converted to [N, T*4] before inputting the data into the model. After the prediction is made, the prediction result is converted from two-dimensional to three-dimensional.
[0075] Training process: First, the weight of each layer of the model is randomly initialized, and then the data is input. The LSTM model improved based on the Attention mechanism at different times and based on different features outputs a one-dimensional feature vector H and H' respectively; then H and H' are spliced as the input of the user behavior habit prediction integration model, and the output of the Attention-LSTM composite model is obtained by forward propagation. The loss is calculated according to the loss function and the true label, where the loss function uses the root mean square error (RMSE). Then the weight of each layer is updated by back propagation. The model is fitted and optimized through multiple iterations of gradient descent. The training process uses the adam optimizer to finally obtain the trained composite network model. The RMSE calculation formula is as follows:
[0076]
[0077] Among them, s is the number of samples, y i ,y i ′ are the true value and the predicted value respectively.
[0078] Step 5: Predict user behavior habits through the trained Attention-LSTM composite model, where the user behavior habits include the physiological data and exercise-related data trends during the user's daily activities.
[0079] The current and historical data of users collected by wearable devices are intercepted with data of the same length as that of m when training the Attention-LSTM composite model, and the data format is converted to [sample, m, 8], where sample represents the number of predicted samples, m represents the length of the sequence data, and 8 represents the feature dimension. It is input into the trained Attention-LSTM composite model to predict the trend of the four features of the user's behavior habits, namely, the average heart rate, the average number of steps, the average exercise duration, and the average sleep duration in the next T days. When T is not 1, after the prediction, the prediction result should be converted from the two-dimensional [sample, T*4] format to the three-dimensional [sample, T, 4] format.
[0080] In summary, the present invention uses various sensors of wearable devices to collect physiological data and motion-related data of users during daily activities, combines them with basic feature data, and then preprocesses them. The trained Attention-LSTM composite model is used to predict the trends of motion, heart rate, and sleep-related features in user behavior habits in the future.
[0081] The present invention proposes an improvement method for the problems that the current single LSTM network model is difficult to obtain the important time features of the input user data in the short term, and the single LSTM network is also unable to distinguish the importance of different features. Two Attention mechanisms are introduced, and the output results of the two improved LSTM models are dynamically combined through the user behavior habit prediction integration model, which improves the feature extraction capability without losing the time series information of the features. In addition, the advantage of wearable devices that can obtain a large amount of data at a relatively low cost is combined, and the accuracy of predicting the user's future behavior habits is finally improved. The present invention can monitor and predict people's own behavior habits in combination with wearable devices, which is conducive to timely correcting people's unhealthy behavior habits. In addition, the present invention will further promote the application of wearable device sensor technology in the fields of sports health management, disease prediction, and user recommendation systems.
[0082] Although the specific implementation methods of the present invention are described above, those skilled in the art should understand that these are only examples, and that various changes or modifications may be made to these implementation methods without departing from the principles and implementations of the present invention. Therefore, the scope of protection of the present invention is limited by the appended claims.
Claims
1. A method for predicting user behavior habits based on wearable devices, characterized in that: The method comprises: Step 1: Collect the physiological data, exercise-related data and basic feature data of the user during daily activities. The gyroscope sensor, acceleration sensor and electrocardiogram sensor of the wearable device are used to collect the characteristic data of the user's heart rate, sleep and exercise during daily activities. Combined with the collected basic feature data of the user: height, weight, age and gender, a multivariate feature vector is constructed. ,in, Represents the feature vector of a user's data relative to a certain day, including D features, where D represents the feature dimension. Represents a certain dimension feature; Step 2, preprocessing the collected data; Step 3: Establish an LSTM model based on the improved Attention mechanism at different times and an LSTM model based on the improved Attention mechanism at different features at the same time, and then use the user behavior habit prediction integration model based on the fully connected network (FC) to integrate the two improved models to establish a composite model based on the attention mechanism and the long short-term memory network, namely the Attention-LSTM composite model; Step 4: Use user data to train the Attention-LSTM composite model; Step 5: predicting user behavior habits through the trained Attention-LSTM composite model, wherein the user behavior habits include the physiological data and exercise-related data trends during the user's daily activities; The Attention-LSTM composite model in step 3 is integrated by the following three models: The first part is an improved LSTM model based on the attention mechanism at different moments. The LSTM network adds a time attention module, that is, assigns attention weights to the time series information. This model uses a 3-layer LSTM network. Suppose one output of the LSTM hidden layer is ,but Attention weight at each moment The calculation formula is as follows: , in, is the transpose of the parameter matrix, is the corresponding bias vector, for The hidden layer output vector of LSTM at the moment, L is the sequence length, and then all weights are combined into a vector and input into the softmax function to obtain the final weight at each moment , the output based on the attention weights The calculation formula is as follows: , in, for The final weight at the moment, Expand to a one-dimensional vector ; The second part is an improved LSTM model based on the attention mechanism of different features. The LSTM network adds a feature attention module, that is, assigns attention weights to each feature. This model uses a 2-layer LSTM network to take all the features of the input data at all times. The vector composed of ,feature Weight The calculation formula is as follows: , in, is the transpose of the parameter matrix, is the bias vector, is a certain dimension feature of the input data, F represents the feature dimension of the input data, and then all weights are combined into a vector and input into the softmax function to obtain the final weight of each feature , the output based on the attention weights The calculation formula is as follows: , in, Features The final weight of Input into the LSTM network to learn the time series pattern, and finally expand the final output of the LSTM network into a one-dimensional vector ; The third part is a user behavior habit prediction integration model based on a fully connected network (FC), which combines the outputs of the two LSTM improved models. The splicing input is then fed into the user behavior habit prediction integration model. The outputs of the two improved LSTM models are dynamically combined through the prediction integration model, which improves the feature extraction capability without losing the feature's temporal information, thereby outputting the final result. Among them, the activation function of the last layer uses the linear activation function Linear, and the others use the activation function Relu.
2. The method for predicting user behavior habits based on wearable devices according to claim 1, characterized in that: The collected data is preprocessed in step 2, including: 80% of the data in the collected data set is used as the training set, and 20% of the data is used as the test set. The training set and the test set are preprocessed, and the deviation standardization method is used to normalize the input data. The normalization formula is: , in, is the normalized data, which ranges from [0, 1]. is the original data, is the maximum value of the original data, is the minimum value of the original data; Using the sliding window method, continuous data of length m is extracted from the training set, and the continuous data is used as the model training set. , and eventually The data format is converted into [N, m, D], where N represents the number of samples, m represents the length of the sequence data, and D represents the feature dimension; the data from the m+1th to the m+Tth of the Z features related to heart rate, sleep, and exercise are extracted as Tags , T=1,2,…,n, n represents the number of days, when T=1 The data format is [N, Z], where Z represents the feature dimension of the label. When T is not 1 The data format is [N, T Z], and the test set The data format is converted to [C, m, D], where C represents the number of test samples and the label The data format corresponds to that of the training set.
3. The method for predicting user behavior habits based on wearable devices according to claim 1, characterized in that: Step 4 uses user data to train the Attention-LSTM composite model, including: The training process is as follows: first, the weights of each layer of the model are randomly initialized, and then the data is input. The LSTM model improved based on the Attention mechanism at different times and the LSTM model improved based on the Attention mechanism of different features respectively output a one-dimensional feature vector and ; then and The splicing is used as the input of the user behavior habit prediction integrated model. The output of the Attention-LSTM composite model is obtained by forward propagation. The loss is calculated according to the loss function and the true label, where the loss function uses the root mean square error. The weight of each layer is updated by backpropagation, and the model is fit and optimized through multiple iterations of gradient descent. The training process uses the adam optimizer to finally obtain a composite network model that has completed training.
4. The method for predicting user behavior habits based on wearable devices according to claim 1, characterized in that: In step 5, the user behavior habits are predicted by the trained Attention-LSTM composite model, including: The current and historical data of users collected by wearable devices are intercepted with data of the same length m as that when training the Attention-LSTM composite model, and the data format is converted to [sample, m, D], where sample represents the number of predicted samples. The data is input into the trained Attention-LSTM composite model to predict the trend of various features in the behavioral habits in the next T days. When T is not 1, after the prediction, the prediction result should be converted from two-dimensional to three-dimensional.
Citation Information
Patent Citations
Multi-sensor time series analysis model based on attention mechanism
CN111291804A
Cloud platform resource prediction method based on double-layer attention mechanism
CN113033780A