Smart home user behavior habit identification method, device, equipment and medium

By receiving sensor events and calculating time consistency and weekday consistency factors, and fusing them into a two-factor confidence score, the problem of time dispersion and weekday periodicity modeling in the recognition of smart home user behavior habits is solved, enabling more accurate and real-time behavior prediction and linkage control.

CN123179166APending Publication Date: 2026-11-27SHENZHEN HEIMAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611500138.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-24
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing smart home user behavior recognition technologies lack time discrete quantification, weekly periodic modeling, multi-factor fusion mechanisms, learning triggering mechanisms, and coupling with sensor events, resulting in insufficient recognition accuracy and real-time performance.

Method used

By receiving sensor events, classifying them into predefined habit categories, calculating time consistency and weekday consistency factors, fusing them into a two-factor confidence score, and combining the current time with historical average time, smart home linkage suggestions are generated.

Benefits of technology

It improves the accuracy, real-time performance, and reliability of smart home user behavior recognition, reduces the risk of false triggering, and enhances the system's learning efficiency and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123179166A_ABST
    Figure CN123179166A_ABST
Patent Text Reader

Abstract

The application discloses a smart home user behavior habit identification method, device, equipment and medium, the smart home user behavior habit identification method comprises: classifying received sensor events into predefined habit categories, and obtaining a two-factor confidence by time consistency factor and the week consistency factor weighted fusion to confirm a current period matching score, selecting the habit category with the maximum current period matching score as a prediction result, and generating a smart home linkage suggestion according to the prediction result. The application makes the prediction result depend on both the historical regularity of habits and the closeness of the current time to the historical average time, thereby improving the accuracy, real-time performance and reliability of smart home user behavior habit identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) technology, and in particular to a method, device, equipment, and medium for identifying smart home user behavior habits. Background Technology

[0002] In the field of smart home behavior habit recognition, existing technologies mainly achieve user habit learning through methods such as behavior frequency statistics, time distance calculation, or signal processing.

[0003] However, existing smart home technologies for recognizing user behavior habits have the following shortcomings: 1. Lack of quantitative measurement of time dispersion: Existing technologies typically use frequency (N / K) as a confidence index for habits, without considering the dispersion of the time points where the behavior occurs. For example, a user may have woken up on all 7 days of the week, with a frequency of 100%. However, if the wake-up times are at 5:00, 7:00, 9:00, 6:30, 8:15, 7:45, and 10:00, the time span is extremely large and does not actually constitute a stable habit. Frequency alone cannot distinguish between two fundamentally different behavioral patterns: regular but dispersed over time, and regular but concentrated over time. Although some existing technologies introduce a recent time distance factor, this factor only reflects the time interval from the most recent behavior and also cannot measure the overall dispersion of the historical behavior time series.

[0004] 2. Lack of modeling of weekly cycle patterns: Human behavior has significant weekly cycle patterns (such as waking up early on weekdays and waking up late on weekends). The lack of weekly cycle modeling makes it impossible for the system to distinguish between behavioral patterns that occur every day and those that only occur on weekdays, thus limiting the accuracy of prediction. 3. The confidence score calculation model is simplistic and lacks a multi-factor fusion mechanism. The regularity of actual user behavior is influenced by both temporal consistency and weekly cycle, and a single dimension cannot fully characterize the stability of behavioral habits. The lack of a multi-factor weighted fusion mechanism makes the confidence score assessment inaccurate, directly affecting the reliability of subsequent behavior prediction and intelligent linkage control.

[0005] 4. Lack of a universal smart home habit classification system. Existing technologies have not defined a standardized habit classification system. Different manufacturers and different scenarios need to redesign the behavior classification logic, resulting in insufficient universality and scalability.

[0006] 5. The learning trigger mechanism is not sufficiently coupled with sensor events. Existing technologies mostly use timed polling or fixed-cycle triggering for learning updates, which is disconnected from actual user behavior events. Timed triggering may result in invalid analysis when the user is inactive, and may also miss the learning window when user behavior occurs because the polling cycle has not yet expired, making it difficult to balance learning efficiency and real-time performance.

[0007] Therefore, there is an urgent need for a new method to identify the behavioral habits of smart home users. Summary of the Invention

