WO2020168444A1 - Sleep prediction method and apparatus, storage medium, and electronic device - Google Patents

Sleep prediction method and apparatus, storage medium, and electronic device Download PDF

Info

Publication number
WO2020168444A1
WO2020168444A1 PCT/CN2019/075342 CN2019075342W WO2020168444A1 WO 2020168444 A1 WO2020168444 A1 WO 2020168444A1 CN 2019075342 W CN2019075342 W CN 2019075342W WO 2020168444 A1 WO2020168444 A1 WO 2020168444A1
Authority
WO
WIPO (PCT)
Prior art keywords
user
sleep
day
sleep prediction
electronic device
Prior art date
Application number
PCT/CN2019/075342
Other languages
French (fr)
Chinese (zh)
Inventor
戴堃
吴建文
陆天洋
帅朝春
张寅祥
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2019/075342 priority Critical patent/WO2020168444A1/en
Priority to CN201980074323.6A priority patent/CN112997148A/en
Publication of WO2020168444A1 publication Critical patent/WO2020168444A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This application belongs to the field of computer technology, and in particular relates to a sleep prediction method, device, storage medium, and electronic equipment.
  • electronic devices such as tablet computers and mobile phones are configured to perform system updates while the user is sleeping, and other operations that affect the user's use or take a long time to avoid affecting the user's use.
  • the related technology achieves the foregoing purpose by predicting the user's sleep, such as predicting the user's sleep interval, etc.
  • the accuracy of the related technology for predicting the user's sleep is low.
  • the embodiments of the present application provide a sleep prediction method, device, storage medium, and electronic device, which can enable the electronic device to accurately predict the user's sleep.
  • an embodiment of the present application provides a sleep prediction method applied to an electronic device, including:
  • an embodiment of the present application provides a sleep prediction device applied to an electronic device, including:
  • the date identification module is used to identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met;
  • the model acquisition module is used to acquire the pre-trained sleep prediction model corresponding to the non-working day when the recognition result of the recognition module is yes;
  • a data acquisition module for acquiring behavioral data of the user on the current day and historical non-working days, where the historical non-working days are the same type of non-working days before the current day;
  • the sleep prediction module is configured to perform sleep prediction on the user according to the behavior data and the sleep prediction model to obtain a prediction result.
  • an embodiment of the present application provides a storage medium on which a computer program is stored.
  • the computer program is executed on a computer, the computer is caused to execute the sleep prediction method provided in the embodiment of the present application. step.
  • an embodiment of the present application provides an electronic device, including a memory and a processor, and the processor is configured to execute the following by calling a computer program stored in the memory:
  • the electronic device can identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met, and if it is, it further obtains the pre-trained corresponding non-working day sleep prediction model, and obtains the user’s current
  • the behavior data of the current day and historical non-working days are finally used to predict the user's sleep using the acquired behavior data and the sleep prediction model corresponding to the non-working day, which can improve the accuracy of sleep prediction for the user.
  • FIG. 1 is a schematic flowchart of a sleep prediction method provided by an embodiment of the present application.
  • Fig. 2 is a schematic diagram of obtaining a sleep prediction model used for sleep prediction of a user in an embodiment of the present application.
  • FIG. 3 is another schematic flow chart of the sleep prediction method provided by an embodiment of the present application.
  • Fig. 4 is a schematic diagram of a preset operation configuration interface provided in an embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a sleep prediction device provided by an embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 7 is another schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a sleep prediction method provided by an embodiment of the present application.
  • the sleep prediction method can be applied to electronic devices.
  • the process of the sleep prediction method may include:
  • the preset sleep prediction condition is currently met, it is identified whether the current day is a non-working day of the user.
  • the sleep prediction condition there is no specific limitation on the setting of the sleep prediction conditions in the embodiments of the present application, and can be set by those of ordinary skill in the art according to actual needs. For example, you can set the sleep prediction condition that the ambient light brightness of the current environment of the electronic device is lower than the preset brightness, so that the electronic device can detect the ambient light brightness of its environment in real time (for example, through the set ambient light sensor The ambient light brightness of the environment is detected), and when the ambient light brightness of the environment is lower than the preset brightness, it is determined that the sleep prediction condition is currently met. For another example, the sleep prediction condition can be set as the system time of the electronic device reaches the preset time, and so on.
  • the electronic device triggers the sleep prediction of the user when it determines that the preset sleep prediction condition is currently met.
  • the electronic device recognizes whether the current day is a non-working day of the user. For example, the electronic device can determine whether the current day is a weekend or a holiday, and if yes, determine that the current day is a non-working day of the user, otherwise, determine that the current day is a working day of the user.
  • the embodiment of the present application stores a plurality of pre-trained sleep prediction model sets in the electronic device, which includes at least a sleep prediction model corresponding to non-working days (or in other words, the remaining sleep prediction models for users on non-working days)
  • the sleep prediction model of) and the sleep prediction model corresponding to the working day or a sleep prediction model suitable for predicting the user’s sleep on the working day.
  • the electronic device recognizes that the current day is a non-working day of the user, it obtains the pre-trained sleep prediction model corresponding to the non-working day.
  • the electronic device stores two sleep prediction models, namely the sleep prediction model A corresponding to non-working days and the sleep prediction model B corresponding to working days. In this way, the electronic device is determined to be the user’s non-working day
  • the A sleep prediction model is used for subsequent sleep prediction of the user, and when it is determined that the current day is the user's working day, the B sleep prediction model is obtained for the subsequent sleep prediction of the user.
  • the sleep prediction model is obtained through machine learning algorithm training in advance, and the machine learning algorithm can realize various functions through continuous feature learning, for example, it can predict the user's sleep.
  • machine learning algorithms may include: decision tree models, logistic regression models, Bayes models, neural network models, clustering models, and so on.
  • machine learning algorithms can be divided according to various situations. For example, machine learning algorithms can be divided into supervised learning algorithms, non-supervised learning algorithms, semi-supervised learning algorithms, reinforcement learning algorithms, etc. based on learning methods.
  • supervised learning Under supervised learning, the input data is called “training data”, and each set of training data has a clear identification or result, such as “spam” and “non-spam” in the anti-spam system, and recognition of handwritten digits. "1, 2, 3, 4" etc.
  • training data When building a model, supervised learning establishes a learning process that compares the scene type information with the actual results of the "training data", and continuously adjusts the model until the model's scene type information reaches an expected accuracy rate.
  • Common application scenarios for supervised learning are classification problems and regression problems.
  • Common algorithms include Logistic Regression and Back Propagation Neural Network.
  • the data is not specifically identified, the model is to infer some internal structure of the data.
  • Common application scenarios include the learning of association rules and clustering.
  • Common algorithms include Apriori algorithm and k-Means algorithm.
  • Semi-supervised learning algorithm In this learning mode, the input data is partially identified.
  • This learning model can be used for type recognition, but the model first needs to learn the internal structure of the data in order to organize the data reasonably for prediction.
  • Application scenarios include classification and regression.
  • Algorithms include some extensions to commonly used supervised learning algorithms. These algorithms first try to model unidentified data, and then predict the identified data on this basis.
  • Graph inference algorithm Graph Inference
  • Laplacian SVM Laplacian SVM
  • Reinforcement learning algorithm In this learning mode, the input data is used as feedback to the model. Unlike the supervised model, the input data is only used as a way to check whether the model is right or wrong. Under reinforcement learning, the input data is directly fed back to the model. The model must be adjusted for this immediately.
  • Common application scenarios include dynamic systems and robot control.
  • Common algorithms include Q-Learning and Temporal difference learning.
  • machine learning algorithms can also be divided into:
  • Regression algorithm common regression algorithms include: Ordinary Least Square, Logistic Regression, Stepwise Regression, Multivariate Adaptive Regression Splines and Local Scatter Smoothing Estimate (Locally Estimated Scatterplot Smoothing).
  • Example-based algorithms include k-Nearest Neighbor (KNN), Learning Vector Quantization (LVQ), and Self-Organizing Map (SOM).
  • KNN k-Nearest Neighbor
  • LVQ Learning Vector Quantization
  • SOM Self-Organizing Map
  • Regularization methods common algorithms include: Ridge Regression, Least Absolute Shrinkage and Selection Operator (LASSO), and Elastic Net (Elastic Net).
  • LASSO Least Absolute Shrinkage and Selection Operator
  • Elastic Net Elastic Net
  • Decision tree algorithm common algorithms include: Classification and Regression Tree (CART), ID3 (Iterative Dichotomiser 3), C4.5, Chi-squared Automatic Interaction Detection (CHAID), Decision Stump, Random Forest (Random Forest), Multiple Adaptive Regression Spline (MARS) and Gradient Boosting Machine (GBM).
  • CART Classification and Regression Tree
  • ID3 Iterative Dichotomiser 3
  • C4.5 Chi-squared Automatic Interaction Detection
  • CHAI Chi-squared Automatic Interaction Detection
  • Decision Stump Random Forest
  • Random Forest Random Forest
  • MERS Multiple Adaptive Regression Spline
  • GBM Gradient Boosting Machine
  • Bayesian method algorithms include: Naive Bayes algorithm, Averaged One-Dependence Estimators (AODE), and Bayesian Belief Network (BBN).
  • AODE Averaged One-Dependence Estimators
  • BBN Bayesian Belief Network
  • the user's behavior data on the current day and historical non-working days are acquired, and the historical non-working days are the same type of non-working days before the current day.
  • the sleep prediction model corresponding to non-working days performs sleep prediction based on the user’s behavior data on multiple non-working days of the same type. Therefore, the electronic device obtains the pre-trained corresponding non-working days. After the sleep prediction model of the working day, the user's behavior data on that day and at least one historical non-working day is further obtained.
  • the historical non-working day is the same type of non-working day before the current day, and the behavior data includes but not limited to the user's exercise behavior data (such as calories burned, number of steps taken, etc.), rest behavior data, entertainment behavior data, and so on.
  • the electronic device obtains the user's behavior data on that day and the user's behavior data on multiple weekends before the current day.
  • a sleep prediction is performed on the user according to the acquired behavior data and the sleep prediction model, and the prediction result is obtained.
  • the electronic device After the electronic device obtains the pre-trained sleep prediction model corresponding to the non-working day, and obtains the user's behavior data on the current day and historical non-working days, it can perform the sleep prediction model and behavior data on the user according to the obtained sleep prediction model and behavior data. Sleep prediction, get the prediction result.
  • the sleep prediction of the user includes but is not limited to the time when the user enters sleep, the time when the user ends sleep, and the sleep interval composed of the time when the user enters sleep and the time when sleep ends.
  • the user's sleep prediction is performed, and the user's sleep interval is obtained from 23:30 on the same day to 06:60 the next day, or the user's sleep interval is obtained from 23:30 on the previous day to 06:60 on the same day. 30.
  • the electronic device can recognize whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met, and if so, further obtain the pre-trained corresponding non-working day sleep prediction model , And obtain the user's behavior data on the current day and historical non-working days, and finally use the acquired behavior data and the sleep prediction model corresponding to the non-working day to predict the user's sleep, which can improve the accuracy of the user's sleep prediction.
  • FIG. 3 is a schematic diagram of another flow of the sleep prediction method provided by an embodiment of the application.
  • the sleep prediction method can be applied to electronic devices.
  • the process of the sleep prediction method may include:
  • the electronic device obtains the first use information of the user using the electronic device on the day.
  • the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information.
  • the sleep prediction condition is configured as:
  • the duration of the screen off state reaches the first preset duration.
  • the electronic device can start a timer for timing when entering the screen-off state, and use the timing duration of the timer to characterize the duration of the electronic device in the screen-off state, where the electronic device’s timer duration reaches the first preset Stop the timer when the duration or exit the screen-off state, and reset the timer. In this way, the electronic device determines that the sleep prediction condition is currently met when the timer duration reaches the first preset duration, that is, when the duration of the off-screen state reaches the first preset duration.
  • the sleep prediction condition is configured as:
  • the duration of the static state reaches the second preset duration.
  • an electronic device can start a timer to count when it enters a stationary state (for example, the electronic device can detect whether there is acceleration in any direction according to the built-in three-axis acceleration sensor, and if it does not exist, it is determined to be in a stationary state).
  • the timing duration of the timer represents the duration of the electronic device being in a static state, where the electronic device stops counting the timer and resets the timer when the timing duration of the timer reaches the second preset duration or exits the static state. In this way, when the timing duration of the timer reaches the second preset duration, that is, when the duration of the stationary state reaches the second preset duration, the electronic device determines that the sleep prediction condition is currently met.
  • the sleep prediction condition is configured as:
  • the electronic device can start a timer for timing when entering the screen-off state, and use the timer duration to characterize the duration of the electronic device in the screen-off state, where the electronic device's timer duration reaches the third preset Stop the timer when the duration or exit the screen-off state, and reset the timer. In this way, when the timer duration reaches the third preset duration, the electronic device judges whether it is currently in a static state through the three-axis acceleration sensor, and if yes, it determines that the sleep prediction condition is currently met.
  • the sleep prediction condition is configured as:
  • the screen is turned off.
  • the electronic device can start a timer for timing when entering a static state, and the duration of the timer is used to characterize the duration of the electronic device in the static state, where the timer duration of the electronic device reaches the fourth preset duration or Stop the timer counting when exiting the static state and reset the timer. In this way, when the time duration of the timer reaches the fourth preset duration, the electronic device determines whether the screen is currently in the off state, and if yes, determines that the sleep prediction condition is currently met.
  • the values of the first preset duration, the second preset duration, the third preset duration, and the fourth preset duration above may be the same or different. Specifically, a person of ordinary skill in the art can select appropriate values based on experience. .
  • the first preset duration, the second preset duration, the third preset duration, and the fourth preset duration may all be set to 30 minutes.
  • the electronic device triggers the sleep prediction of the user when it determines that the preset sleep prediction condition is currently met.
  • the electronic device recognizes whether the current day is a non-working day of the user.
  • the electronic device obtains the use information of the user using the electronic device on the current day, records it as the first use information, and identifies whether the current day is a non-working day of the user based on the first use information.
  • the first use information includes, but is not limited to, information used to describe when the user uses the electronic device, where to use the electronic device, and how to use the electronic device, such as how to use the electronic device. It can provide information about which applications the user has run using the electronic device, which phone calls have been made using the electronic device, and the power consumption rate of the electronic device.
  • the electronic device obtains a pre-trained sleep prediction model corresponding to a non-working day.
  • the embodiment of the present application stores a plurality of pre-trained sleep prediction model sets in the electronic device, which includes at least a sleep prediction model corresponding to non-working days (or in other words, the remaining sleep prediction models for users on non-working days)
  • the electronic device stores two sleep prediction models, namely the sleep prediction model A corresponding to non-working days and the sleep prediction model B corresponding to working days. In this way, the electronic device is determined to be the user’s non-working day
  • the A sleep prediction model is used for subsequent sleep prediction of the user, and when it is determined that the current day is the user's working day, the B sleep prediction model is obtained for the subsequent sleep prediction of the user.
  • the electronic device obtains the user's behavior data on the current day and historical non-working days, and the historical non-working days are the same type of non-working days before the current day.
  • the sleep prediction model corresponding to non-working days performs sleep prediction based on the user’s behavior data on multiple non-working days of the same type. Therefore, the electronic device obtains the pre-trained corresponding non-working days. After the sleep prediction model of the working day, the user's behavior data on that day and at least one historical non-working day is further obtained.
  • the historical non-working day is the same type of non-working day before the current day, and the behavior data includes but not limited to the user's exercise behavior data (such as calories burned, number of steps taken, etc.), rest behavior data, entertainment behavior data, and so on.
  • the electronic device obtains the user's behavior data on that day and the user's behavior data on multiple weekends before the current day.
  • the electronic device performs sleep prediction on the user according to the acquired behavior data and the sleep prediction model to obtain the predicted sleep interval.
  • the electronic device After the electronic device obtains the pre-trained sleep prediction model corresponding to the non-working day, and obtains the user's behavior data on the current day and historical non-working days, it can perform the sleep prediction model and behavior data on the user according to the obtained sleep prediction model and behavior data. Sleep prediction, get the predicted sleep interval. For example, according to the obtained sleep prediction model and behavior data to predict the user's sleep, the predicted sleep interval is from 23:30 on the same day to 06:30 the next day, or the predicted sleep interval is from 23:30 on the previous day to 06:30 on the next day: 30.
  • the electronic device determines whether the user is currently in a sleep state according to the predicted sleep interval.
  • the predicted sleep interval indicates that the user's sleep interval is from 23:30 on the current day to 06:30 on the next day. If the current time of the electronic device is 23:25 on the current day, it is determined that the user is not currently in a sleep state. If the current time of the electronic device is If it is 23:45 of the day, it is determined that the user is currently asleep.
  • the electronic device performs a preset operation, where the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
  • the electronic device when the electronic device determines that the user is currently in the sleep state, it performs a pre-configured preset operation that is executed when the user is in the sleep state.
  • the preset operation includes but is not limited to at least one of a system update operation, an application update operation, and a power consumption control operation, which may be manually configured by the user or may be configured by the electronic device by default.
  • the electronic device can configure the system update operation as a preset operation, so as to perform the system update operation when the user is in sleep state, and update the system to the latest version; the electronic device can also configure the application update operation as a preset operation, The user performs application update operations when the user is asleep, updates the installed applications to the latest version, etc.; electronic devices can configure the power consumption control operation as a preset operation, thereby applying the preset for reduction when the user is asleep Power consumption control strategy for power consumption, reducing the power consumption of electronic devices and so on.
  • the electronic device provides a preset operation configuration interface.
  • the preset operation configuration interface includes the prompt message "Please select the operation performed during sleep", operation selection box, drop-down button, drop-down Menu, OK button, and Cancel button.
  • the drop-down menu is called out according to the user's click operation on the drop-down button.
  • the drop-down menu provides various operations that the electronic device can perform during the user's sleep interval, as shown in the system update in Figure 4 Operation, application update operations, etc., the user can select the operation performed by the electronic device during sleep according to actual needs, and after selecting the operation that needs to be performed by the electronic device during sleep, click the OK button to instruct the electronic device to select the user The operation as the aforementioned preset operation. Or, if the user finds that there is no need for the operation performed by the electronic device during sleep, he can click the cancel button to instruct the electronic device to perform the preset operation of the default configuration.
  • the following when identifying whether the current day is a non-working day of the user according to the first usage information, the following can be performed:
  • the electronic device obtains the pre-stored second use information of the user using the electronic device on his workday;
  • the electronic device judges whether the first usage information matches the second usage information, if yes, it is judged that the current day is the user's working day, otherwise it is judged that the current day is the user's non-working day.
  • the usage information of the electronic device used on weekdays is recorded as the second usage information.
  • whether the usage information is the usage information of the electronic device used by the user during the working day can be calibrated by the user according to the actual situation.
  • the electronic device when the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information, it can obtain the pre-stored second usage information of the user using the electronic device on its working day, and determine whether the first usage information matches the second usage information. Use information matching, where if the first use information matches the second use information, the electronic device determines that the current day is the user's working day, otherwise it determines that the current day is the user's non-working day.
  • the following when determining whether the first usage information matches the second usage information, the following can be performed:
  • the electronic device judges whether the acquired similarity reaches the preset similarity, and if yes, it judges that the first usage information matches the second usage information, otherwise it does not match.
  • the electronic device can determine whether the first usage information and the second usage information match according to the similarity between the two. In this way, when the electronic device determines whether the first usage information matches the second usage information, The similarity between the first use information and the second use information can be obtained, and it is determined whether the obtained similarity reaches the preset similarity. If yes, it is determined that the first use information and the second use information match, otherwise the first use information is determined The information does not match the second usage information. It should be noted that there is no specific limitation on the value of the preset similarity in the embodiments of the present application, and a person of ordinary skill in the art can select an appropriate value according to experience needs.
  • the electronic device when it obtains the similarity between the first usage information and the second usage information, it uses the encoder neural network to respectively encode the first usage information and the second usage information to obtain the first word vector corresponding to the first usage information Set, and obtain a second word vector set corresponding to the second usage information.
  • the embodiment of the application does not limit the specific model and topology of the encoder neural network.
  • a single-layer recurrent neural network can be used for training to obtain an encoder neural network, or a multi-layer recurrent neural network can be used for training.
  • the encoder neural network can also be trained using a convolutional neural network, or its variants, or neural networks of other network structures to obtain an encoder neural network.
  • the electronic device After acquiring the first word vector set corresponding to the first use information and the second word vector set corresponding to the second use information, the electronic device calculates the characteristic distance between the first word vector set and the second word vector set, The calculated feature distance is used as the similarity between the first use information and the second use information.
  • the following when identifying whether the current day is a non-working day of the user according to the first usage information, the following can be performed:
  • the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information and the pre-trained working day recognition model.
  • a workday recognition model for workday recognition can be trained in advance, and the workday recognition model can be configured locally in the electronic device. In this way, when the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information, it can recognize whether the current day is a non-working day of the user according to the first usage information and the pre-trained working day recognition model.
  • an unsupervised learning method can be used to train the user's usage information of electronic devices on all natural days within a year to obtain a usage information classifier that can classify the input usage information, and use the usage information classifier as the work Day recognition model.
  • the first use information is input to the use information classifier to classify the use information, it can be determined whether the day is a non-working day of the user according to the classification result output by the use information classifier, and if the output of the information classifier is used If the first usage information indicates that the first usage information is the usage information of a working day, it can be determined that the current day is the user's working day. If the output of the usage information classifier indicates that the first usage information is the usage information of a non-working day, it can be determined that the current day is the user's non-working day. Working day.
  • the electronic device obtains the user-configured schedule
  • the electronic device obtains the sleep interval planned by the user according to the obtained schedule and determines whether it is currently within the planned sleep interval;
  • the electronic device when the electronic device determines that the user is in a sleep state, obtains the schedule configured by the user, and further obtains the sleep interval planned by the user according to the obtained schedule, and determines whether it is currently within the planned sleep interval. If it is, it means that the predicted result is consistent with the schedule configured by the user, and the preset operation is performed at this time.
  • the electronic device can obtain the user's scheduled sleep interval as 10:30 -6:30.
  • the method further includes:
  • the electronic device obtains the pre-trained sleep prediction model corresponding to the working day;
  • the electronic device obtains the user's behavior data on the current day and the historical working day, and the historical working day is the working day before the current day;
  • the electronic device predicts the user's sleep based on the acquired behavior data and the sleep prediction model, and obtains the prediction result;
  • the electronic device judges whether the user is currently asleep according to the obtained prediction result
  • the pre-trained sleep prediction model corresponding to the working day is acquired for subsequent sleep prediction of the user.
  • the sleep prediction model corresponding to the working day performs sleep prediction based on the user's behavior data on multiple working days. Therefore, the electronic device obtains the pre-trained sleep prediction model corresponding to the working day Then, further obtain the user's behavior data on the current day and at least one historical working day. Among them, the historical working day is the working day before the current day.
  • the electronic device After the electronic device obtains the pre-trained sleep prediction model corresponding to the working day, and obtains the user's behavior data on the current day and the historical working day, it can perform sleep prediction on the user according to the obtained sleep prediction model and behavior data to obtain forecast result.
  • the sleep prediction of the user includes but is not limited to the time when the user enters sleep, the time when the user ends sleep, and the sleep interval composed of the time when the user enters sleep and the time when sleep ends.
  • the user's sleep prediction is performed, and the user's sleep interval is obtained from 23:30 on the same day to 06:60 the next day, or the user's sleep interval is obtained from 23:30 on the previous day to 06:60 on the same day. 30.
  • the electronic device executes a pre-configured preset operation that is executed when the user is in the sleep state.
  • the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation, which may be manually configured by the user or may be configured by the electronic device by default.
  • FIG. 5 is a schematic structural diagram of a sleep prediction device provided by an embodiment of the application.
  • the sleep prediction device can be applied to electronic equipment.
  • the sleep prediction device may include: a date recognition module 401, a model acquisition module 402, a data acquisition module 403, and a sleep prediction module 404.
  • the date identification module 401 is used to identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met;
  • the model obtaining module 402 is configured to obtain a pre-trained sleep prediction model corresponding to a non-working day when the recognition result of the date recognition module 401 is yes;
  • the data acquisition module 403 is used to acquire user behavior data on the current day and historical non-working days.
  • the historical non-working days are the same type of non-working days before the current day;
  • the sleep prediction module 404 is configured to perform sleep prediction on the user according to the acquired behavior data and the sleep prediction model to obtain the prediction result.
  • the behavior data includes sports behavior data, rest behavior data, and entertainment behavior data.
  • the date identification module 401 may be used to:
  • the first usage information identify whether the day is a non-working day of the user.
  • the date identification module 401 may be used to:
  • the date identification module 401 when determining whether the first usage information matches the second usage information, the date identification module 401 may be used to:
  • the date identification module 401 may be used to:
  • the current day is a non-working day of the user.
  • the sleep prediction conditions include:
  • the duration of the screen off state reaches the first preset duration
  • the duration of the static state reaches the second preset duration
  • the screen is turned off when the duration of the static state reaches the fourth preset duration.
  • the prediction result includes the predicted sleep interval
  • the sleep prediction device further includes an operation execution module for:
  • the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
  • the operation execution module may be used to:
  • the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
  • the model acquisition module 402 is also used to obtain the pre-trained sleep prediction corresponding to the working day model;
  • the data acquisition module 403 is also used to acquire user behavior data on the current day and historical working days, and the historical working day is the working day before the current day;
  • the sleep prediction module 404 is also used to predict the user's sleep according to the acquired behavior data and the sleep prediction model, and obtain the prediction result.
  • the embodiment of the present application provides a computer-readable storage medium with a computer program stored thereon, and when the stored computer program is executed on a computer, the computer executes the steps in the sleep prediction method provided in the embodiment of the present application.
  • An embodiment of the present application further provides an electronic device including a memory and a processor, and the processor executes the steps in the sleep prediction method provided in the embodiment of the present application by calling a computer program stored in the memory.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • the electronic device may include a memory 601 and a processor 602.
  • a person of ordinary skill in the art can understand that the structure of the electronic device shown in FIG. 6 does not constitute a limitation on the electronic device, and may include more or less components than those shown in the figure, or a combination of certain components, or different component arrangements. .
  • the memory 601 can be used to store application programs and data.
  • the application program stored in the memory 601 contains executable code.
  • Application programs can be composed of various functional modules.
  • the processor 602 executes various functional applications and data processing by running application programs stored in the memory 601.
  • the processor 602 is the control center of the electronic device. It uses various interfaces and lines to connect the various parts of the entire electronic device, and executes the electronic device by running or executing the application program stored in the memory 601 and calling the data stored in the memory 601
  • the various functions and processing data of the electronic device can be used to monitor the electronic equipment as a whole.
  • the processor 602 in the electronic device will load the executable code corresponding to the process of one or more audio processing programs into the memory 601 according to the following instructions, and the processor 602 will run and store the executable code
  • the application program in the memory 601 thus executes:
  • the historical non-working days are the same types of non-working days before the current day;
  • FIG. 7 is another schematic structural diagram of the electronic device provided by an embodiment of the application. The difference from the electronic device shown in FIG. 6 is that the electronic device further includes components such as an input unit 603 and an output unit 604.
  • the input unit 603 can be used to receive input numbers, character information or user characteristic information (such as fingerprints), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
  • user characteristic information such as fingerprints
  • the output unit 604 may be used to output information input by the user or information provided to the user, such as a speaker.
  • the processor 602 in the electronic device will load the executable code corresponding to the process of one or more audio processing programs into the memory 601 according to the following instructions, and the processor 602 will run and store the executable code
  • the application program in the memory 601 thus executes:
  • the historical non-working days are the same types of non-working days before the current day;
  • the behavior data includes sports behavior data, rest behavior data, and entertainment behavior data.
  • the processor 602 may execute:
  • the first usage information identify whether the day is a non-working day of the user.
  • the processor 602 may execute:
  • the processor 602 may execute:
  • the processor 602 may execute:
  • the current day is a non-working day of the user.
  • the sleep prediction conditions include:
  • the duration of the screen off state reaches the first preset duration
  • the duration of the static state reaches the second preset duration
  • the screen is turned off when the duration of the static state reaches the fourth preset duration.
  • the prediction result includes the predicted sleep interval.
  • the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
  • the processor 602 may perform:
  • the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
  • the processor 602 may execute:
  • the historical working day is the working day before the current day;
  • the sleep prediction device/electronic device provided by the embodiment of the application belongs to the same concept as the sleep prediction method in the above embodiment. Any method provided in the sleep prediction method embodiment can be run on the sleep prediction device/electronic device. For the implementation process, refer to the embodiment of the sleep prediction method, which will not be repeated here.
  • the program may be stored in a computer readable storage medium, such as stored in a memory, and executed by at least one processor, and the execution process may include a process such as an embodiment of the sleep prediction method.
  • the storage medium may be a magnetic disk, an optical disc, a read only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), etc.
  • the sleep prediction device of the embodiment of the present application its functional modules may be integrated in one processing chip, or each module may exist alone physically, or two or more modules may be integrated in one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Medical Treatment And Welfare Office Work (AREA)
  • Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)