[0008] In view of the above problems, the present invention is proposed to provide a method, apparatus, device and medium for identifying smart home user behavior habits that overcomes or at least partially solves the above problems.

[0009] Other features and advantages of the invention will become apparent from the following detailed description, or may be learned in part by practice of the invention.

[0010] According to a first aspect of the present invention, a method for recognizing smart home user behavior habits is provided, comprising: S1. Receive sensor events in the smart home environment, classify the sensor events into predefined habit categories, and record the time and week of the behavior based on the habit categories to obtain a list of time points and a list of week days; S2. When the number of samples in the time point list reaches a preset trigger threshold, calculate the time standard deviation based on the time point list, obtain the time consistency factor based on the time standard deviation, obtain the week consistency factor based on the deduplicated set of the week days in the week list, and weight and fuse the time consistency factor and the week consistency factor to obtain the two-factor confidence score. S3. Calculate the historical average time based on the time point list, and calculate the matching score for the current time period based on the absolute difference between the current time and the historical average time and the two-factor confidence score. Select the habit category with the largest matching score for the current time period as the prediction result. S4. When the matching score for the current time period reaches the linkage recommendation threshold, generate smart home linkage suggestions based on the prediction results.

[0011] In some embodiments of the present invention, step S1, obtaining the time point list and the weekday list, includes: Receive sensor events pushed by the sensor event source and append the sensor events to the event history cache; Extract the user identifier, event type, and timestamp from the sensor events; The event type is matched with preset keywords using an event type mapping table to classify the sensor events into predefined habit categories. Based on the user identifier, obtain or create a user profile data class, and in the user profile data class, find or create a habit pattern data structure corresponding to the habit category; The time point of the behavior obtained based on the timestamp is appended to the time point table entry of the habit pattern data structure to obtain the time point list, and the weekday obtained based on the timestamp is appended to the weekday table entry of the habit pattern data structure to obtain the weekday list.

[0012] In some embodiments of the present invention, step S2, which involves calculating the time standard deviation based on the list of time points and obtaining the time consistency factor based on the time standard deviation, includes: Sort the list of time points and calculate the historical average time of the sorted list of time points; The variance is obtained by dividing the sum of squares of the differences between each time point and the historical mean time by the number of samples, and then taking the square root of the variance to obtain the time standard deviation σ. Calculate the time consistency factor C_time, C_time=max(0, 1-σ / σ_max), where σ_max is the time standard deviation threshold, and C_time∈[0,1].

[0013] In some embodiments of the present invention, step S2, obtaining the week consistency factor based on the week deduplication set of the week list, includes: Perform a deduplication operation on the weekday list to obtain a deduplicated weekday set |W_set|; Calculate the weekday consistency factor C_day, C_day=|W_set| / 7, C_day∈[0,1].

[0014] In some embodiments of the present invention, step S2, which involves weighted fusion of the time consistency factor and the weekday consistency factor to obtain a two-factor confidence score, includes: When the number of samples is less than the minimum valid number of samples n_valid, the two-factor confidence score is set to 0; When the number of samples is greater than or equal to the preset trigger threshold, the two-factor confidence score C is calculated, C=α×C_time+β×C_day, where α is the time consistency weight, β is the weekday consistency weight, and α+β=1.

[0015] In some embodiments of the present invention, step S3, which involves calculating the matching score for the current time period and selecting the habit category with the highest matching score for the current time period as the prediction result, includes: Iterate through each of the aforementioned habit pattern data structures in the user profile data class; Read the two-factor confidence score C corresponding to the current habit pattern data structure. If the two-factor confidence score C < the lower limit threshold C_min of the prediction confidence score, then skip the habit pattern data structure. Read the historical average time corresponding to the current habitual pattern data structure, and calculate the absolute difference Δt between the current time t_now and the historical average time; If the absolute difference Δt over the historical mean time is greater than or equal to the prediction matching window Δt_max, then skip the habitual pattern data structure. If the two-factor confidence score C ≥ the lower limit of the prediction confidence score C_min, and the absolute difference Δt of the historical mean time < the prediction matching window Δt_max, then calculate the matching score for the current time period S = (1-Δt / 60) × C; The habit category with the highest matching score S in the current time period is selected as the prediction result. The prediction result includes the best matching habit category, the matching score in the current time period, and the historical average time.

[0016] In some embodiments of the present invention, step S4, wherein generating smart home linkage suggestions based on the prediction results when the matching score for the current time period reaches the linkage recommendation threshold, includes: When the current time period matching score S ≥ the linkage recommendation threshold, the corresponding smart home linkage suggestion is generated based on the best matching habit category in the prediction result. The smart home linkage suggestion includes at least one of the following: preparing a comfortable environment when expecting to return home, adjusting the bedroom environment when expecting to go to sleep, and checking the safety status when expecting to leave home. When the matching score S for the current time period is less than the linkage recommendation threshold, the prediction result is recorded and the smart home linkage suggestion is not generated.

[0017] According to a second aspect of the present invention, a smart home user behavior habit recognition device is provided, the device comprising: The data acquisition module is used to receive sensor events in the smart home environment, classify the sensor events into predefined habit categories, and record the time and week of the behavior based on the habit categories to obtain a list of time points and a list of week days. The confidence calculation module is used to calculate the time standard deviation based on the time point list when the number of samples in the time point list reaches a preset trigger threshold, and obtain the time consistency factor based on the time standard deviation. It also obtains the week consistency factor based on the deduplicated set of the week days in the week list, and weights and fuses the time consistency factor and the week consistency factor to obtain the two-factor confidence score. The prediction result generation module is used to calculate the historical average time based on the time point list, and calculate the matching score of the current time period based on the absolute difference between the current time and the historical average time period and the two-factor confidence score, and select the habit category with the largest matching score of the current time period as the prediction result. The device linkage suggestion generation module is used to generate smart home linkage suggestions based on the prediction results when the matching score of the current time period reaches the linkage recommendation threshold.

[0018] According to a third aspect of the present invention, a computer device is provided, including a processor and a memory, the memory storing computer program instructions executable by the processor, wherein when the processor executes the computer program instructions, it implements the instructions as described in any of the above methods.

[0019] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein computer program instructions are stored therein, the computer program instructions being loaded and executed by a processor to perform the operations performed by the method described in any of the preceding claims.

[0020] The technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages: This invention provides a method, apparatus, device, and medium for identifying smart home user behavior habits. The method categorizes received sensor events into predefined habit categories and obtains a two-factor confidence score through weighted fusion of a time consistency factor and a weekday consistency factor to confirm the matching score for the current time period. It then selects the habit category with the highest matching score for the current time period as the prediction result and generates smart home linkage suggestions based on the prediction result. This improves the accuracy, real-time performance, and reliability of smart home user behavior habit identification by relying on both the historical regularity of habits and the proximity of the current time to the historical average time.

[0021] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart illustrating a smart home user behavior habit recognition method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the principle structure of a smart home user behavior habit recognition device provided in an embodiment of the present invention; Figure 3 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0024] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings.

[0025] The accompanying drawings illustrate various structural schematics according to embodiments of this application. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.

[0026] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. In the context of this application, similar or identical parts may be represented by the same or similar reference numerals.

[0027] To better understand the above technical solutions, the following will describe the above technical solutions in detail with reference to specific implementation methods. It should be understood that the embodiments of this application and the specific features in the embodiments are detailed descriptions of the technical solutions of the present invention, rather than limitations on the technical solutions of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0028] Figure 1 This is a flowchart illustrating a smart home user behavior habit recognition method provided in an embodiment of the present invention, as shown below. Figure 1 As shown, the smart home user behavior habit recognition method includes the following steps: S1. Receive sensor events in the smart home environment, classify the sensor events into predefined habit categories, and record the time and week of the behavior based on the habit categories to obtain a list of time points and a list of week days; In step S1, the time point list and weekday list obtained in this embodiment of the invention include: The system receives sensor events pushed by sensor event sources and appends these events to the event history cache. These sensor events include, for example, door magnetic switch events (door_open / door_close), human infrared sensing events (motion_detected), smart switch events, and custom behavior events (wake_up / sleep / leave_home / return_home). The event history cache uses a sliding window mechanism, with a maximum capacity of, for example, 1000 entries. If this capacity is exceeded, only the 1000 most recent sensor events are retained to prevent unlimited memory usage. The system receives sensor events and dynamically triggers behavior learning based on their arrival. In this embodiment, the habitual pattern data structure is updated in real-time during the event processing flow, without relying on fixed timer polling. This ensures that the learning window is synchronized with the user's actual behavior, avoiding invalid calculations and learning delays, while also reducing system resource consumption.