Abstract

A sleep prediction method: when a preset sleep prediction condition is currently met and the current day is a non-working day of a user, an electronic device can acquire a pre-trained corresponding non-working day sleep prediction model and acquire behaviour data of the user on the current day and historical non-working days, and finally use the acquired behaviour data and the sleep prediction model to perform sleep prediction for the user, thereby increasing the accuracy of sleep prediction for the user.

Description

睡眠预测方法、装置、存储介质及电子设备Sleep prediction method, device, storage medium and electronic equipment 技术领域Technical field
本申请属于计算机技术领域,尤其涉及一种睡眠预测方法、装置、存储介质及电子设备。This application belongs to the field of computer technology, and in particular relates to a sleep prediction method, device, storage medium, and electronic equipment.
背景技术Background technique
目前,如平板电脑、手机等电子设备经过配置,可以在用户睡眠时进行系统更新等影响用户使用或者耗时较长的操作,以此来避免对用户的使用造成影响。为此,相关技术通过对用户进行睡眠预测,比如预测用户的睡眠区间等来达到前述目的,然而相关技术中对用户进行睡眠预测的准确度较低。At present, electronic devices such as tablet computers and mobile phones are configured to perform system updates while the user is sleeping, and other operations that affect the user's use or take a long time to avoid affecting the user's use. For this reason, the related technology achieves the foregoing purpose by predicting the user's sleep, such as predicting the user's sleep interval, etc. However, the accuracy of the related technology for predicting the user's sleep is low.
发明内容Summary of the invention
本申请实施例提供一种睡眠预测方法、装置、存储介质及电子设备,可以使得电子设备能够准确的对用户进行睡眠预测。The embodiments of the present application provide a sleep prediction method, device, storage medium, and electronic device, which can enable the electronic device to accurately predict the user's sleep.
第一方面,本申请实施例提供一种睡眠预测方法,应用于电子设备,包括:In the first aspect, an embodiment of the present application provides a sleep prediction method applied to an electronic device, including:
若当前满足预设的睡眠预测条件,则识别当日是否为用户的非工作日;If the preset sleep prediction conditions are currently met, identify whether the day is a non-working day of the user;
若是,则获取预先训练的对应非工作日的睡眠预测模型;If yes, obtain the pre-trained sleep prediction model corresponding to the non-working day;
获取所述用户在当日以及历史非工作日的行为数据,所述历史非工作日为当日之前相同类型的非工作日;Acquiring behavior data of the user on the current day and historical non-working days, where the historical non-working days are the same type of non-working days before the current day;
根据所述行为数据以及所述睡眠预测模型对所述用户进行睡眠预测,得到预测结果。Perform sleep prediction on the user according to the behavior data and the sleep prediction model to obtain a prediction result.
第二方面,本申请实施例提供一种睡眠预测装置,应用于电子设备,包括:In the second aspect, an embodiment of the present application provides a sleep prediction device applied to an electronic device, including:
日期识别模块,用于在当前满足预设的睡眠预测条件时,识别当日是否为用户的非工作日;The date identification module is used to identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met;
模型获取模块,用于在识别模块的识别结果为是时,获取预先训练的对应非工作日的睡眠预测模型;The model acquisition module is used to acquire the pre-trained sleep prediction model corresponding to the non-working day when the recognition result of the recognition module is yes;
数据获取模块,用于获取所述用户在当日以及历史非工作日的行为数据,所述历史非工作日为当日之前相同类型的非工作日;A data acquisition module for acquiring behavioral data of the user on the current day and historical non-working days, where the historical non-working days are the same type of non-working days before the current day;
睡眠预测模块,用于根据所述行为数据以及所述睡眠预测模型对所述用户进行睡眠预测,得到预测结果。The sleep prediction module is configured to perform sleep prediction on the user according to the behavior data and the sleep prediction model to obtain a prediction result.
第三方面,本申请实施例提供一种存储介质,其上存储有计算机程序,其 中,当所述计算机程序在计算机上执行时,使得所述计算机执行本申请实施例提供的睡眠预测方法中的步骤。In a third aspect, an embodiment of the present application provides a storage medium on which a computer program is stored. When the computer program is executed on a computer, the computer is caused to execute the sleep prediction method provided in the embodiment of the present application. step.
第四方面,本申请实施例提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行:In a fourth aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, and the processor is configured to execute the following by calling a computer program stored in the memory:
若当前满足预设的睡眠预测条件,则识别当日是否为用户的非工作日;If the preset sleep prediction conditions are currently met, identify whether the day is a non-working day of the user;
若是,则获取预先训练的对应非工作日的睡眠预测模型;If yes, obtain the pre-trained sleep prediction model corresponding to the non-working day;
获取所述用户在当日以及历史非工作日的行为数据,所述历史非工作日为当日之前相同类型的非工作日;Acquiring behavior data of the user on the current day and historical non-working days, where the historical non-working days are the same type of non-working days before the current day;
根据所述行为数据以及所述睡眠预测模型对所述用户进行睡眠预测,得到预测结果。Perform sleep prediction on the user according to the behavior data and the sleep prediction model to obtain a prediction result.
申请实施例中,电子设备可以在当前满足预设的睡眠预测条件时,识别当日是否为用户的非工作日,若是,则进一步获取到预先训练的对应非工作日睡眠预测模型,以及获取用户在当日和历史非工作日的行为数据,最终利用获取到的行为数据以及对应非工作日的睡眠预测模型对用户进行睡眠预测,能够提高对用户进行睡眠预测的准确度。In the application embodiment, the electronic device can identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met, and if it is, it further obtains the pre-trained corresponding non-working day sleep prediction model, and obtains the user’s current The behavior data of the current day and historical non-working days are finally used to predict the user's sleep using the acquired behavior data and the sleep prediction model corresponding to the non-working day, which can improve the accuracy of sleep prediction for the user.
附图说明Description of the drawings
下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其有益效果显而易见。The following detailed description of specific implementations of the present application in conjunction with the accompanying drawings will make the technical solutions of the present application and its beneficial effects obvious.
图1是本申请实施例提供的睡眠预测方法的一流程示意图。FIG. 1 is a schematic flowchart of a sleep prediction method provided by an embodiment of the present application.
图2是本申请实施例中获取用于对用户进行睡眠预测的睡眠预测模型的示意图。Fig. 2 is a schematic diagram of obtaining a sleep prediction model used for sleep prediction of a user in an embodiment of the present application.
图3是本申请实施例提供的睡眠预测方法的另一流程示意图。FIG. 3 is another schematic flow chart of the sleep prediction method provided by an embodiment of the present application.
图4是本申请实施例中提供的预设操作配置界面的示意图。Fig. 4 is a schematic diagram of a preset operation configuration interface provided in an embodiment of the present application.
图5是本申请实施例提供的睡眠预测装置的结构示意图。Fig. 5 is a schematic structural diagram of a sleep prediction device provided by an embodiment of the present application.
图6是本申请实施例提供的电子设备的一结构示意图。Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
图7是本申请实施例提供的电子设备的另一结构示意图。FIG. 7 is another schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式detailed description
请参照图示,其中相同的组件符号代表相同的组件,本申请的原理是以实施在一适当的运算环境中来举例说明。以下的说明是基于所例示的本申请具体 实施例,其不应被视为限制本申请未在此详述的其它具体实施例。Please refer to the drawings, in which the same component symbols represent the same components, and the principle of the present application is implemented in an appropriate computing environment for illustration. The following description is based on the exemplified specific embodiments of the application, which should not be regarded as limiting other specific embodiments of the application that are not described in detail herein.
请参照图1,图1是本申请实施例提供的睡眠预测方法的一流程示意图。该睡眠预测方法可以应用于电子设备。该睡眠预测方法的流程可以包括:Please refer to FIG. 1, which is a schematic flowchart of a sleep prediction method provided by an embodiment of the present application. The sleep prediction method can be applied to electronic devices. The process of the sleep prediction method may include:
在101中,若当前满足预设的睡眠预测条件,则识别当日是否为用户的非工作日。In 101, if the preset sleep prediction condition is currently met, it is identified whether the current day is a non-working day of the user.
应当说明的是,本申请实施例中对于睡眠预测条件的设置不做具体限制,可由本领域普通技术人员根据实际需要进行设置。比如,可以设置睡眠预测条件为电子设备当前所处环境的环境光亮度低于预设亮度,这样,电子设备可以实时对其所处环境的环境光亮度进行侦测(比如通过设置的环境光传感器对所处环境的环境光亮度进行侦测),当其所处环境的环境光亮度低于预设亮度时,判定当前满足睡眠预测条件。又比如,可以设置睡眠预测条件为电子设备的系统时刻到达预设时刻,等等。It should be noted that there is no specific limitation on the setting of the sleep prediction conditions in the embodiments of the present application, and can be set by those of ordinary skill in the art according to actual needs. For example, you can set the sleep prediction condition that the ambient light brightness of the current environment of the electronic device is lower than the preset brightness, so that the electronic device can detect the ambient light brightness of its environment in real time (for example, through the set ambient light sensor The ambient light brightness of the environment is detected), and when the ambient light brightness of the environment is lower than the preset brightness, it is determined that the sleep prediction condition is currently met. For another example, the sleep prediction condition can be set as the system time of the electronic device reaches the preset time, and so on.
本申请实施例中,电子设备在判定当前满足预设的睡眠预测条件时,触发对用户的睡眠预测。首先,电子设备识别当日是否为用户的非工作日。比如,电子设备可以判断当日是否为周末或节假日,是则判定当日为用户的非工作日,否则判定当日为用户的工作日。In the embodiment of the present application, the electronic device triggers the sleep prediction of the user when it determines that the preset sleep prediction condition is currently met. First, the electronic device recognizes whether the current day is a non-working day of the user. For example, the electronic device can determine whether the current day is a weekend or a holiday, and if yes, determine that the current day is a non-working day of the user, otherwise, determine that the current day is a working day of the user.
在102中,若是,则获取预先训练的对应非工作日的睡眠预测模型。In 102, if yes, obtain a pre-trained sleep prediction model corresponding to a non-working day.
需要说明的是,本申请实施例在电子设备存储有预先训练的多个睡眠预测模型集合,其中,至少包括对应非工作日的睡眠预测模型(或者说,剩余在非工作日对用户进行睡眠预测的睡眠预测模型)以及对应工作日的睡眠预测模型(或者说,适于在工作日对用户进行睡眠预测的睡眠预测模型)。这样,电子设备在识别到当日为用户的非工作日时,获取到预先训练的对应非工作日的睡眠预测模型。It should be noted that the embodiment of the present application stores a plurality of pre-trained sleep prediction model sets in the electronic device, which includes at least a sleep prediction model corresponding to non-working days (or in other words, the remaining sleep prediction models for users on non-working days) The sleep prediction model of) and the sleep prediction model corresponding to the working day (or a sleep prediction model suitable for predicting the user’s sleep on the working day). In this way, when the electronic device recognizes that the current day is a non-working day of the user, it obtains the pre-trained sleep prediction model corresponding to the non-working day.
比如,请参照图2,电子设备存储有两个睡眠预测模型,分别为对应非工作日的A睡眠预测模型和对应工作日的B睡眠预测模型,这样,电子设备在判定当日为用户的非工作日时,将获取A睡眠预测模型用于后续对用户的睡眠预测,而在判定当日为用户的工作日时,将获取B睡眠预测模型用于后续对用户的睡眠预测。For example, referring to Figure 2, the electronic device stores two sleep prediction models, namely the sleep prediction model A corresponding to non-working days and the sleep prediction model B corresponding to working days. In this way, the electronic device is determined to be the user’s non-working day At time of day, the A sleep prediction model is used for subsequent sleep prediction of the user, and when it is determined that the current day is the user's working day, the B sleep prediction model is obtained for the subsequent sleep prediction of the user.
应当说明的是,睡眠预测模型预先通过机器学习算法训练得到,机器学习算法可以通过不断的特征学习来实现各种功能,比如,可以对用户的进行睡眠 预测。其中,机器学习算法可以包括:决策树模型、逻辑回归模型、贝叶斯模型、神经网络模型、聚类模型等等。It should be noted that the sleep prediction model is obtained through machine learning algorithm training in advance, and the machine learning algorithm can realize various functions through continuous feature learning, for example, it can predict the user's sleep. Among them, machine learning algorithms may include: decision tree models, logistic regression models, Bayes models, neural network models, clustering models, and so on.
机器学习算法的算法类型可以根据各种情况划分,比如,可以基于学习方式可以将机器学习算法划分成:监督式学习算法、非监控式学习算法、半监督式学习算法、强化学习算法等等。The algorithm types of machine learning algorithms can be divided according to various situations. For example, machine learning algorithms can be divided into supervised learning algorithms, non-supervised learning algorithms, semi-supervised learning algorithms, reinforcement learning algorithms, etc. based on learning methods.
在监督式学习下,输入数据被称为“训练数据”,每组训练数据有一个明确的标识或结果,如对防垃圾邮件系统中“垃圾邮件”“非垃圾邮件”,对手写数字识别中的“1、2、3、4”等。在建立模型的时候,监督式学习建立一个学习过程,将场景类型信息与“训练数据”的实际结果进行比较,不断的调整模型,直到模型的场景类型信息达到一个预期的准确率。监督式学习的常见应用场景如分类问题和回归问题。常见算法有逻辑回归(Logistic Regression)和反向传递神经网络(Back Propagation Neural Network)。Under supervised learning, the input data is called "training data", and each set of training data has a clear identification or result, such as "spam" and "non-spam" in the anti-spam system, and recognition of handwritten digits. "1, 2, 3, 4" etc. When building a model, supervised learning establishes a learning process that compares the scene type information with the actual results of the "training data", and continuously adjusts the model until the model's scene type information reaches an expected accuracy rate. Common application scenarios for supervised learning are classification problems and regression problems. Common algorithms include Logistic Regression and Back Propagation Neural Network.
在非监督式学习中,数据并不被特别标识,模型是为了推断出数据的一些内在结构。常见的应用场景包括关联规则的学习以及聚类等。常见算法包括Apriori算法以及k-Means算法等。In unsupervised learning, the data is not specifically identified, the model is to infer some internal structure of the data. Common application scenarios include the learning of association rules and clustering. Common algorithms include Apriori algorithm and k-Means algorithm.
半监督式学习算法,在此学习方式下,输入数据被部分标识,这种学习模型可以用来进行类型识别,但是模型首先需要学习数据的内在结构以便合理的组织数据来进行预测。应用场景包括分类和回归,算法包括一些对常用监督式学习算法的延伸,这些算法首先试图对未标识数据进行建模,在此基础上再对标识的数据进行预测。如图论推理算法(Graph Inference)或者拉普拉斯支持向量机(Laplacian SVM)等。Semi-supervised learning algorithm. In this learning mode, the input data is partially identified. This learning model can be used for type recognition, but the model first needs to learn the internal structure of the data in order to organize the data reasonably for prediction. Application scenarios include classification and regression. Algorithms include some extensions to commonly used supervised learning algorithms. These algorithms first try to model unidentified data, and then predict the identified data on this basis. Graph inference algorithm (Graph Inference) or Laplacian SVM (Laplacian SVM), etc.
强化学习算法,在这种学习模式下,输入数据作为对模型的反馈,不像监督模型那样,输入数据仅仅是作为一个检查模型对错的方式,在强化学习下,输入数据直接反馈到模型,模型必须对此立刻作出调整。常见的应用场景包括动态系统以及机器人控制等。常见算法包括Q-Learning以及时间差学习(Temporal difference learning)。Reinforcement learning algorithm. In this learning mode, the input data is used as feedback to the model. Unlike the supervised model, the input data is only used as a way to check whether the model is right or wrong. Under reinforcement learning, the input data is directly fed back to the model. The model must be adjusted for this immediately. Common application scenarios include dynamic systems and robot control. Common algorithms include Q-Learning and Temporal difference learning.
此外,还可以基于根据算法的功能和形式的类似性将机器学习算法划分成:In addition, machine learning algorithms can also be divided into:
回归算法,常见的回归算法包括:最小二乘法(Ordinary Least Square),逻辑回归(Logistic Regression),逐步式回归(Stepwise Regression),多元自适应回归样条(Multivariate Adaptive Regression Splines)以及本地散点平滑 估计(Locally Estimated Scatterplot Smoothing)。Regression algorithm, common regression algorithms include: Ordinary Least Square, Logistic Regression, Stepwise Regression, Multivariate Adaptive Regression Splines and Local Scatter Smoothing Estimate (Locally Estimated Scatterplot Smoothing).
基于实例的算法,包括k-Nearest Neighbor(KNN),学习矢量量化(Learning Vector Quantization,LVQ),以及自组织映射算法(Self-Organizing Map,SOM)。Example-based algorithms include k-Nearest Neighbor (KNN), Learning Vector Quantization (LVQ), and Self-Organizing Map (SOM).
正则化方法,常见的算法包括:Ridge Regression,Least Absolute Shrinkage and Selection Operator(LASSO),以及弹性网络(Elastic Net)。Regularization methods, common algorithms include: Ridge Regression, Least Absolute Shrinkage and Selection Operator (LASSO), and Elastic Net (Elastic Net).
决策树算法,常见的算法包括:分类及回归树(Classification And Regression Tree,CART),ID3(Iterative Dichotomiser 3),C4.5,Chi-squared Automatic Interaction Detection(CHAID),Decision Stump,随机森林(Random Forest),多元自适应回归样条(MARS)以及梯度推进机(Gradient Boosting Machine,GBM)。Decision tree algorithm, common algorithms include: Classification and Regression Tree (CART), ID3 (Iterative Dichotomiser 3), C4.5, Chi-squared Automatic Interaction Detection (CHAID), Decision Stump, Random Forest (Random Forest), Multiple Adaptive Regression Spline (MARS) and Gradient Boosting Machine (GBM).
贝叶斯方法算法,包括:朴素贝叶斯算法,平均单依赖估计(Averaged One-Dependence Estimators,AODE),以及Bayesian Belief Network(BBN)。Bayesian method algorithms include: Naive Bayes algorithm, Averaged One-Dependence Estimators (AODE), and Bayesian Belief Network (BBN).
在103中,获取用户在当日以及历史非工作日的行为数据,历史非工作日为当日之前相同类型的非工作日。In 103, the user's behavior data on the current day and historical non-working days are acquired, and the historical non-working days are the same type of non-working days before the current day.
应当说明的是,在本申请实施例中,对应非工作日的睡眠预测模型根据用户在多个相同类型的非工作日的行为数据进行睡眠预测,因此,电子设备在获取到预先训练的对应非工作日的睡眠预测模型之后,进一步获取用户在当日以及至少一个历史非工作日的行为数据。其中,历史非工作日为当日之前相同类型的非工作日,行为数据包括但不限于用户的运动行为数据(比如消耗的热量、行走的步数等)、休息行为数据以及娱乐行为数据等等。It should be noted that in this embodiment of the application, the sleep prediction model corresponding to non-working days performs sleep prediction based on the user’s behavior data on multiple non-working days of the same type. Therefore, the electronic device obtains the pre-trained corresponding non-working days. After the sleep prediction model of the working day, the user's behavior data on that day and at least one historical non-working day is further obtained. Among them, the historical non-working day is the same type of non-working day before the current day, and the behavior data includes but not limited to the user's exercise behavior data (such as calories burned, number of steps taken, etc.), rest behavior data, entertainment behavior data, and so on.
比如,当日为周末,为用户的非工作日,电子设备获取用户在当日的行为数据,以及获取用户在当日之前多个周末的行为数据。For example, if the current day is a weekend, it is a non-working day of the user, and the electronic device obtains the user's behavior data on that day and the user's behavior data on multiple weekends before the current day.
在104中,根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果。In 104, a sleep prediction is performed on the user according to the acquired behavior data and the sleep prediction model, and the prediction result is obtained.
其中,电子设备在获取到预先训练的对应非工作日的睡眠预测模型,以及获取到用户在当日以及历史非工作日的行为数据之后,即可根据获取到的睡眠预测模型以及行为数据对用户进行睡眠预测,得到预测结果。Among them, after the electronic device obtains the pre-trained sleep prediction model corresponding to the non-working day, and obtains the user's behavior data on the current day and historical non-working days, it can perform the sleep prediction model and behavior data on the user according to the obtained sleep prediction model and behavior data. Sleep prediction, get the prediction result.
应当说明的是,对用户的睡眠预测包括但不限于用户进入睡眠的时刻、结束睡眠的时刻以及进入睡眠的时刻和结束睡眠的时刻所组成的睡眠区间等。比 如,根据获取到的睡眠预测模型以及行为数据对用户进行睡眠预测,得到用户的睡眠区间为当日23:30-次日06:60,或者得到用户的睡眠区间为前日23:30-当日06:30。It should be noted that the sleep prediction of the user includes but is not limited to the time when the user enters sleep, the time when the user ends sleep, and the sleep interval composed of the time when the user enters sleep and the time when sleep ends. For example, according to the obtained sleep prediction model and behavior data, the user's sleep prediction is performed, and the user's sleep interval is obtained from 23:30 on the same day to 06:60 the next day, or the user's sleep interval is obtained from 23:30 on the previous day to 06:60 on the same day. 30.
由上可知,本申请实施例中,电子设备可以在当前满足预设的睡眠预测条件时,识别当日是否为用户的非工作日,若是,则进一步获取到预先训练的对应非工作日睡眠预测模型,以及获取用户在当日和历史非工作日的行为数据,最终利用获取到的行为数据以及对应非工作日的睡眠预测模型对用户进行睡眠预测,能够提高对用户进行睡眠预测的准确度。It can be seen from the above that, in the embodiment of the present application, the electronic device can recognize whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met, and if so, further obtain the pre-trained corresponding non-working day sleep prediction model , And obtain the user's behavior data on the current day and historical non-working days, and finally use the acquired behavior data and the sleep prediction model corresponding to the non-working day to predict the user's sleep, which can improve the accuracy of the user's sleep prediction.
请参照图3,图3为本申请实施例提供的睡眠预测方法的另一流程示意图。该睡眠预测方法可以应用于电子设备。该睡眠预测方法的流程可以包括:Please refer to FIG. 3, which is a schematic diagram of another flow of the sleep prediction method provided by an embodiment of the application. The sleep prediction method can be applied to electronic devices. The process of the sleep prediction method may include:
在201中,若当前满足预设的睡眠预测条件,则电子设备获取用户在当日使用电子设备的第一使用信息。In 201, if the preset sleep prediction condition is currently met, the electronic device obtains the first use information of the user using the electronic device on the day.
在202中,电子设备根据第一使用信息识别当日是否为用户的非工作日。In 202, the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information.
作为第一种可选的实施方式,睡眠预测条件被配置为:As a first optional implementation manner, the sleep prediction condition is configured as:
处于熄屏状态的持续时长达到第一预设时长。The duration of the screen off state reaches the first preset duration.
比如,电子设备可以在进入熄屏状态的同时启动定时器进行计时,使用定时器的计时时长表征电子设备处于熄屏状态的持续时长,其中,电子设备在定时器的计时时长达到第一预设时长或者退出熄屏状态时停止定时器计时,并复位定时器。这样,电子设备当定时器的计时时长达到第一预设时长,也即是其处于熄屏状态的持续时长达到第一预设时长时,判定当前满足睡眠预测条件。For example, the electronic device can start a timer for timing when entering the screen-off state, and use the timing duration of the timer to characterize the duration of the electronic device in the screen-off state, where the electronic device’s timer duration reaches the first preset Stop the timer when the duration or exit the screen-off state, and reset the timer. In this way, the electronic device determines that the sleep prediction condition is currently met when the timer duration reaches the first preset duration, that is, when the duration of the off-screen state reaches the first preset duration.
作为第二种可选的实施方式,睡眠预测条件被配置为:As a second optional implementation manner, the sleep prediction condition is configured as:
处于静止状态的持续时长达到第二预设时长。The duration of the static state reaches the second preset duration.
比如,电子设备可以在进入静止状态(比如,电子设备可以根据内置的三轴加速度传感器侦测是否存在任一方向的加速度,若不存在则判定处于静止状态)的同时启动定时器进行计时,使用定时器的计时时长表征电子设备处于静止状态的持续时长,其中,电子设备在定时器的计时时长达到第二预设时长或者退出静止状态时停止定时器计时,并复位定时器。这样,电子设备当定时器的计时时长达到第二预设时长,也即是其处于静止状态的持续时长达到第二预设时长时,判定当前满足睡眠预测条件。For example, an electronic device can start a timer to count when it enters a stationary state (for example, the electronic device can detect whether there is acceleration in any direction according to the built-in three-axis acceleration sensor, and if it does not exist, it is determined to be in a stationary state). The timing duration of the timer represents the duration of the electronic device being in a static state, where the electronic device stops counting the timer and resets the timer when the timing duration of the timer reaches the second preset duration or exits the static state. In this way, when the timing duration of the timer reaches the second preset duration, that is, when the duration of the stationary state reaches the second preset duration, the electronic device determines that the sleep prediction condition is currently met.
作为第三种可选的实施方式,睡眠预测条件被配置为:As a third optional implementation manner, the sleep prediction condition is configured as:
在处于熄屏状态的持续时长达到第三预设时长时处于静止状态。When the duration of being in the off-screen state reaches the third preset duration, it is in a static state.
比如,电子设备可以在进入熄屏状态的同时启动定时器进行计时,使用定时器的计时时长表征电子设备处于熄屏状态的持续时长,其中,电子设备在定时器的计时时长达到第三预设时长或者退出熄屏状态时停止定时器计时,并复位定时器。这样,电子设备当定时器的计时时长达到第三预设时长时,通过三轴加速度传感器判断当前是否处于静止状态,是则判定当前满足睡眠预测条件。For example, the electronic device can start a timer for timing when entering the screen-off state, and use the timer duration to characterize the duration of the electronic device in the screen-off state, where the electronic device's timer duration reaches the third preset Stop the timer when the duration or exit the screen-off state, and reset the timer. In this way, when the timer duration reaches the third preset duration, the electronic device judges whether it is currently in a static state through the three-axis acceleration sensor, and if yes, it determines that the sleep prediction condition is currently met.
作为第四种可选的实施方式,睡眠预测条件被配置为:As a fourth optional implementation manner, the sleep prediction condition is configured as:
在处于静止状态的持续时长达到第四预设时长时处于熄屏状态。When the duration of the static state reaches the fourth preset duration, the screen is turned off.
比如,电子设备可以在进入静止状态的同时启动定时器进行计时,使用定时器的计时时长表征电子设备处于静止状态的持续时长,其中,电子设备在定时器的计时时长达到第四预设时长或者退出静止状态时停止定时器计时,并复位定时器。这样,电子设备当定时器的计时时长达到第四预设时长时,判断当前是否处于熄屏状态,是则判定当前满足睡眠预测条件。For example, the electronic device can start a timer for timing when entering a static state, and the duration of the timer is used to characterize the duration of the electronic device in the static state, where the timer duration of the electronic device reaches the fourth preset duration or Stop the timer counting when exiting the static state and reset the timer. In this way, when the time duration of the timer reaches the fourth preset duration, the electronic device determines whether the screen is currently in the off state, and if yes, determines that the sleep prediction condition is currently met.
应当说明的是,以上第一预设时长、第二预设时长第三预设时长以及第四预设时长的取值可以相同,也可以不同,具体可由本领域普通技术人员根据经验取合适值。比如,可以将第一预设时长、第二预设时长第三预设时长以及第四预设时长均设置为30分钟。It should be noted that the values of the first preset duration, the second preset duration, the third preset duration, and the fourth preset duration above may be the same or different. Specifically, a person of ordinary skill in the art can select appropriate values based on experience. . For example, the first preset duration, the second preset duration, the third preset duration, and the fourth preset duration may all be set to 30 minutes.
本申请实施例中,电子设备在判定当前满足预设的睡眠预测条件时,触发对用户的睡眠预测。首先,电子设备识别当日是否为用户的非工作日。为此,电子设备获取用户在当日使用电子设备的使用信息,记为第一使用信息,并根据该第一使用信息识别当日是否为用户的非工作日。应当说明的是,第一使用信息包括但不限于用于描述用户当日在何时使用电子设备的信息、何地使用电子设备的信息以及如何使用电子设备的信息,比如,如何使用电子设备的信息可以为用户使用电子设备运行了哪些应用、使用电子设备拨打了哪些电话以及电子设备的电量消耗速率等。In the embodiment of the present application, the electronic device triggers the sleep prediction of the user when it determines that the preset sleep prediction condition is currently met. First, the electronic device recognizes whether the current day is a non-working day of the user. To this end, the electronic device obtains the use information of the user using the electronic device on the current day, records it as the first use information, and identifies whether the current day is a non-working day of the user based on the first use information. It should be noted that the first use information includes, but is not limited to, information used to describe when the user uses the electronic device, where to use the electronic device, and how to use the electronic device, such as how to use the electronic device. It can provide information about which applications the user has run using the electronic device, which phone calls have been made using the electronic device, and the power consumption rate of the electronic device.
在203中,若是,则电子设备获取预先训练的对应非工作日的睡眠预测模型。In 203, if yes, the electronic device obtains a pre-trained sleep prediction model corresponding to a non-working day.
需要说明的是,本申请实施例在电子设备存储有预先训练的多个睡眠预测模型集合,其中,至少包括对应非工作日的睡眠预测模型(或者说,剩余在非 工作日对用户进行睡眠预测的睡眠预测模型)以及对应工作日的睡眠预测模型(或者说,适于在工作日对用户进行睡眠预测的睡眠预测模型)。It should be noted that the embodiment of the present application stores a plurality of pre-trained sleep prediction model sets in the electronic device, which includes at least a sleep prediction model corresponding to non-working days (or in other words, the remaining sleep prediction models for users on non-working days) The sleep prediction model of) and the sleep prediction model corresponding to the working day (or a sleep prediction model suitable for predicting the user’s sleep on the working day).
比如,请参照图2,电子设备存储有两个睡眠预测模型,分别为对应非工作日的A睡眠预测模型和对应工作日的B睡眠预测模型,这样,电子设备在判定当日为用户的非工作日时,将获取A睡眠预测模型用于后续对用户的睡眠预测,而在判定当日为用户的工作日时,将获取B睡眠预测模型用于后续对用户的睡眠预测。For example, referring to Figure 2, the electronic device stores two sleep prediction models, namely the sleep prediction model A corresponding to non-working days and the sleep prediction model B corresponding to working days. In this way, the electronic device is determined to be the user’s non-working day At time of day, the A sleep prediction model is used for subsequent sleep prediction of the user, and when it is determined that the current day is the user's working day, the B sleep prediction model is obtained for the subsequent sleep prediction of the user.
在204中,电子设备获取用户在当日以及历史非工作日的行为数据,历史非工作日为当日之前相同类型的非工作日。In 204, the electronic device obtains the user's behavior data on the current day and historical non-working days, and the historical non-working days are the same type of non-working days before the current day.
应当说明的是,在本申请实施例中,对应非工作日的睡眠预测模型根据用户在多个相同类型的非工作日的行为数据进行睡眠预测,因此,电子设备在获取到预先训练的对应非工作日的睡眠预测模型之后,进一步获取用户在当日以及至少一个历史非工作日的行为数据。其中,历史非工作日为当日之前相同类型的非工作日,行为数据包括但不限于用户的运动行为数据(比如消耗的热量、行走的步数等)、休息行为数据以及娱乐行为数据等等。It should be noted that in this embodiment of the application, the sleep prediction model corresponding to non-working days performs sleep prediction based on the user’s behavior data on multiple non-working days of the same type. Therefore, the electronic device obtains the pre-trained corresponding non-working days. After the sleep prediction model of the working day, the user's behavior data on that day and at least one historical non-working day is further obtained. Among them, the historical non-working day is the same type of non-working day before the current day, and the behavior data includes but not limited to the user's exercise behavior data (such as calories burned, number of steps taken, etc.), rest behavior data, entertainment behavior data, and so on.
比如,当日为周末,为用户的非工作日,电子设备获取用户在当日的行为数据,以及获取用户在当日之前多个周末的行为数据。For example, if the current day is a weekend, it is a non-working day of the user, and the electronic device obtains the user's behavior data on that day and the user's behavior data on multiple weekends before the current day.
在205中,电子设备根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测的睡眠区间。In 205, the electronic device performs sleep prediction on the user according to the acquired behavior data and the sleep prediction model to obtain the predicted sleep interval.
其中,电子设备在获取到预先训练的对应非工作日的睡眠预测模型,以及获取到用户在当日以及历史非工作日的行为数据之后,即可根据获取到的睡眠预测模型以及行为数据对用户进行睡眠预测,得到预测的睡眠区间。比如,根据获取到的睡眠预测模型以及行为数据对用户进行睡眠预测,得到预测的睡眠区间为当日23:30-次日06:30,或者得到预测的睡眠区间为前日23:30-当日06:30。Among them, after the electronic device obtains the pre-trained sleep prediction model corresponding to the non-working day, and obtains the user's behavior data on the current day and historical non-working days, it can perform the sleep prediction model and behavior data on the user according to the obtained sleep prediction model and behavior data. Sleep prediction, get the predicted sleep interval. For example, according to the obtained sleep prediction model and behavior data to predict the user's sleep, the predicted sleep interval is from 23:30 on the same day to 06:30 the next day, or the predicted sleep interval is from 23:30 on the previous day to 06:30 on the next day: 30.
在206中,电子设备根据预测的睡眠区间判断用户当前是否处于睡眠状态。In 206, the electronic device determines whether the user is currently in a sleep state according to the predicted sleep interval.
比如,预测的睡眠区间指示用户的睡眠区间为当日23:30-次日06:30,若电子设备的当前时刻为当日23:25,则判定用户当前不处于睡眠状态,若电子设备的当前时刻为当日23:45,则判定用户当前处于睡眠状态。For example, the predicted sleep interval indicates that the user's sleep interval is from 23:30 on the current day to 06:30 on the next day. If the current time of the electronic device is 23:25 on the current day, it is determined that the user is not currently in a sleep state. If the current time of the electronic device is If it is 23:45 of the day, it is determined that the user is currently asleep.
在207中,若是,则电子设备执行预设操作,其中,预设操作包括系统更 新操作、应用更新操作以及功耗控制操作中的至少一种。In 207, if yes, the electronic device performs a preset operation, where the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
本申请实施例中,电子设备在判定用户当前处于睡眠状态时,执行预先配置的、在用户处于睡眠状态时执行的预设操作。其中,预设操作包括但不限于系统更新操作、应用更新操作以及功耗控制操作中的至少一种,可以由用户手动配置,也可由电子设备缺省配置。In the embodiment of the present application, when the electronic device determines that the user is currently in the sleep state, it performs a pre-configured preset operation that is executed when the user is in the sleep state. Wherein, the preset operation includes but is not limited to at least one of a system update operation, an application update operation, and a power consumption control operation, which may be manually configured by the user or may be configured by the electronic device by default.
比如,电子设备可以将系统更新操作配置为预设操作,从而在用户处于睡眠状态时执行系统更新操作,将系统更新到最新版本;电子设备也可以将应用更新操作配置为预设操作,从而在用户处于睡眠状态时执行应用更新操作,将已安装的应用程序更新到最新版本等;电子设备可以将功耗控制操作配置为预设操作,从而在用户处于睡眠状态时应用预设的用于降低功耗的功耗控制策略,降低电子设备的功耗等等。For example, the electronic device can configure the system update operation as a preset operation, so as to perform the system update operation when the user is in sleep state, and update the system to the latest version; the electronic device can also configure the application update operation as a preset operation, The user performs application update operations when the user is asleep, updates the installed applications to the latest version, etc.; electronic devices can configure the power consumption control operation as a preset operation, thereby applying the preset for reduction when the user is asleep Power consumption control strategy for power consumption, reducing the power consumption of electronic devices and so on.
又比如,请参照图4,电子设备提供有预设操作配置界面,如图4所示,预设操作配置界面包括提示信息“请选择睡眠期间执行的操作”,操作选择框、下拉按钮、下拉菜单、确定按钮以及取消按钮,其中,下拉菜单根据用户对下拉按钮的点击操作呼出,下拉菜单中提供有电子设备可以在用户睡眠区间内执行的多种操作,如图4中示出的系统更新操作、应用更新操作等,用户可以根据实际需要选择电子设备在其睡眠时执行的操作,并在选定需要由电子设备在其睡眠时执行的操作后,点击确定按钮,指示电子设备将用户选择的操作作为前述预设操作。或者,若用户发现无需要电子设备在其睡眠时执行的操作,则可以点击取消按钮,指示电子设备执行缺省配置的预设操作。For another example, please refer to Figure 4. The electronic device provides a preset operation configuration interface. As shown in Figure 4, the preset operation configuration interface includes the prompt message "Please select the operation performed during sleep", operation selection box, drop-down button, drop-down Menu, OK button, and Cancel button. Among them, the drop-down menu is called out according to the user's click operation on the drop-down button. The drop-down menu provides various operations that the electronic device can perform during the user's sleep interval, as shown in the system update in Figure 4 Operation, application update operations, etc., the user can select the operation performed by the electronic device during sleep according to actual needs, and after selecting the operation that needs to be performed by the electronic device during sleep, click the OK button to instruct the electronic device to select the user The operation as the aforementioned preset operation. Or, if the user finds that there is no need for the operation performed by the electronic device during sleep, he can click the cancel button to instruct the electronic device to perform the preset operation of the default configuration.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日时,可以执行:In one embodiment, when identifying whether the current day is a non-working day of the user according to the first usage information, the following can be performed:
(1)电子设备获取预存的用户在其工作日使用电子设备的第二使用信息;(1) The electronic device obtains the pre-stored second use information of the user using the electronic device on his workday;
(2)电子设备判断第一使用信息是否与第二使用信息匹配,是则判定当日为用户的工作日,否则判定当日为用户的非工作日。(2) The electronic device judges whether the first usage information matches the second usage information, if yes, it is judged that the current day is the user's working day, otherwise it is judged that the current day is the user's non-working day.
本申请实施例中,考虑到用户在工作日使用电子设备时存在一定的规律性,比如在固定的时间段使用电子设备,而用户在非工作日使用电子设备时则无规律可循,因此,预先在电子设备存储有其在工作日使用电子设备的使用信息,记为第二使用信息。其中,对于使用信息是否为用户在其工作日使用电子设备的使用信息,可由用户根据实际情况进行标定。In the embodiments of the present application, it is considered that there is a certain regularity when users use electronic devices on weekdays, such as using electronic devices during a fixed period of time, while users have irregularities when using electronic devices on non-working days. Therefore, Pre-stored in the electronic device the usage information of the electronic device used on weekdays is recorded as the second usage information. Among them, whether the usage information is the usage information of the electronic device used by the user during the working day can be calibrated by the user according to the actual situation.
这样,电子设备在根据第一使用信息识别当日是否为用户的非工作日时,可以获取到预存的用户在其工作日使用电子设备的第二使用信息,并判断第一使用信息是否与第二使用信息匹配,其中,若第一使用信息与第二使用信息匹配,则电子设备判定当日为用户的工作日,否则判定当日为用户的非工作日。In this way, when the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information, it can obtain the pre-stored second usage information of the user using the electronic device on its working day, and determine whether the first usage information matches the second usage information. Use information matching, where if the first use information matches the second use information, the electronic device determines that the current day is the user's working day, otherwise it determines that the current day is the user's non-working day.
在一实施方式中,在判断第一使用信息是否与第二使用信息匹配时,可以执行:In an embodiment, when determining whether the first usage information matches the second usage information, the following can be performed:
(1)电子设备获取第一使用信息与第二使用信息的相似度;(1) The similarity between the first use information and the second use information acquired by the electronic device;
(2)电子设备判断获取到的相似度是否达到预设相似度,是则判定第一使用信息与第二使用信息匹配,否则不匹配。(2) The electronic device judges whether the acquired similarity reaches the preset similarity, and if yes, it judges that the first usage information matches the second usage information, otherwise it does not match.
本申请实施例中,电子设备可以根据第一使用信息和第二使用信息之间的相似度来判断二者是否匹配,这样,电子设备在判定第一使用信息是否与第二使用信息匹配时,可以获取第一使用信息和第二使用信息之间的相似度,并判定获取到的相似度是否达到预设相似度,是则判定第一使用信息和第二使用信息匹配,否则判定第一使用信息和第二使用信息不匹配。应当说明的是,本申请实施例中对于预设相似度的取值不做具体限制,可由本领域普通技术人员根据经验需要取合适值。In the embodiment of the present application, the electronic device can determine whether the first usage information and the second usage information match according to the similarity between the two. In this way, when the electronic device determines whether the first usage information matches the second usage information, The similarity between the first use information and the second use information can be obtained, and it is determined whether the obtained similarity reaches the preset similarity. If yes, it is determined that the first use information and the second use information match, otherwise the first use information is determined The information does not match the second usage information. It should be noted that there is no specific limitation on the value of the preset similarity in the embodiments of the present application, and a person of ordinary skill in the art can select an appropriate value according to experience needs.
其中,电子设备在获取第一使用信息和第二使用信息的相似度时,采用编码器神经网络分别对第一使用信息和第二使用信息进行编码,得到对应第一使用信息的第一词向量集合,以及得到对应第二使用信息的第二词向量集合。其中,本申请实施例并不限定编码器神经网络的具体模型和拓扑结构,比如,可以采用单层的递归神经网络进行训练得到编码器神经网络,也可以采用多层的递归神经网络进行训练得到编码器神经网络还可以采用卷积神经网络、或者其变种、或者其他网络结构的神经网络进行训练,得到编码器神经网络。Wherein, when the electronic device obtains the similarity between the first usage information and the second usage information, it uses the encoder neural network to respectively encode the first usage information and the second usage information to obtain the first word vector corresponding to the first usage information Set, and obtain a second word vector set corresponding to the second usage information. Among them, the embodiment of the application does not limit the specific model and topology of the encoder neural network. For example, a single-layer recurrent neural network can be used for training to obtain an encoder neural network, or a multi-layer recurrent neural network can be used for training. The encoder neural network can also be trained using a convolutional neural network, or its variants, or neural networks of other network structures to obtain an encoder neural network.
电子设备在获取到对应第一使用信息的第一词向量集合以及获取到对应第二使用信息的第二词向量集合之后,计算第一词向量集合和第二词向量集合之间的特征距离,并将计算得到的特征距离作为第一使用信息和第二使用信息之间的相似度。After acquiring the first word vector set corresponding to the first use information and the second word vector set corresponding to the second use information, the electronic device calculates the characteristic distance between the first word vector set and the second word vector set, The calculated feature distance is used as the similarity between the first use information and the second use information.
其中,可由本领域普通技术人员根据实际需要选取任意一种特征距离(比如欧氏距离、曼哈顿距离、切比雪夫距离以及余弦距离等)来衡量两个词向量 集合之间的距离,本申请实施例对此不做具体限制。Among them, a person of ordinary skill in the art can select any characteristic distance (such as Euclidean distance, Manhattan distance, Chebyshev distance, cosine distance, etc.) to measure the distance between two word vector sets according to actual needs. The implementation of this application The example does not make specific restrictions on this.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日时,可以执行:In one embodiment, when identifying whether the current day is a non-working day of the user according to the first usage information, the following can be performed:
电子设备根据第一使用信息以及预先训练的工作日识别模型,识别当日是否为用户的非工作日。The electronic device recognizes whether the current day is a non-working day of the user according to the first usage information and the pre-trained working day recognition model.
本申请实施例中,可以预先训练用于工作日识别的工作日识别模型,并将该工作日识别模型配置在电子设备本地。这样,电子设备在根据第一使用信息识别当日是否为用户的非工作日时,可以根据第一使用信息以及预先训练的工作日识别模型,识别当日是否为用户的非工作日。In the embodiment of the present application, a workday recognition model for workday recognition can be trained in advance, and the workday recognition model can be configured locally in the electronic device. In this way, when the electronic device recognizes whether the current day is a non-working day of the user according to the first usage information, it can recognize whether the current day is a non-working day of the user according to the first usage information and the pre-trained working day recognition model.
比如,可以采用非监督学习方法对用户在一年内所有自然日的使用电子设备的使用信息进行训练,得到一个能够对输入的使用信息进行分类的使用信息分类器,将该使用信息分类器作为工作日识别模型。这样,只要将第一使用信息输入到使用信息分类器进行使用信息的分类,根据使用信息分类器输出的分类结果即可判定当日是否为用户的非工作日,其中,若使用信息分类器的输出指示第一使用信息为工作日的使用信息,则可判定当日为用户的工作日,若使用信息分类器的输出指示第一使用信息为非工作日的使用信息,则可判定当日为用户的非工作日。For example, an unsupervised learning method can be used to train the user's usage information of electronic devices on all natural days within a year to obtain a usage information classifier that can classify the input usage information, and use the usage information classifier as the work Day recognition model. In this way, as long as the first use information is input to the use information classifier to classify the use information, it can be determined whether the day is a non-working day of the user according to the classification result output by the use information classifier, and if the output of the information classifier is used If the first usage information indicates that the first usage information is the usage information of a working day, it can be determined that the current day is the user's working day. If the output of the usage information classifier indicates that the first usage information is the usage information of a non-working day, it can be determined that the current day is the user's non-working day. Working day.
在一实施方式中,在执行预设操作之前,可以执行:In one embodiment, before performing the preset operation, you can perform:
(1)电子设备获取用户配置的作息计划;(1) The electronic device obtains the user-configured schedule;
(2)电子设备根据获取到的作息计划获取用户计划的睡眠区间,并判断当前是否位于计划的睡眠区间之内;(2) The electronic device obtains the sleep interval planned by the user according to the obtained schedule and determines whether it is currently within the planned sleep interval;
(3)若是,则电子设备执行预设操作。(3) If yes, the electronic device performs a preset operation.
本申请实施例中,电子设备在判定用户处于睡眠状态时,获取用户配置的作息计划,并进一步根据获取到的作息计划获取用户计划的睡眠区间,并判断当前是否位于计划的睡眠区间之内,若是,则说明预测结果与用户配置的作息计划一致,此时执行预设操作。In the embodiment of the present application, when the electronic device determines that the user is in a sleep state, obtains the schedule configured by the user, and further obtains the sleep interval planned by the user according to the obtained schedule, and determines whether it is currently within the planned sleep interval. If it is, it means that the predicted result is consistent with the schedule configured by the user, and the preset operation is performed at this time.
比如,电子设备获取到用户配置的作息计划为10:30睡,6:30起,7:00做某某事,则根据该作息计划,电子设备可以获取到用户计划的睡眠区间为10:30-6:30。For example, if the electronic device obtains the user-configured schedule for sleeping at 10:30, starting at 6:30 and doing something at 7:00, then according to the schedule, the electronic device can obtain the user's scheduled sleep interval as 10:30 -6:30.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日之 后,还包括:In one embodiment, after identifying whether the current day is a non-working day of the user according to the first usage information, the method further includes:
(1)若否,则电子设备获取预先训练的对应工作日的睡眠预测模型;(1) If not, the electronic device obtains the pre-trained sleep prediction model corresponding to the working day;
(2)电子设备获取用户在当日以及历史工作日的行为数据,历史工作日为当日之前的工作日;(2) The electronic device obtains the user's behavior data on the current day and the historical working day, and the historical working day is the working day before the current day;
(3)电子设备根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果;(3) The electronic device predicts the user's sleep based on the acquired behavior data and the sleep prediction model, and obtains the prediction result;
(4)电子设备根据得到预测结果判断用户当前是否处于睡眠状态;(4) The electronic device judges whether the user is currently asleep according to the obtained prediction result;
(5)若是,则电子设备执行预设操作。(5) If yes, the electronic device performs a preset operation.
其中,电子设备在识别到当日为用户的工作日时,获取到的预先训练的对应工作日的睡眠预测模型,用于后续对用户的睡眠预测。Wherein, when the electronic device recognizes that the current day is the user's working day, the pre-trained sleep prediction model corresponding to the working day is acquired for subsequent sleep prediction of the user.
应当说明的是,在本申请实施例中,对应工作日的睡眠预测模型根据用户在多个工作日的行为数据进行睡眠预测,因此,电子设备在获取到预先训练的对应工作日的睡眠预测模型之后,进一步获取用户在当日以及至少一个历史工作日的行为数据。其中,历史工作日为当日之前的工作日。It should be noted that in the embodiments of the present application, the sleep prediction model corresponding to the working day performs sleep prediction based on the user's behavior data on multiple working days. Therefore, the electronic device obtains the pre-trained sleep prediction model corresponding to the working day Then, further obtain the user's behavior data on the current day and at least one historical working day. Among them, the historical working day is the working day before the current day.
电子设备在获取到预先训练的对应工作日的睡眠预测模型,以及获取到用户在当日以及历史工作日的行为数据之后,即可根据获取到的睡眠预测模型以及行为数据对用户进行睡眠预测,得到预测结果。After the electronic device obtains the pre-trained sleep prediction model corresponding to the working day, and obtains the user's behavior data on the current day and the historical working day, it can perform sleep prediction on the user according to the obtained sleep prediction model and behavior data to obtain forecast result.
应当说明的是,对用户的睡眠预测包括但不限于用户进入睡眠的时刻、结束睡眠的时刻以及进入睡眠的时刻和结束睡眠的时刻所组成的睡眠区间等。比如,根据获取到的睡眠预测模型以及行为数据对用户进行睡眠预测,得到用户的睡眠区间为当日23:30-次日06:60,或者得到用户的睡眠区间为前日23:30-当日06:30。It should be noted that the sleep prediction of the user includes but is not limited to the time when the user enters sleep, the time when the user ends sleep, and the sleep interval composed of the time when the user enters sleep and the time when sleep ends. For example, according to the obtained sleep prediction model and behavior data, the user's sleep prediction is performed, and the user's sleep interval is obtained from 23:30 on the same day to 06:60 the next day, or the user's sleep interval is obtained from 23:30 on the previous day to 06:60 on the same day. 30.
电子设备在得到对用户进行睡眠预测的预测结果之后,进一步根据得到的预测结果判断用户当前是否处于睡眠状态。比如,电子设备对用户进行睡眠预测得到的预测结果指示用户的睡眠区间为当日23:30-次日06:30,若电子设备的当前时刻为当日23:25,则判定用户当前不处于睡眠状态,若电子设备的当前时刻为当日23:45,则判定用户当前处于睡眠状态。After obtaining the prediction result of the sleep prediction for the user, the electronic device further determines whether the user is currently in a sleep state according to the obtained prediction result. For example, the prediction result obtained by the electronic device for the user’s sleep prediction indicates that the user’s sleep interval is from 23:30 on the current day to 06:30 on the next day. If the current time of the electronic device is 23:25 on the current day, it is determined that the user is not currently sleeping If the current time of the electronic device is 23:45 of the current day, it is determined that the user is currently sleeping.
电子设备在判定用户当前处于睡眠状态时,执行预先配置的、在用户处于睡眠状态时执行的预设操作。其中,预设操作包括系统更新操作、应用更新操作以及功耗控制操作中的至少一种,可以由用户手动配置,也可由电子设备缺 省配置。When determining that the user is currently in the sleep state, the electronic device executes a pre-configured preset operation that is executed when the user is in the sleep state. Wherein, the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation, which may be manually configured by the user or may be configured by the electronic device by default.
请参照图5,图5为本申请实施例提供的睡眠预测装置的结构示意图。该睡眠预测装置可以应用于电子设备。睡眠预测装置可以包括:日期识别模块401、模型获取模块402、数据获取模块403以及睡眠预测模块404。Please refer to FIG. 5, which is a schematic structural diagram of a sleep prediction device provided by an embodiment of the application. The sleep prediction device can be applied to electronic equipment. The sleep prediction device may include: a date recognition module 401, a model acquisition module 402, a data acquisition module 403, and a sleep prediction module 404.
日期识别模块401,用于在当前满足预设的睡眠预测条件时,识别当日是否为用户的非工作日;The date identification module 401 is used to identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met;
模型获取模块402,用于在日期识别模块401的识别结果为是时,获取预先训练的对应非工作日的睡眠预测模型;The model obtaining module 402 is configured to obtain a pre-trained sleep prediction model corresponding to a non-working day when the recognition result of the date recognition module 401 is yes;
数据获取模块403,用于获取用户在当日以及历史非工作日的行为数据,历史非工作日为当日之前相同类型的非工作日;The data acquisition module 403 is used to acquire user behavior data on the current day and historical non-working days. The historical non-working days are the same type of non-working days before the current day;
睡眠预测模块404,用于根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果。The sleep prediction module 404 is configured to perform sleep prediction on the user according to the acquired behavior data and the sleep prediction model to obtain the prediction result.
在一实施方式中,行为数据包括运动行为数据、休息行为数据以及娱乐行为数据。In one embodiment, the behavior data includes sports behavior data, rest behavior data, and entertainment behavior data.
在一实施方式中,在识别当日是否为用户的非工作日时,日期识别模块401可以用于:In an embodiment, when identifying whether the current day is a non-working day of the user, the date identification module 401 may be used to:
获取用户在当日使用电子设备的第一使用信息;Obtain the first use information of the electronic device used by the user on the day;
根据第一使用信息识别当日是否为用户的非工作日。According to the first usage information, identify whether the day is a non-working day of the user.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日时,日期识别模块401可以用于:In an embodiment, when identifying whether the current day is a non-working day of the user according to the first usage information, the date identification module 401 may be used to:
获取预存的用户在其工作日使用电子设备的第二使用信息;Obtain the pre-stored second usage information of the user's use of the electronic device during his working day;
判断第一使用信息是否与第二使用信息匹配,是则判定当日为用户的工作日,否则判定当日为用户的非工作日。It is judged whether the first usage information matches the second usage information, if yes, it is judged that the current day is the user's working day, otherwise it is judged that the current day is the user's non-working day.
在一实施方式中,在判断第一使用信息是否与第二使用信息匹配时,日期识别模块401可以用于:In an embodiment, when determining whether the first usage information matches the second usage information, the date identification module 401 may be used to:
获取第一使用信息与第二使用信息的相似度;Acquiring the similarity between the first usage information and the second usage information;
判断获取到的相似度是否达到预设相似度,是则判定第一使用信息与第二使用信息匹配,否则不匹配。It is determined whether the acquired similarity reaches the preset similarity, and if yes, it is determined that the first usage information matches the second usage information, otherwise it does not match.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日时, 日期识别模块401可以用于:In one embodiment, when identifying whether the current day is a non-working day of the user according to the first usage information, the date identification module 401 may be used to:
根据第一使用信息以及预先训练的工作日识别模型,识别当日是否为用户的非工作日。According to the first usage information and the pre-trained working day recognition model, it is recognized whether the current day is a non-working day of the user.
在一实施方式中,睡眠预测条件包括:In one embodiment, the sleep prediction conditions include:
处于熄屏状态的持续时长达到第一预设时长;The duration of the screen off state reaches the first preset duration;
或者,处于静止状态的持续时长达到第二预设时长;Or, the duration of the static state reaches the second preset duration;
或者,在处于熄屏状态的持续时长达到第三预设时长时处于静止状态;Or, stay in a static state when the duration of the screen off state reaches the third preset duration;
或者,在处于静止状态的持续时长达到第四预设时长时处于熄屏状态。Or, the screen is turned off when the duration of the static state reaches the fourth preset duration.
在一实施方式中,预测结果包括预测的睡眠区间,睡眠预测装置还包括操作执行模块,用于:In one embodiment, the prediction result includes the predicted sleep interval, and the sleep prediction device further includes an operation execution module for:
根据预测的睡眠区间判断用户当前是否处于睡眠状态;Judging whether the user is currently sleeping according to the predicted sleep interval;
若是,则执行预设操作,其中,预设操作包括系统更新操作、应用更新操作以及功耗控制操作中的至少一种。If so, perform a preset operation, where the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
在一实施方式中,在执行预设操作之前,操作执行模块可以用于:In an embodiment, before executing the preset operation, the operation execution module may be used to:
获取用户配置的作息计划;Get the work schedule configured by the user;
根据获取到的作息计划获取用户计划的睡眠区间,并判断当前是否位于计划的睡眠区间之内;Obtain the sleep interval planned by the user according to the obtained schedule, and determine whether it is currently within the planned sleep interval;
若是,则执行预设操作。If yes, perform the preset operation.
在一实施方式中,预设操作包括系统更新操作、应用更新操作以及功耗控制操作中的至少一种。In an embodiment, the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
在一实施方式中,在日期识别模块401识别当日是否为用户的非工作日之后,若日期识别模块401的识别结果为否,模型获取模块402还用于获取预先训练的对应工作日的睡眠预测模型;In one embodiment, after the date recognition module 401 recognizes whether the day is a non-working day of the user, if the recognition result of the date recognition module 401 is no, the model acquisition module 402 is also used to obtain the pre-trained sleep prediction corresponding to the working day model;
数据获取模块403还用于获取用户在当日以及历史工作日的行为数据,历史工作日为当日之前的工作日;The data acquisition module 403 is also used to acquire user behavior data on the current day and historical working days, and the historical working day is the working day before the current day;
睡眠预测模块404还用于根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果。The sleep prediction module 404 is also used to predict the user's sleep according to the acquired behavior data and the sleep prediction model, and obtain the prediction result.
本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当其存储的计算机程序在计算机上执行时,使得计算机执行如本申请实施例提 供的睡眠预测方法中的步骤。The embodiment of the present application provides a computer-readable storage medium with a computer program stored thereon, and when the stored computer program is executed on a computer, the computer executes the steps in the sleep prediction method provided in the embodiment of the present application.
本申请实施例还提供一种电子设备,包括存储器,处理器,处理器通过调用存储器中存储的计算机程序,执行本申请实施例提供的睡眠预测方法中的步骤。An embodiment of the present application further provides an electronic device including a memory and a processor, and the processor executes the steps in the sleep prediction method provided in the embodiment of the present application by calling a computer program stored in the memory.
请参照图6,图6为本申请实施例提供的电子设备的结构示意图。该电子设备可以包括存储器601以及处理器602。本领域普通技术人员可以理解,图6中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Please refer to FIG. 6, which is a schematic structural diagram of an electronic device provided by an embodiment of the application. The electronic device may include a memory 601 and a processor 602. A person of ordinary skill in the art can understand that the structure of the electronic device shown in FIG. 6 does not constitute a limitation on the electronic device, and may include more or less components than those shown in the figure, or a combination of certain components, or different component arrangements. .
存储器601可用于存储应用程序和数据。存储器601存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器602通过运行存储在存储器601的应用程序,从而执行各种功能应用以及数据处理。The memory 601 can be used to store application programs and data. The application program stored in the memory 601 contains executable code. Application programs can be composed of various functional modules. The processor 602 executes various functional applications and data processing by running application programs stored in the memory 601.
处理器602是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器601内的应用程序,以及调用存储在存储器601内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 602 is the control center of the electronic device. It uses various interfaces and lines to connect the various parts of the entire electronic device, and executes the electronic device by running or executing the application program stored in the memory 601 and calling the data stored in the memory 601 The various functions and processing data of the electronic device can be used to monitor the electronic equipment as a whole.
在本申请实施例中,电子设备中的处理器602会按照如下的指令,将一个或一个以上的音频处理程序的进程对应的可执行代码加载到存储器601中,并由处理器602来运行存储在存储器601中的应用程序,从而执行:In the embodiment of the present application, the processor 602 in the electronic device will load the executable code corresponding to the process of one or more audio processing programs into the memory 601 according to the following instructions, and the processor 602 will run and store the executable code The application program in the memory 601 thus executes:
若当前满足预设的睡眠预测条件,则识别当日是否为用户的非工作日;If the preset sleep prediction conditions are currently met, identify whether the day is a non-working day of the user;
若是,则获取预先训练的对应非工作日的睡眠预测模型;If yes, obtain the pre-trained sleep prediction model corresponding to the non-working day;
获取用户在当日以及历史非工作日的行为数据,历史非工作日为当日之前相同类型的非工作日;Obtain user behavior data on the current day and historical non-working days. The historical non-working days are the same types of non-working days before the current day;
根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果。Perform sleep prediction on the user according to the acquired behavior data and the sleep prediction model, and obtain the prediction result.
请参照图7,图7为本申请实施例提供的电子设备的另一结构示意图,与图6所示电子设备的区别在于,电子设备还包括输入单元603和输出单元604等组件。Please refer to FIG. 7. FIG. 7 is another schematic structural diagram of the electronic device provided by an embodiment of the application. The difference from the electronic device shown in FIG. 6 is that the electronic device further includes components such as an input unit 603 and an output unit 604.
其中,输入单元603可用于接收输入的数字、字符信息或用户特征信息(比如指纹),以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光 学或者轨迹球信号输入等。The input unit 603 can be used to receive input numbers, character information or user characteristic information (such as fingerprints), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
输出单元604可用于输出由用户输入的信息或提供给用户的信息,如扬声器等。The output unit 604 may be used to output information input by the user or information provided to the user, such as a speaker.
在本申请实施例中,电子设备中的处理器602会按照如下的指令,将一个或一个以上的音频处理程序的进程对应的可执行代码加载到存储器601中,并由处理器602来运行存储在存储器601中的应用程序,从而执行:In the embodiment of the present application, the processor 602 in the electronic device will load the executable code corresponding to the process of one or more audio processing programs into the memory 601 according to the following instructions, and the processor 602 will run and store the executable code The application program in the memory 601 thus executes:
若当前满足预设的睡眠预测条件,则识别当日是否为用户的非工作日;If the preset sleep prediction conditions are currently met, identify whether the day is a non-working day of the user;
若是,则获取预先训练的对应非工作日的睡眠预测模型;If yes, obtain the pre-trained sleep prediction model corresponding to the non-working day;
获取用户在当日以及历史非工作日的行为数据,历史非工作日为当日之前相同类型的非工作日;Obtain user behavior data on the current day and historical non-working days. The historical non-working days are the same types of non-working days before the current day;
根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果。Perform sleep prediction on the user according to the acquired behavior data and the sleep prediction model, and obtain the prediction result.
在一实施方式中,行为数据包括运动行为数据、休息行为数据以及娱乐行为数据。In one embodiment, the behavior data includes sports behavior data, rest behavior data, and entertainment behavior data.
在一实施方式中,在识别当日是否为用户的非工作日时,处理器602可以执行:In an embodiment, when identifying whether the current day is a non-working day of the user, the processor 602 may execute:
获取用户在当日使用电子设备的第一使用信息;Obtain the first use information of the electronic device used by the user on the day;
根据第一使用信息识别当日是否为用户的非工作日。According to the first usage information, identify whether the day is a non-working day of the user.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日时,处理器602可以执行:In an embodiment, when identifying whether the current day is a non-working day of the user according to the first usage information, the processor 602 may execute:
获取预存的用户在其工作日使用电子设备的第二使用信息;Obtain the pre-stored second usage information of the user's use of the electronic device during his working day;
判断第一使用信息是否与第二使用信息匹配,是则判定当日为用户的工作日,否则判定当日为用户的非工作日。It is judged whether the first usage information matches the second usage information, if yes, it is judged that the current day is the user's working day, otherwise it is judged that the current day is the user's non-working day.
在一实施方式中,在判断第一使用信息是否与第二使用信息匹配时,处理器602可以执行:In an implementation manner, when determining whether the first usage information matches the second usage information, the processor 602 may execute:
获取第一使用信息与第二使用信息的相似度;Acquiring the similarity between the first usage information and the second usage information;
判断获取到的相似度是否达到预设相似度,是则判定第一使用信息与第二使用信息匹配,否则不匹配。It is determined whether the acquired similarity reaches the preset similarity, and if yes, it is determined that the first usage information matches the second usage information, otherwise it does not match.
在一实施方式中,在根据第一使用信息识别当日是否为用户的非工作日时,处理器602可以执行:In an embodiment, when identifying whether the current day is a non-working day of the user according to the first usage information, the processor 602 may execute:
根据第一使用信息以及预先训练的工作日识别模型,识别当日是否为用户的非工作日。According to the first usage information and the pre-trained working day recognition model, it is recognized whether the current day is a non-working day of the user.
在一实施方式中,睡眠预测条件包括:In one embodiment, the sleep prediction conditions include:
处于熄屏状态的持续时长达到第一预设时长;The duration of the screen off state reaches the first preset duration;
或者,处于静止状态的持续时长达到第二预设时长;Or, the duration of the static state reaches the second preset duration;
或者,在处于熄屏状态的持续时长达到第三预设时长时处于静止状态;Or, stay in a static state when the duration of the screen off state reaches the third preset duration;
或者,在处于静止状态的持续时长达到第四预设时长时处于熄屏状态。Or, the screen is turned off when the duration of the static state reaches the fourth preset duration.
在一实施方式中,预测结果包括预测的睡眠区间,在根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果之后,处理器602可以执行:In one embodiment, the prediction result includes the predicted sleep interval. After performing sleep prediction on the user according to the acquired behavior data and the sleep prediction model, and after obtaining the prediction result, the processor 602 may execute:
根据预测的睡眠区间判断用户当前是否处于睡眠状态;Judging whether the user is currently sleeping according to the predicted sleep interval;
若是,则执行预设操作,其中,预设操作包括系统更新操作、应用更新操作以及功耗控制操作中的至少一种。If so, perform a preset operation, where the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
在一实施方式中,在执行预设操作之前,处理器602可以执行:In an embodiment, before performing a preset operation, the processor 602 may perform:
获取用户配置的作息计划;Get the work schedule configured by the user;
根据获取到的作息计划获取用户计划的睡眠区间,并判断当前是否位于计划的睡眠区间之内;Obtain the sleep interval planned by the user according to the obtained schedule, and determine whether it is currently within the planned sleep interval;
若是,则执行预设操作。If yes, perform the preset operation.
在一实施方式中,预设操作包括系统更新操作、应用更新操作以及功耗控制操作中的至少一种。In an embodiment, the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
在一实施方式中,在识别当日是否为用户的非工作日之后,处理器602可以执行:In an embodiment, after identifying whether the current day is a non-working day of the user, the processor 602 may execute:
若否,则获取预先训练的对应工作日的睡眠预测模型;If not, obtain the pre-trained sleep prediction model corresponding to the working day;
获取用户在当日以及历史工作日的行为数据,历史工作日为当日之前的工作日;Obtain the user's behavior data on the current day and the historical working day. The historical working day is the working day before the current day;
根据获取到的行为数据以及睡眠预测模型对用户进行睡眠预测,得到预测结果。Perform sleep prediction on the user according to the acquired behavior data and the sleep prediction model, and obtain the prediction result.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对睡眠预测方法的详细描述,此处不再赘述。In the foregoing embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in an embodiment, please refer to the detailed description of the sleep prediction method above, which will not be repeated here.
本申请实施例提供的睡眠预测装置/电子设备与上文实施例中的睡眠预测 方法属于同一构思,在睡眠预测装置/电子设备上可以运行睡眠预测方法实施例中提供的任一方法,其具体实现过程详见睡眠预测方法实施例,此处不再赘述。The sleep prediction device/electronic device provided by the embodiment of the application belongs to the same concept as the sleep prediction method in the above embodiment. Any method provided in the sleep prediction method embodiment can be run on the sleep prediction device/electronic device. For the implementation process, refer to the embodiment of the sleep prediction method, which will not be repeated here.
需要说明的是,对本申请实施例睡眠预测方法而言,本领域普通技术人员可以理解实现本申请实施例睡眠预测方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,计算机程序可存储于一计算机可读取存储介质中,如存储在存储器中,并被至少一个处理器执行,在执行过程中可包括如睡眠预测方法的实施例的流程。其中,的存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。It should be noted that for the sleep prediction method of the embodiment of the present application, those of ordinary skill in the art can understand that all or part of the process of implementing the sleep prediction method of the embodiment of the present application can be completed by controlling the relevant hardware through a computer program. The program may be stored in a computer readable storage medium, such as stored in a memory, and executed by at least one processor, and the execution process may include a process such as an embodiment of the sleep prediction method. Among them, the storage medium may be a magnetic disk, an optical disc, a read only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), etc.
对本申请实施例的睡眠预测装置而言,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中,存储介质譬如为只读存储器,磁盘或光盘等。For the sleep prediction device of the embodiment of the present application, its functional modules may be integrated in one processing chip, or each module may exist alone physically, or two or more modules may be integrated in one module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
以上对本申请实施例所提供的一种睡眠预测方法、装置、存储介质以及电子设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。The above describes in detail a sleep prediction method, device, storage medium, and electronic equipment provided by the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementations of the present application. The description of the above embodiments is only It is used to help understand the method and core idea of this application; at the same time, for those skilled in the art, according to the idea of this application, there will be changes in the specific implementation and scope of application. In summary, the content of this specification does not It should be understood as a limitation of this application.