[0029] Extract user identifier, event type, and timestamp from the sensor events; each sensor event contains user identifier (user_id), event type (type), and timestamp (timestamp) fields. The event type is used for the classification of subsequent sensor events, the timestamp is used to extract the time (minutes) and weekday (Monday to Sunday) of the behavior, and the user identifier is used to associate with the user profile data class of a specific user.

[0030] The event type mapping table `event_map` is used to perform substring matching between the event type and preset keywords to classify the sensor events into predefined habit categories. The `event_map` defines the substring matching mapping from event type keywords to habit categories. The mapping rule uses substring matching. The event classification function `_classify_event()` is called to match the event type string `type` with the preset `event_map` based on preset keywords (e.g., checking if `type` contains keywords such as `wake`, `sleep`, `leave`, `return`, `door`, etc.). If a match is successful, the corresponding `HabitCategory` enumeration value (e.g., `WAKING_UP`) is returned. If all keywords do not match, the processing ends. Habit categories include, for example, `WAKING_UP` (wake up), `SLEEPING` (sleep), `LEAVING_HOME` (leave home), `RETURNING_HOME` (return home), `EATING` (eat), and `WORKING` (work). Work, LEISURE, and EXERCISING; for example: when the event type contains the keyword wake, it matches the WAKING_UP category; when it contains the keyword sleep, it matches the SLEEPING category; when it contains the keywords leave or door_open, it matches the LEAVING_HOME category; when it contains the keywords return or door_close, it matches the RETURNING_HOME category, etc.

[0031] User profile data classes are obtained or created based on the user identifier. A habit pattern data structure corresponding to the habit category is searched or created within the user profile data class. If the user is appearing for the first time and no user profile data class exists, a new user profile data class is automatically created, and a habit pattern data structure corresponding to the habit category is searched within the user profile data class. If no habit pattern data structure corresponding to the habit category exists in the user profile data class (this is the first time such behavior is observed), a new habit pattern data structure corresponding to the habit category is created. The user profile data class is persisted, for example, in JSON file format. The user profile data class includes a list of time points, a list of days of the week, a two-factor confidence score, and a recent update timestamp for each habit category.

[0032] The time point of the behavior obtained based on the timestamp is appended to the time point table entry of the habit pattern data structure to obtain the time point list, and the weekday obtained based on the timestamp is appended to the weekday table entry of the habit pattern data structure to obtain the weekday list; the time point of the behavior is obtained by multiplying the number of hours in the timestamp by 60 and adding the number of minutes, and the time point of the behavior is appended to the end of the time point table entry list; the weekday is extracted from the date portion of the timestamp (0=Monday to 6=Sunday), and the weekday is appended to the end of the weekday table entry list.

[0033] S2. When the number of samples in the time point list reaches a preset trigger threshold, calculate the time standard deviation based on the time point list, obtain the time consistency factor based on the time standard deviation, obtain the week consistency factor based on the deduplicated set of the week days in the week list, and weight and fuse the time consistency factor and the week consistency factor to obtain the two-factor confidence score. In step S2, the embodiment of the present invention calculates the time standard deviation based on the time point list and obtains the time consistency factor based on the time standard deviation, including: Sort the list of time points and calculate the historical mean time of the sorted list of time points; sort the time points in the list of time points in ascending order (from smallest to largest), and calculate the average of all sorted time points to obtain the historical mean time. The historical mean time represents the approximate time when the behavior occurred. For example, the historical mean time of 425 means approximately 7:05. The variance is obtained by dividing the sum of squares of the differences between each time point and the historical mean time by the number of samples, and then taking the square root of the variance to obtain the time standard deviation σ. Calculate the time consistency factor C_time, C_time=max(0, 1-σ / σ_max), where σ_max is the time standard deviation threshold, C_time∈[0,1]; determine whether the time standard deviation σ is greater than or equal to the system's preset time standard deviation threshold σ_max (e.g., 120 minutes): if σ≥120 (the behavior time is extremely dispersed, such as distributed between 5:00 and 11:00), then C_time is directly set to 0.0, indicating that the behavior does not have regularity in the time dimension; if σ<120, then C_time=1-σ / 120, for example, when σ=47.2 minutes, C_time=1-47.2 / 120=0.607, indicating that the time regularity is about 60.7%.

[0034] In step S2, the embodiment of the present invention obtains the week consistency factor based on the week deduplication set of the week list by performing a deduplication operation on the week list to obtain the week deduplication set |W_set|, where the week deduplication set |W_set| is the number of different days of the week actually observed. This set only contains the numbers of the different days of the week actually observed (e.g., {0,1,2,3,4,5,6} indicates that the behavior occurs every day, and {0,1,2,3,4} indicates that the behavior occurs only from Monday to Friday); calculate the week consistency factor C_day, C_day=|W_set| / 7, C_day∈[0,1], that is, the week consistency factor C_day is the number of elements in the set W_set (i.e., the number of different days of the week actually observed) divided by 7 (the total number of days in a week). For example, when 7 different days of the week are observed, C_day=7 / 7=1.0, and when only 5 days are observed, C_day=5 / 7≈0.714.

[0035] In step S2, this embodiment of the invention weightedly fuses the time consistency factor and the weekday consistency factor to obtain a two-factor confidence score, including: When the number of samples is less than the minimum valid number of samples n_valid, the two-factor confidence level is set to 0; the minimum valid number of samples n_valid is, for example, 3. When the number of samples n<3, it can be considered that the data is insufficient to evaluate the regularity, and the two-factor confidence level is directly set to 0. When the number of samples is greater than or equal to the preset trigger threshold, the two-factor confidence score C is calculated, C=α×C_time+β×C_day, where α is the time consistency weight (e.g., 0.7), β is the weekday consistency weight (e.g., 0.3), α+β=1, and the two-factor confidence score is rounded to two decimal places.

[0036] In this embodiment of the invention, when the number of samples is greater than the minimum valid number of samples n_valid and less than the preset trigger threshold, for example, when the number of samples n is between 3 and 6, in order to ensure statistical validity and not trigger the calculation of the two-factor confidence score, this embodiment of the invention only updates the most recently updated timestamp field of the habitual pattern data structure and then performs persistent storage.

[0037] S3. Calculate the historical average time based on the time point list, and calculate the matching score for the current time period based on the absolute difference between the current time and the historical average time and the two-factor confidence score. Select the habit category with the largest matching score for the current time period as the prediction result. In step S3, this embodiment of the invention calculates the matching score for the current time period and selects the habit category with the highest matching score for the current time period as the prediction result, including: Iterate through each of the aforementioned habit pattern data structures in the user profile data class; Read the two-factor confidence score C corresponding to the current habitual pattern data structure. If the two-factor confidence score C < the lower limit threshold C_min, skip the habitual pattern data structure. The lower limit threshold C_min is, for example, 0.5. If C < 0.5, it means that the current habitual pattern data structure has insufficient regularity. Skip the habitual pattern data structure and continue to read the next habitual pattern data structure. If C ≥ 0.5, continue to execute the subsequent steps.

[0038] Read the historical average time corresponding to the current habit pattern data structure, and calculate the absolute difference Δt between the current time t_now and the historical average time. Δt = |t_now - mean|. For example, if the current time t_now is 7:00 (420 minutes), and the historical average time corresponding to the wake-up habit is about 7:33 (453 minutes), then Δt = |420 - 453| = 33 minutes.

[0039] If the absolute difference Δt of the historical mean time is greater than or equal to the prediction matching window Δt_max, then skip the habitual pattern data structure; the prediction matching window Δt_max is, for example, 60 minutes. If Δt ≥ 60, it means that the current time is too far from the usual time of the habit, skip the habitual pattern data structure and continue to read the next habitual pattern data structure. If Δt < 60, then continue to execute the subsequent steps.

[0040] If the two-factor confidence score C ≥ the lower limit of the prediction confidence score C_min, and the absolute difference of the historical mean time Δt < the prediction matching window Δt_max, then the matching score for the current time period is calculated as S = (1 - Δt / 60) × C. That is, the closer to the usual time (the smaller Δt), the higher the matching score S for the current time period. When Δt = 0 (exactly hitting the historical mean), S = C. When Δt is close to 60 (close to the edge of the window), S approaches 0.