Claims (10)

  1. 一种睡眠预测方法,应用于电子设备,其中,包括:A sleep prediction method applied to electronic equipment, including:
    若当前满足预设的睡眠预测条件,则识别当日是否为用户的非工作日;If the preset sleep prediction conditions are currently met, identify whether the day is a non-working day of the user;
    若是,则获取预先训练的对应非工作日的睡眠预测模型;If yes, obtain the pre-trained sleep prediction model corresponding to the non-working day;
    获取所述用户在当日以及历史非工作日的行为数据,所述历史非工作日为当日之前相同类型的非工作日;Acquiring behavior data of the user on the current day and historical non-working days, where the historical non-working days are the same type of non-working days before the current day;
    根据所述行为数据以及所述睡眠预测模型对所述用户进行睡眠预测,得到预测结果。Perform sleep prediction on the user according to the behavior data and the sleep prediction model to obtain a prediction result.
  2. 根据权利要求1所述的睡眠预测方法,其中,所述识别当日是否为用户的非工作日,包括:The sleep prediction method according to claim 1, wherein said identifying whether the current day is a non-working day of the user comprises:
    获取所述用户在当日使用电子设备的第一使用信息;Acquiring the first use information of the electronic device used by the user on that day;
    获取预存的所述用户在其工作日使用电子设备的第二使用信息;Acquiring the pre-stored second usage information of the user's use of the electronic device on his workday;
    判断所述第一使用信息是否与所述第二使用信息匹配,是则判定当日为所述用户的工作日,否则判定当日为所述用户的非工作日。It is judged whether the first usage information matches the second usage information, if yes, it is judged that the current day is a working day of the user, otherwise it is judged that the current day is a non-working day of the user.
  3. 根据权利要求2所述的睡眠预测方法,其中,所述判断所述第一使用信息是否与所述第二使用信息匹配,包括:The sleep prediction method according to claim 2, wherein said determining whether said first usage information matches said second usage information comprises:
    获取所述第一使用信息与所述第二使用信息的相似度;Acquiring the similarity between the first usage information and the second usage information;
    判断所述相似度是否达到预设相似度,是则判定所述第一使用信息与所述第二使用信息匹配,否则不匹配。It is determined whether the similarity reaches a preset similarity, and if yes, it is determined that the first usage information matches the second usage information, otherwise it does not match.
  4. 根据权利要求1所述的睡眠预测方法,其中,所述睡眠预测条件包括:The sleep prediction method according to claim 1, wherein the sleep prediction condition comprises:
    处于熄屏状态的持续时长达到第一预设时长;The duration of the screen off state reaches the first preset duration;
    或者,处于静止状态的持续时长达到第二预设时长;Or, the duration of the static state reaches the second preset duration;
    或者,在处于熄屏状态的持续时长达到第三预设时长时处于静止状态;Or, stay in a static state when the duration of the screen off state reaches the third preset duration;
    或者,在处于静止状态的持续时长达到第四预设时长时处于熄屏状态。Or, the screen is turned off when the duration of the static state reaches the fourth preset duration.
  5. 根据权利要求1所述的睡眠预测方法,其中,所述预测结果包括预测的睡眠区间,所述根据所述行为数据以及所述睡眠预测模型进行睡眠预测,得到预测结果之后,还包括:The sleep prediction method according to claim 1, wherein the prediction result includes a predicted sleep interval, and the performing sleep prediction based on the behavior data and the sleep prediction model, and after obtaining the prediction result, further includes:
    根据所述预测的睡眠区间判断所述用户当前是否处于睡眠状态;Judging whether the user is currently in a sleep state according to the predicted sleep interval;
    若是,则执行预设操作,其中,所述预设操作包括系统更新操作、应用更 新操作以及功耗控制操作中的至少一种。If yes, perform a preset operation, where the preset operation includes at least one of a system update operation, an application update operation, and a power consumption control operation.
  6. 根据权利要求7所述的睡眠预测方法,其中,所述执行预设操作之前,还包括:The sleep prediction method according to claim 7, wherein before the performing the preset operation, further comprising:
    获取所述用户配置的作息计划;Obtaining the schedule configured by the user;
    根据所述作息计划获取所述用户计划的睡眠区间,并判断当前是否位于所述计划的睡眠区间之内;Acquire the sleep interval planned by the user according to the schedule, and determine whether it is currently within the planned sleep interval;
    若是,则执行所述预设操作。If yes, execute the preset operation.
  7. 根据权利要求1所述的睡眠预测方法,其中,所述行为数据包括运动行为数据、休息行为数据以及娱乐行为数据。The sleep prediction method according to claim 1, wherein the behavior data includes exercise behavior data, rest behavior data, and entertainment behavior data.
  8. 一种睡眠预测装置,应用于电子设备,其中,包括:A sleep prediction device applied to electronic equipment, including:
    日期识别模块,用于在当前满足预设的睡眠预测条件时,识别当日是否为用户的非工作日;The date identification module is used to identify whether the current day is a non-working day of the user when the preset sleep prediction conditions are currently met;
    模型获取模块,用于在识别模块的识别结果为是时,获取预先训练的对应非工作日的睡眠预测模型;The model acquisition module is used to acquire the pre-trained sleep prediction model corresponding to the non-working day when the recognition result of the recognition module is yes;
    数据获取模块,用于获取所述用户在当日以及历史非工作日的行为数据,所述历史非工作日为当日之前相同类型的非工作日;A data acquisition module for acquiring behavioral data of the user on the current day and historical non-working days, where the historical non-working days are the same type of non-working days before the current day;
    睡眠预测模块,用于根据所述行为数据以及所述睡眠预测模型对所述用户进行睡眠预测,得到预测结果。The sleep prediction module is configured to perform sleep prediction on the user according to the behavior data and the sleep prediction model to obtain a prediction result.
  9. 一种存储介质,其上存储有计算机程序,其中,当所述计算机程序在计算机上执行时,使得所述计算机执行如权利要求1至7中任一项所述的睡眠预测方法。A storage medium having a computer program stored thereon, wherein when the computer program is executed on a computer, the computer is caused to execute the sleep prediction method according to any one of claims 1 to 7.
  10. 一种电子设备,包括存储器,处理器,其中,所述处理器通过调用所述存储器中存储的计算机程序,用于执行如权利要求1至7中任一项所述的睡眠预测方法。An electronic device, comprising a memory and a processor, wherein the processor is configured to execute the sleep prediction method according to any one of claims 1 to 7 by calling a computer program stored in the memory.