[0041] Continue to compare the current matching score S with the recorded current highest score best_score. If S≤best_score, skip the habit pattern data structure and continue reading the next habit pattern data structure. If S > best_score, it means that the current habit category is the best match so far. In this case, the habit category with the highest matching score S in the current time period is selected as the prediction result, and the recorded highest score best_score is updated to the value of the matching score S in the current time period.

[0042] Check if all habit pattern data structures have been traversed. If there are still unprocessed habit pattern data structures, continue to execute the previous step of calculating the matching score for the current time period until all habit pattern data structures have been traversed, and output the final prediction result. The prediction result includes the best matching habit category (e.g., returning home), the matching score for the current time period (e.g., 0.71), and the historical average time (e.g., 1091 minutes ≈ 18:11).

[0043] If no custom pattern data structure satisfies C≥0.5 and Δt<60, then return no prediction result.

[0044] S4. When the matching score for the current time period reaches the linkage recommendation threshold, generate smart home linkage suggestions based on the prediction results.

[0045] In step S4, in this embodiment of the invention, when the matching score for the current time period reaches the linkage recommendation threshold, generating smart home linkage suggestions based on the prediction results includes: When the matching score S for the current time period is greater than or equal to the linkage recommendation threshold, a corresponding smart home linkage suggestion is generated based on the best-matching habit category in the prediction results. The smart home linkage suggestion includes at least one of the following: preparing a comfortable environment when expecting to return home, adjusting the bedroom environment when expecting to go to sleep, and checking the safety status when expecting to leave home. The linkage recommendation threshold is, for example, 0.7. When the matching score S for the current time period is greater than or equal to 0.7, this embodiment of the invention calls the suggest_action() function to generate a corresponding smart home device control suggestion and automatically executes the smart home device control suggestion or notifies the user to confirm the smart home device control suggestion. When the matching score S for the current time period is less than the linkage recommendation threshold, the prediction result is recorded and no smart home linkage suggestion is generated.

[0046] The smart home user behavior habit recognition method described in this embodiment of the invention has the following advantages compared with the prior art: 1. This invention classifies received sensor events into predefined habit categories and obtains a two-factor confidence score by weighted fusion of a time consistency factor and a weekday consistency factor to confirm the matching score for the current time period. The habit category with the highest matching score for the current time period is selected as the prediction result, and smart home linkage suggestions are generated based on the prediction result. Thus, the prediction result depends on both the historical regularity of habits and the proximity of the current time to the historical average time, thereby improving the accuracy, real-time performance, and reliability of smart home user behavior habit recognition.

[0047] 2. Sensor events are appended to the event history cache, and the event history cache uses a sliding window mechanism to limit its maximum capacity. This controls memory usage while retaining recent behavioral data, preventing the event history cache from growing indefinitely and providing a stable data foundation for subsequent habit updates and predictions.

[0048] 3. Calculate the time standard deviation based on the time point list, and obtain the time consistency factor from the time standard deviation. This can directly quantify the overall dispersion of the behavioral time series, thereby distinguishing between stable habits with concentrated time and pseudo-habits with high frequency but dispersed time.

[0049] 4. Based on the deduplication set of the weekday list, the weekday consistency factor is obtained, which can be integrated to obtain the weekday periodicity of the behavior and accurately distinguish different patterns such as daily occurrence, occurrence only on weekdays, and occurrence only on weekends.

[0050] 5. The generation of smart home linkage suggestions is controlled by a linkage recommendation threshold. Linkage is only triggered when the matching score in the current time period reaches the linkage recommendation threshold, thereby reducing the risk of false triggering.

[0051] Based on the above embodiments, as a supplement to the above... Figure 1 The present invention provides an embodiment of a smart home user behavior habit recognition device, which is similar to the method shown. Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices, see reference. Figure 2 As shown, the smart home user behavior habit recognition device includes: The data acquisition module 100 is used to receive sensor events in the smart home environment, classify the sensor events into predefined habit categories, and record the time and week of the behavior based on the habit categories to obtain a list of time points and a list of week days. The confidence calculation module 200 is used to calculate the time standard deviation based on the time point list when the number of samples in the time point list reaches a preset trigger threshold, obtain the time consistency factor based on the time standard deviation, obtain the week consistency factor based on the deduplicated set of the week days in the week list, and weight and fuse the time consistency factor and the week consistency factor to obtain a two-factor confidence score. The prediction result generation module 300 is used to calculate the historical average time based on the time point list, and calculate the matching score of the current time period based on the absolute difference between the current time and the historical average time period and the two-factor confidence score, and select the habit category with the largest matching score of the current time period as the prediction result. The device linkage suggestion generation module 400 is used to generate smart home linkage suggestions based on the prediction results when the matching score of the current time period reaches the linkage recommendation threshold.

[0052] The modules in the aforementioned smart home user behavior habit recognition device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0053] The smart home user behavior habit recognition device described in this embodiment can execute the smart home user behavior habit recognition method provided in the above embodiment. The smart home user behavior habit recognition device has the corresponding functional steps and beneficial effects of the smart home user behavior habit recognition method described in the above embodiment. For details, please refer to the embodiments of the smart home user behavior habit recognition method described above. The embodiments of this invention will not be repeated here.

[0054] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface, such as a network interface card, is used for wired or wireless communication with external terminals. Wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. The display unit is used to create a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0055] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0056] In one exemplary embodiment, a chip is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method in any of the above embodiments.

[0057] In one exemplary embodiment, a network interface card is provided, including a chip as described in any of the above embodiments and multiple interfaces, wherein the chip communicates externally through the interfaces.

[0058] In one embodiment, a computer device is also provided, including a processor, a chip in any of the above embodiments, or a network interface card in any of the above embodiments, wherein the chip or the network interface card is used to schedule packets to the processor or the chip or the network interface card itself for processing, and the processor is used to process the packets scheduled by the chip or the network interface card.

[0059] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0060] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0061] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (Read-Only Memory). Only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application may include at least one of relational databases and non-relational databases. Non-relational databases may include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited thereto.

[0062] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0063] Similarly, it should be understood that, for the purpose of simplification and aiding understanding of one or more aspects of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the description of exemplary embodiments of the invention above. Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and it should be noted that the above embodiments are illustrative of the invention and not restrictive, and that alternative embodiments can be devised by those skilled in the art without departing from its scope.

Claims

1. A method for recognizing user behavior habits in smart homes, characterized in that, include: S1. Receive sensor events in the smart home environment, classify the sensor events into predefined habit categories, and record the time and week of the behavior based on the habit categories to obtain a list of time points and a list of week days; S2. When the number of samples in the time point list reaches a preset trigger threshold, calculate the time standard deviation based on the time point list, obtain the time consistency factor based on the time standard deviation, obtain the week consistency factor based on the deduplicated set of the week days in the week list, and weight and fuse the time consistency factor and the week consistency factor to obtain the two-factor confidence score. S3. Calculate the historical average time based on the time point list, and calculate the matching score for the current time period based on the absolute difference between the current time and the historical average time and the two-factor confidence score. Select the habit category with the largest matching score for the current time period as the prediction result. S4. When the matching score for the current time period reaches the linkage recommendation threshold, generate smart home linkage suggestions based on the prediction results.

2. The smart home user behavior habit recognition method according to claim 1, characterized in that, In step S1, obtaining the list of time points and the list of days of the week includes: Receive sensor events pushed by the sensor event source and append the sensor events to the event history cache; Extract the user identifier, event type, and timestamp from the sensor events; The event type is matched with preset keywords using an event type mapping table to classify the sensor events into predefined habit categories. Based on the user identifier, obtain or create a user profile data class, and in the user profile data class, find or create a habit pattern data structure corresponding to the habit category; The time point of the behavior obtained based on the timestamp is appended to the time point table entry of the habit pattern data structure to obtain the time point list, and the weekday obtained based on the timestamp is appended to the weekday table entry of the habit pattern data structure to obtain the weekday list.