PCT/CN2019/075342 2019-02-18 2019-02-18 Sleep prediction method and apparatus, storage medium, and electronic device WO2020168444A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/075342 WO2020168444A1 (en) 2019-02-18 2019-02-18 Sleep prediction method and apparatus, storage medium, and electronic device
CN201980074323.6A CN112997148A (en) 2019-02-18 2019-02-18 Sleep prediction method, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/075342 WO2020168444A1 (en) 2019-02-18 2019-02-18 Sleep prediction method and apparatus, storage medium, and electronic device

Publications (1)

Publication Number Publication Date
WO2020168444A1 true WO2020168444A1 (en) 2020-08-27

Family

ID=72143985

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/075342 WO2020168444A1 (en) 2019-02-18 2019-02-18 Sleep prediction method and apparatus, storage medium, and electronic device

Country Status (2)

Country Link
CN (1) CN112997148A (en)
WO (1) WO2020168444A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112704365A (en) * 2021-01-25 2021-04-27 深圳联达技术实业有限公司 Intelligent pillow and sleep monitoring method
CN115590477A (en) * 2022-11-16 2023-01-13 中国医学科学院药用植物研究所(Cn) Sleep staging method and device based on self-supervision, electronic equipment and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117061658A (en) * 2023-07-11 2023-11-14 荣耀终端有限公司 Sleep time identification method, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105929927A (en) * 2016-04-19 2016-09-07 乐视控股(北京)有限公司 Method and device for reducing power consumption of intelligent equipment
CN106125883A (en) * 2016-06-15 2016-11-16 乐视控股(北京)有限公司 Intelligent terminal and control method thereof
CN107329778A (en) * 2017-06-08 2017-11-07 广东欧珀移动通信有限公司 The method and Related product of system update
CN107430716A (en) * 2015-03-31 2017-12-01 微软技术许可有限责任公司 Infer user's sleep pattern

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140157026A1 (en) * 2012-12-05 2014-06-05 Advanced Micro Devices, Inc. Methods and apparatus for dynamically adjusting a power level of an electronic device
US9566031B2 (en) * 2013-01-30 2017-02-14 Kingsdown, Inc. Apparatuses and methods for measured sleep alarm signaling
JP6337972B2 (en) * 2014-10-31 2018-06-06 富士通株式会社 Status display method, program, and status display device
CN107567083B (en) * 2017-10-16 2021-07-30 北京小米移动软件有限公司 Method and device for performing power-saving optimization processing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107430716A (en) * 2015-03-31 2017-12-01 微软技术许可有限责任公司 Infer user's sleep pattern
CN105929927A (en) * 2016-04-19 2016-09-07 乐视控股(北京)有限公司 Method and device for reducing power consumption of intelligent equipment
CN106125883A (en) * 2016-06-15 2016-11-16 乐视控股(北京)有限公司 Intelligent terminal and control method thereof
CN107329778A (en) * 2017-06-08 2017-11-07 广东欧珀移动通信有限公司 The method and Related product of system update

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112704365A (en) * 2021-01-25 2021-04-27 深圳联达技术实业有限公司 Intelligent pillow and sleep monitoring method
CN115590477A (en) * 2022-11-16 2023-01-13 中国医学科学院药用植物研究所(Cn) Sleep staging method and device based on self-supervision, electronic equipment and storage medium
CN115590477B (en) * 2022-11-16 2023-03-28 中国医学科学院药用植物研究所 Sleep staging method and device based on self-supervision, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112997148A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN110619423B (en) Multitask prediction method and device, electronic equipment and storage medium
CN108764304B (en) Scene recognition method and device, storage medium and electronic equipment
US11551103B2 (en) Data-driven activity prediction
WO2020168448A1 (en) Sleep prediction method and apparatus, and storage medium and electronic device
US20190342182A1 (en) Systems and methods for managing lifecycle and reducing power consumption by learning an iot device
WO2020168444A1 (en) Sleep prediction method and apparatus, storage medium, and electronic device
WO2015088841A1 (en) Personalized machine learning models
US11249645B2 (en) Application management method, storage medium, and electronic apparatus
US20240029075A1 (en) Behavioral analysis for smart agents
KR102585230B1 (en) Device and method for providing notification message for call request
US11360927B1 (en) Architecture for predicting network access probability of data files accessible over a computer network
CN107943582B (en) Feature processing method, feature processing device, storage medium and electronic equipment
US20210349433A1 (en) System and method for modifying an initial policy of an input/output device
US11468886B2 (en) Artificial intelligence apparatus for performing voice control using voice extraction filter and method for the same
EP3758898A1 (en) Robot skill management
US20240129567A1 (en) Hub device, multi-device system including the hub device and plurality of devices, and operating method of the hub device and multi-device system
CN110544468A (en) Application awakening method and device, storage medium and electronic equipment
CN108806699B (en) Voice feedback method and device, storage medium and electronic equipment
WO2020168451A1 (en) Sleep prediction method and apparatus, storage medium, and electronic device
KR102573023B1 (en) sleep induction device
CN109242089B (en) Progressive supervised deep learning neural network training method, system, medium and device
JP2023544475A (en) Smart home bubble formation
US11290536B2 (en) Updating automated communication replies based on detected situations
CN107861769B (en) Application cleaning method and device, storage medium and electronic equipment
US11727085B2 (en) Device, method, and computer program for performing actions on IoT devices

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19915819

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18.10.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19915819

Country of ref document: EP

Kind code of ref document: A1