3. The smart home user behavior habit recognition method according to claim 2, characterized in that, In step S2, calculating the time standard deviation based on the list of time points and obtaining the time consistency factor based on the time standard deviation includes: Sort the list of time points and calculate the historical average time of the sorted list of time points; The variance is obtained by dividing the sum of squares of the differences between each time point and the historical mean time by the number of samples, and then taking the square root of the variance to obtain the time standard deviation σ. Calculate the time consistency factor C_time, C_time=max(0, 1-σ / σ_max), where σ_max is the time standard deviation threshold, and C_time∈[0,1].

4. The smart home user behavior habit recognition method according to claim 3, characterized in that, In step S2, obtaining the week consistency factor based on the deduplicated week set of the week list includes: Perform a deduplication operation on the weekday list to obtain a deduplicated weekday set |W_set|; Calculate the weekday consistency factor C_day, C_day=|W_set| / 7, C_day∈[0,1].

5. The smart home user behavior habit recognition method according to claim 4, characterized in that, In step S2, the weighted fusion of the time consistency factor and the weekday consistency factor to obtain the two-factor confidence score includes: When the number of samples is less than the minimum valid number of samples n_valid, the two-factor confidence score is set to 0; When the number of samples is greater than or equal to the preset trigger threshold, the two-factor confidence score C is calculated, C=α×C_time+β×C_day, where α is the time consistency weight, β is the weekday consistency weight, and α+β=1.

6. The smart home user behavior habit recognition method according to claim 4, characterized in that, In step S3, calculating the matching score for the current time period and selecting the habit category with the highest matching score for the current time period as the prediction result includes: Iterate through each of the aforementioned habit pattern data structures in the user profile data class; Read the two-factor confidence score C corresponding to the current habit pattern data structure. If the two-factor confidence score C < the lower limit threshold C_min of the prediction confidence score, then skip the habit pattern data structure. Read the historical average time corresponding to the current habitual pattern data structure, and calculate the absolute difference Δt between the current time t_now and the historical average time; If the absolute difference Δt over the historical mean time is greater than or equal to the prediction matching window Δt_max, then skip the habitual pattern data structure. If the two-factor confidence score C ≥ the lower limit of the prediction confidence score C_min, and the absolute difference Δt of the historical mean time < the prediction matching window Δt_max, then calculate the matching score for the current time period S = (1-Δt / 60) × C; The habit category with the highest matching score S in the current time period is selected as the prediction result. The prediction result includes the best matching habit category, the matching score in the current time period, and the historical average time.

7. The smart home user behavior habit recognition method according to claim 6, characterized in that, In step S4, generating smart home linkage suggestions based on the prediction results when the matching score for the current time period reaches the linkage recommendation threshold includes: When the current time period matching score S ≥ the linkage recommendation threshold, the corresponding smart home linkage suggestion is generated based on the best matching habit category in the prediction result. The smart home linkage suggestion includes at least one of the following: preparing a comfortable environment when expecting to return home, adjusting the bedroom environment when expecting to go to sleep, and checking the safety status when expecting to leave home. When the matching score S for the current time period is less than the linkage recommendation threshold, the prediction result is recorded and the smart home linkage suggestion is not generated.

8. A smart home user behavior habit recognition device, applied to the method described in any one of claims 1-7, characterized in that, The device includes: The data acquisition module is used to receive sensor events in the smart home environment, classify the sensor events into predefined habit categories, and record the time and week of the behavior based on the habit categories to obtain a list of time points and a list of week days. The confidence calculation module is used to calculate the time standard deviation based on the time point list when the number of samples in the time point list reaches a preset trigger threshold, and obtain the time consistency factor based on the time standard deviation. It also obtains the week consistency factor based on the deduplicated set of the week days in the week list, and weights and fuses the time consistency factor and the week consistency factor to obtain the two-factor confidence score. The prediction result generation module is used to calculate the historical average time based on the time point list, and calculate the matching score of the current time period based on the absolute difference between the current time and the historical average time period and the two-factor confidence score, and select the habit category with the largest matching score of the current time period as the prediction result. The device linkage suggestion generation module is used to generate smart home linkage suggestions based on the prediction results when the matching score of the current time period reaches the linkage recommendation threshold.

9. A computer device comprising a processor and a memory, characterized in that, The memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, it implements the instructions of the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that are loaded and executed by a processor to perform the operations described in any one of claims 1-7.