User classification method and device based on machine learning, equipment and medium
Through a machine learning-based user classification method, using historical water data and feature extraction models, user pairs are generated to determine categories, which solves the problem of insufficient classification and manual dependence in the prior art, and achieves high-precision and high-efficiency user classification.
Patent Information
- Application Number
- CN202411740534.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the classification of water users relies on manual processing based on registration information, resulting in the classification being insufficiently detailed, low accuracy, and requires a lot of manpower, and classification update and maintenance also requires manual intervention.
Using a machine learning-based user classification method, the user pair is generated to determine its category by obtaining the historical water use data of water users, extracting water characteristics, and inputting them into the pre-trained user pair generation model.
It realizes fine and accurate classification of water users, reduces manual intervention, saves a lot of manpower, and can update user classification in a timely manner.
Smart Images

Figure CN119513668A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart city water management, and in particular to a user classification method, device, equipment and medium based on machine learning. Background Art
[0002] In the water management of smart cities, in order to formulate targeted management plans or provide personalized services for different categories of water users, it is necessary to classify water users in the city.
[0003] In the prior art, when a water user opens a water meter, the user's address (which area of the city the user is located in, which water plant supplies the water), water use type (civilian, commercial, industrial), water demand (how many people in the household use water, etc.) and other information are usually registered, and the water users are manually classified based on the registered information.
[0004] Then, manual classification is performed through registration information. The registered information is relatively rough and cannot be combined with the actual water usage of water users. It is difficult to classify water users accurately. Manual classification requires a lot of manpower, and when the registration information of water users is updated, the classification of water users needs to be manually maintained and updated. Summary of the invention
[0005] The present invention provides a user classification method, device, equipment and medium based on machine learning to solve the problem that manual classification of water users based on information registered by water users is not fine enough, has low accuracy and requires a lot of manpower.
[0006] In a first aspect, the present invention provides a user classification method based on machine learning, comprising:
[0007] Obtain historical water use data of water users to be classified;
[0008] Inputting the historical water use data into a water use feature extraction model to obtain water use features of the water users to be classified;
[0009] Inputting the water use characteristics into a pre-trained user pair generation model to obtain a user pair, wherein the user pair includes the water user to be classified and a classified water user;
[0010] The category of the classified water users is determined as the category of the water users to be classified.
[0011] Optionally, obtain historical water consumption data of the water users to be classified, including:
[0012] The historical water consumption time series data of the water users to be classified within a preset historical time period is obtained.
[0013] Optionally, the historical water use data is input into a water use feature extraction model to obtain the water use features of the water users to be classified, including:
[0014] Inputting the historical water use time series data into the water use feature extraction model;
[0015] In the water use feature extraction model, the historical water use time series data is used to extract the daily maximum water use, daily average water use, water use peak time period, water use low-peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, and monthly water cost of the water user to be classified as water use features.
[0016] Optionally, the water usage feature extraction model is trained in the following manner:
[0017] Obtain a water use time series data set, wherein the water use time series data set includes water use time series data samples and annotated daily maximum water use, daily average water use, water use peak time period, water use low peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, monthly maximum water fee, and monthly average water fee;
[0018] Constructing a water use feature extraction model and initializing model parameters of the water use feature extraction model;
[0019] Extracting water use time series data samples from the water use time series data set and inputting them into the water use feature extraction model, predicting the maximum daily water use, average daily water use, peak water use time period, low water use time period, daily water use frequency, monthly water use billing gradient data, the longest duration of daily water use, the maximum monthly water use, the average monthly water use, the maximum monthly water fee, and the average monthly water fee in the water use feature extraction model;
[0020] The loss rate is calculated using the marked and predicted daily maximum water consumption, daily average water consumption, water consumption peak time period, water consumption low peak time period, daily water use frequency, monthly water billing gradient data, the longest duration of daily water use, monthly maximum water consumption, monthly average water consumption, monthly maximum water fee, and monthly average water fee;
[0021] Determine whether the training stop condition is met;
[0022] If so, determining that the water use feature extraction model has completed training;
[0023] If not, the model parameters of the water use feature extraction model are adjusted according to the loss rate, and the process returns to the step of extracting water use time series data samples from the water use time series data set and inputting them into the water use feature extraction model.
[0024] Optionally, the user pair generation model is provided with a feature library, the feature library includes water use features of classified water users, the user pair generation model includes a feature matching network and a user pair generation network, and the step of inputting the water use features into a pre-trained user pair generation model to obtain user pairs includes:
[0025] Inputting the water use characteristics of the water users to be classified into a feature matching network;
[0026] In the feature matching network, the water use characteristics of the water user to be classified are matched with the water use characteristics of the classified water users in the feature library to obtain the similarity between the water user to be classified and each classified water user;
[0027] The similarity is input into the user pair generation network, and a user pair is generated in the user pair generation network using the classified water user with the greatest similarity and the water user to be classified.
[0028] Optionally, the user trains the generated model in the following manner:
[0029] Construct a feature database of classified water users;
[0030] Acquire a sample user data set, where the sample user data set includes a first water use characteristic of the sample user and a marked category of the sample user;
[0031] Constructing the user pair generation model, wherein the user pair generation model includes a feature matching network and a user pair generation network, and the feature matching network includes a plurality of feature matching sub-networks;
[0032] Extracting first water use characteristics of a batch of multiple sample users from the sample user data set and inputting them into the user pair generation model;
[0033] Calculating the similarity between the water use characteristics of the corresponding dimension in the first water use characteristics and the water use characteristics of the corresponding dimension of the same classified water user in the feature library in multiple feature matching subnetworks, and taking a weighted sum as the similarity;
[0034] In the user pair generation network, the classified water users with the greatest similarity and the sample users are used to generate user pairs;
[0035] Calculate the loss rate by using the marked categories of the sample users in the plurality of user pairs and the categories of the classified water users;
[0036] Determine whether the training stop condition is met;
[0037] If so, determining that the user has completed training of the generated model;
[0038] If not, adjust the model parameters of the user pair generation model according to the loss rate, and return to the step of extracting a batch of first water use characteristics of multiple sample users from the sample user data set and inputting them into the user pair generation model to obtain a user pair for each sample user.
[0039] Optionally, the loss rate is calculated by using the marked categories of the sample users in the plurality of user pairs and the categories of the classified water users, including
[0040] The predicted value for each user pair, wherein if the labeled category of the sample user is the same as the category of the classified water user, the predicted value is 1, and if the labeled category of the sample user is different from the category of the classified water user, the predicted value is 0;
[0041] The loss rate is calculated using the predicted values of multiple user pairs.
[0042] In a second aspect, the present invention provides a user classification device based on machine learning, comprising:
[0043] A historical water use data acquisition module is used to acquire historical water use data of water users to be classified;
[0044] A water use feature extraction module, used to input the historical water use data into a water use feature extraction model to obtain the water use features of the water users to be classified;
[0045] A user pair generation module, used for inputting the water use characteristics into a pre-trained user pair generation model to obtain a user pair, wherein the user pair includes the water user to be classified and a classified water user;
[0046] The user category determination module is used to determine the category of the classified water users as the category of the water users to be classified.
[0047] In a third aspect, the present invention provides an electronic device, the electronic device comprising:
[0048] at least one processor; and
[0049] a memory communicatively connected to the at least one processor; wherein,
[0050] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the user classification method based on machine learning as described in any one of the first aspects of the present invention.
[0051] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the user classification method based on machine learning as described in any one of the first aspects of the present invention when executed.
[0052] After obtaining the historical water use data of the water users to be classified, the embodiment of the present invention extracts the water use features of the water users to be classified from the historical water use data through a water use feature extraction model, and inputs the water use features into a user pair generation model to obtain a user pair including the water users to be classified and the classified water users, and determines the category of the classified water users in the user pairs as the category of the water users to be classified. On the one hand, it is possible to classify water users through the historical water use data of the water users to be classified, and accurately classify the users in combination with their actual water use situations, and by pre-configuring the categories of the classified water users, it is possible to finely classify water users. On the other hand, there is no need to manually classify water users, which saves a lot of manpower and can update user classification in a timely manner.
[0053] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0055] Figure 1 is a flow chart of a user classification method based on machine learning provided in Embodiment 1 of the present invention;
[0056] Figure 2 is a flow chart of a user classification method based on machine learning provided in Embodiment 2 of the present invention;
[0057] Figure 3 This is a schematic diagram of the network structure of the water use feature extraction model;
[0058] Figure 4 A schematic diagram of the network structure of the generated model for users;
[0059] Figure 5 is a structural diagram of a user classification device based on machine learning provided in Embodiment 3 of the present invention;
[0060] Figure 6It is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0061] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0062] Embodiment 1
[0063] Figure 1 This is a flowchart of a user classification method based on machine learning provided in the first embodiment of the present invention. This embodiment is applicable to the case of classifying water users. The method can be executed by a user classification device based on machine learning. The user classification device based on machine learning can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the user classification method based on machine learning includes:
[0064] S101. Obtain historical water use data of water users to be classified.
[0065] In this embodiment, the water user may be a user with a user water meter in a city, or a user with a user water meter in a certain area of a city. The water user is based on the registered water meter. The water user to be classified may be an unclassified water user or a water user that needs to be reclassified. Specifically, it may be a water user of a category that needs to be relocated due to abnormal water use.
[0066] This embodiment can classify water users by triggering preset trigger events. In one scenario, the city's water management system may include a user water use monitoring subsystem. When the user water use detection subsystem detects that a certain water user has abnormal water use, the user water use detection subsystem may determine the water user as an abnormal water user, and treat the abnormal water user as a water user to be classified, so as to trigger reclassification of the abnormal water users.
[0067] In another scenario, the preset trigger event may also be a scheduled time, such as at the early morning of the last day of each month, when the system time reaches the set scheduled time, all water users are identified as water users to be classified.
[0068] The historical water use data may be water use data of the water user to be classified before the current time, and the water use data may be the historical water use time series data of the water user, that is, the water consumption, cost and other data of the water user recorded in chronological order.
[0069] In an optional embodiment, if the water users to be classified do not have sufficient historical water usage data, or even no historical water usage data, the water users to be classified may be pushed to a manual classification terminal for manual classification.
[0070] S102: Input historical water use data into a water use feature extraction model to obtain water use features of water users to be classified.
[0071] This embodiment can pre-train a water use feature extraction model, and the water use feature extraction model can extract water use features from historical water use data, wherein the water use feature can be at least one of the maximum daily water use, the average daily water use, the peak water use time period, the low water use time period, the daily water use frequency, the monthly water use billing gradient data, the longest duration of daily water use, the maximum monthly water use, the monthly average water use, and the monthly water cost.
[0072] S103: Inputting water usage characteristics into a pre-trained user pair generation model to obtain user pairs, where the user pairs include a water user to be classified and a classified water user.
[0073] In this embodiment, the user pair generation model can be a neural network model that generates a user pair including two water users of the same category by comparing and matching water use characteristics. The user pair generation model can include a feature library of water use characteristics of classified water users. When the water use characteristics of the water users to be classified are input into the user pair generation model, the similarity between the input water use characteristics and the water use characteristics in the feature library is calculated in the user pair generation model, and then the classified water users and the water users to be classified with the highest similarity are used to generate user pairs.
[0074] S104: Determine the categories of the classified water users as the categories of the water users to be classified.
[0075] Since a user pair is composed of two water users of the same category, the category of the classified water users in the user pair can be determined as the category of the water users to be classified. In this embodiment, the category of water users can include a first-level classification: residential users, industrial users, commercial users, and agricultural users. Each first-level classification can also include a second-level classification: high water consumption users, medium water consumption users, and low water consumption users. Each second-level classification can also include highly active water users, medium active water users, and low active water users. Technical personnel in this field can set multiple levels of categories according to actual management needs and personalized service needs to achieve refined classification. This embodiment does not limit the category setting of water users.
[0076] After determining the categories of water users, management plans can be developed for them or personalized services can be recommended based on the categories.
[0077] After obtaining the historical water use data of the water users to be classified, the embodiment of the present invention extracts the water use features of the water users to be classified from the historical water use data through a water use feature extraction model, and inputs the water use features into a user pair generation model to obtain a user pair including the water users to be classified and the classified water users, and determines the category of the classified water users in the user pairs as the category of the water users to be classified. On the one hand, it is possible to classify water users through the historical water use data of the water users to be classified, and accurately classify the users in combination with their actual water use situations, and by pre-configuring the categories of the classified water users, it is possible to finely classify water users. On the other hand, there is no need to manually classify water users, which saves a lot of manpower and can update user classification in a timely manner.
[0078] Embodiment 2
[0079] Figure 2 This is a flow chart of a user classification method based on machine learning provided in the second embodiment of the present invention. The embodiment of the present invention is optimized on the basis of the above-mentioned first embodiment, such as Figure 2 As shown, the user classification method based on machine learning includes:
[0080] S201. Obtaining historical water consumption time series data of water users to be classified within a preset historical time period.
[0081] In this embodiment, the user ID of the water user to be classified can be determined first, and the historical water use time series data of the water user to be classified can be searched in the water metering system through the user ID. For example, the water use time series data of the user ID 3 months and 6 months before the current time is searched in the water metering system. The water use time series data can be the water use data generated when the water meter moves, or it can be the water use data collected at multiple sampling time points, for example, it can be the water use amount collected at each sampling time point (compared with the water use amount at the previous time point).
[0082] S202: Input the historical water usage time series data into the water usage feature extraction model.
[0083] This embodiment can pre-train the water feature extraction model, such as Figure 3 Shown is a schematic diagram of a water use feature extraction model, which may include an input layer, multiple feature extraction networks, and a feature fusion network.
[0084] During training, you can first obtain a water use time series data set, which includes water use time series data samples and annotated daily maximum water use, daily average water use, water use peak time period, water use low peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, monthly maximum water fee, and monthly average water fee. Figure 3 After the water use feature extraction model shown in the figure is constructed and the model parameters of the water use feature extraction model are initialized, water use time series data samples can be extracted from the water use time series data set and input into the water use feature extraction model. Each feature extraction network in the water use feature extraction model extracts the daily maximum water use, daily average water use, water use peak time period, water use low peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, monthly maximum water charge, and monthly average water charge as features. The extracted multi-dimensional features are input into the feature fusion network for fusion and splicing to obtain the total water use. For water characteristics, the loss rate is calculated using the annotated and extracted fusion-joined daily maximum water consumption, daily average water consumption, water consumption peak time period, water consumption low peak time period, daily water use frequency, monthly water billing gradient data, daily maximum water use duration, monthly maximum water consumption, monthly average water consumption, monthly maximum water fee, monthly average water fee and other multi-dimensional features to determine whether the training stop conditions are met; if so, determine that the water use feature extraction model has completed training; if not, adjust the model parameters of the water use feature extraction model according to the loss rate, and return to the step of extracting water use time series data samples from the water use time series data set and inputting them into the water use feature extraction model.
[0085] For example, for a water consumption time series data sample x, its annotated feature is F1(A1, A2, ..., An). After the water consumption time series data sample x is input into the input layer, it is passed through multiple feature extraction networks Net i The maximum daily water consumption, average daily water consumption, peak water consumption period, low water consumption period, daily water consumption frequency, monthly water consumption billing gradient data, the longest duration of daily water consumption, the maximum monthly water consumption, the average monthly water consumption, the maximum monthly water fee, and the average monthly water fee are extracted from the water consumption time series data sample x to obtain the multi-dimensional feature B. i The extracted features are then concatenated and fused in the feature fusion network to obtain F2 (B1, B2, ..., Bn). The loss rate is obtained by calculating the mean square error loss by labeling the feature F1 and the extracted feature F2. The model parameters are then gradient-decreased according to the loss rate, and the training is continued until the loss rate is less than the threshold or the number of training times reaches the preset number.
[0086] After the water use feature extraction model is trained and applied, the historical water use time series data can be input into the input layer of the water use feature extraction model, and the historical water use time series data can be standardized in the input layer, such as normalization.
[0087] S203. In the water use feature extraction model, the maximum daily water consumption, average daily water consumption, peak water use time period, low water use time period, daily water use frequency, monthly water use billing gradient data, the longest duration of daily water use, the maximum monthly water consumption, the monthly average water consumption, and the monthly water cost of the water users to be classified are extracted from the historical water use time series data as water use features.
[0088] Specifically, Figure 3 As shown in the figure, the input historical water consumption time series data x is passed through multiple feature extraction networks Net i Perform feature extraction to obtain features B in multiple dimensions i (at least one of the following: daily maximum water consumption, daily average water consumption, water consumption peak time period, water consumption low peak time period, daily water consumption frequency, monthly water consumption billing gradient data, daily water consumption duration, monthly maximum water consumption, monthly average water consumption, and monthly water consumption fee), then feature B of multiple dimensions i The input is sent to the feature fusion network for fusion and splicing to obtain the water usage feature F2.
[0089] S204: Input the water usage characteristics of the water users to be classified into a feature matching network.
[0090] This embodiment can pre-train a user pair generation model, which includes a feature matching network and a user pair generation network, wherein the feature matching network includes multiple feature matching sub-networks and a similarity calculation sub-network, wherein each feature matching sub-network is used to calculate the similarity between the features of the corresponding dimension in the input water use feature and the features of the corresponding dimension of the same water use feature in the feature library, and the similarity calculation sub-network calculates the total similarity based on the similarity and weight of the features in multiple dimensions.
[0091] During training, a feature library of classified water users can be pre-built to obtain a sample user data set, which includes the first water use feature of the sample user and the category of the labeled sample user, and a user pair generation model can be constructed, such as Figure 4As shown, the user pair generation model includes a feature matching network and a user pair generation network, the feature matching network includes multiple feature matching sub-networks and a similarity calculation sub-network, a batch of multiple sample users' first water use features are extracted from the sample user data set and input into the user pair generation model, the similarity between the water use features of the corresponding dimension in the first water use features and the water use features of the corresponding dimension of the same classified water user in the feature library is calculated in the multiple feature matching sub-networks, and the weighted sum is used as the similarity, the classified water users and sample users with the greatest similarity are used to generate user pairs in the user pair generation network, the loss rate is calculated by the marked categories of the sample users in the multiple user pairs and the categories of the classified water users, and it is judged whether the training stop condition is met, if so, it is determined that the user pair generation model has completed training, if not, the model parameters of the user pair generation model are adjusted according to the loss rate, and the step of extracting the first water use features of a batch of multiple sample users from the sample user data set and inputting them into the user pair generation model to obtain the user pair of each sample user is returned.
[0092] like Figure 4 As shown, assuming that the input water use feature is F (X1, X2, ..., Xn), which includes features of n dimensions (each dimensional feature corresponds to the above-mentioned maximum daily water consumption, average daily water consumption, peak water use time period, low water use time period, daily water use frequency, monthly water billing gradient data, maximum daily water use duration, monthly maximum water consumption, monthly average water consumption, monthly water fee), the water use feature F is input into each feature matching subnetwork, and each feature matching subnetwork reads the water use feature M (M1, M2, ..., Mn) of the same classified water user from the feature library. For each feature matching subnetwork, the similarity of the features of the same dimension in the water use feature F and the water use feature M is calculated. For example, feature matching subnetwork 1 calculates the similarity S1 between X1 and M1, feature matching subnetwork 2 is used to calculate the similarity S2 between X2 and M2, and so on.
[0093] Multiple feature matching subnetworks output the similarities of features of each dimension (S1, S2, ..., Sn) to the similarity calculation subnetwork. The similarity calculation subnetwork calculates the total similarity S through the feature weights of the current dimensions, and the total similarity S is output to the user pair generation network. Each time the user pair generation network receives a total similarity S, it compares it with the current maximum total similarity S-max. If the received total similarity S is less than the current maximum total similarity S-max, the received total similarity S is discarded. If the received total similarity S is greater than or equal to the current maximum total similarity S-max, the received total similarity S is used as the current maximum total similarity S-max. After calculating the similarity between the currently input water use feature and all water use features in the feature library, the user pair generation network obtains the final maximum total similarity S-max, thereby determining the classified water user who is most similar to the sample user, thereby generating a user pair.
[0094] After user pairs are generated for all sample users in a batch, the predicted value of each user pair is determined, where if the labeled category of the sample user is the same as the category of the classified water user, the predicted value is 1; if the labeled category of the sample user is different from the category of the classified water user, the predicted value is 0. Rather than using the predicted values of multiple user pairs to calculate the loss rate, it is better to calculate the average of the predicted values of multiple user pairs as the loss rate.
[0095] If the training conditions are not met, for example, the loss rate is greater than the preset value, the weights of the features of each dimension in the user-generated network can be gradient decreased and the network parameters of the feature matching subnetwork can be adjusted through the loss rate, and the feature matching subnetwork and the user-generated network can be retrained after the parameters are adjusted.
[0096] After the user completes the training of the generated model and applies it, the water use characteristics of the water users to be classified can be input into each feature matching sub-network.
[0097] S205 . Match the water use characteristics of the water user to be classified with the water use characteristics of the classified water users in the feature database in the feature matching network to obtain the similarity between the water user to be classified and each classified water user.
[0098] Specifically, Figure 4 As shown, after the water usage characteristics are input into each subnetwork of the feature matching network, each feature matching subnetwork reads the water usage characteristics of the same classified water user from the feature library, and each feature matching subnetwork performs similarity calculation on the corresponding dimensional features to obtain multiple similarities Si, and the similarities of multiple dimensional features (S1, S2, ..., Sn) are input to the similarity calculation subnetwork, and the total similarity S is calculated in the similarity calculation subnetwork through the feature weights of the current dimensions.
[0099] S206: Input the similarity into the user pair generation network, and use the classified water users with the greatest similarity and the water users to be classified in the user pair generation network to generate user pairs.
[0100] After the similarity S between the water use characteristics of the water user to be classified and the water use characteristics of multiple classified water users in the feature library is input into the user pair generation network, the user pair generation network determines the maximum similarity, and the classified water user and the water user to be classified with the maximum similarity generate a user pair.
[0101] S207: Determine the categories of the classified water users as the categories of the water users to be classified.
[0102] Since the user pair is composed of two water users of the same category, the category of the classified water users in the user pair can be determined as the category of the water users to be classified.
[0103] After obtaining the historical water use time series data of the water users to be classified, this embodiment inputs the historical water use time series data into the water use feature extraction model to extract the daily maximum water use, daily average water use, water use peak time period, water use low-peak time period, daily water use frequency, monthly water billing gradient data, daily longest duration of water use, monthly maximum water use, monthly average water use, and monthly water fee of the water users to be classified as water use features, and inputs the water use features into the user pair generation model to generate user pairs, and determines the category of the classified water users in the user pairs as the category of the water users to be classified. On the one hand, it is possible to classify water users through multi-dimensional water use features in the historical water use data of the water users to be classified, and can accurately classify users in combination with their actual water use situations, and by pre-configuring the categories of the classified water users, it is possible to finely classify water users. On the other hand, there is no need to manually classify water users, which saves a lot of manpower and can update user classification in a timely manner.
[0104] Embodiment 3
[0105] Figure 5 This is a schematic diagram of the structure of a user classification device based on machine learning provided in Embodiment 3 of the present invention. Figure 5 As shown, the user classification device based on machine learning includes:
[0106] The historical water use data acquisition module 501 is used to acquire the historical water use data of the water users to be classified;
[0107] The water use feature extraction module 502 is used to input the historical water use data into a water use feature extraction model to obtain the water use features of the water users to be classified;
[0108] A user pair generation module 503, configured to input the water use characteristics into a pre-trained user pair generation model to obtain a user pair, wherein the user pair includes the water user to be classified and a classified water user;
[0109] The user category determination module 504 is used to determine the category of the classified water users as the category of the water users to be classified.
[0110] Optionally, the historical water consumption data acquisition module 501 includes:
[0111] The time series data acquisition unit is used to acquire the historical water consumption time series data of the water users to be classified within a preset historical time period.
[0112] Optionally, the water use feature extraction module 502 includes:
[0113] A time series data input unit, used for inputting the historical water use time series data into the water use feature extraction model;
[0114] A feature extraction unit is used to extract the daily maximum water consumption, daily average water consumption, water consumption peak time period, water consumption low-peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water consumption, monthly average water consumption, and monthly water charges of the water users to be classified from the historical water use time series data in the water use feature extraction model.
[0115] Optionally, the water usage feature extraction model is trained by the following modules:
[0116] A time series data set acquisition module is used to acquire a water use time series data set, wherein the water use time series data set includes water use time series data samples and annotated daily maximum water use, daily average water use, water use peak time period, water use low peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, monthly maximum water fee, and monthly average water fee;
[0117] A water use feature extraction model construction unit, used to construct a water use feature extraction model and initialize model parameters of the water use feature extraction model;
[0118] A time series data input module for training, used to extract water use time series data samples from the water use time series data set and input them into the water use feature extraction model, and predict the maximum daily water use, average daily water use, peak water use time period, low water use time period, daily water use frequency, monthly water use billing gradient data, the longest duration of daily water use, the monthly maximum water use, the monthly average water use, the monthly maximum water fee, and the monthly average water fee in the water use feature extraction model as water use features;
[0119] A characteristic loss rate calculation module is used to calculate the loss rate using the marked and predicted daily maximum water consumption, daily average water consumption, water consumption peak time period, water consumption low peak time period, daily water consumption frequency, monthly water consumption billing gradient data, daily maximum water consumption duration, monthly maximum water consumption, monthly average water consumption, monthly maximum water fee, and monthly average water fee;
[0120] The water use feature extraction model training condition judgment module is used to judge whether the training stop condition is met; if so, the first training completion determination module is executed; if not, the water use feature extraction model adjustment module is executed;
[0121] A first training completion determination module is used to determine that the water use feature extraction model has completed training;
[0122] The water use feature extraction model adjustment module is used to adjust the model parameters of the water use feature extraction model according to the loss rate and return the time series data input module for training.
[0123] Optionally, the user pair generation model is provided with a feature library, the feature library includes water use features of classified water users, the user pair generation model includes a feature matching network and a user pair generation network, and the user pair generation module 503 includes:
[0124] A water use feature input unit, used to input the water use features of the water users to be classified into a feature matching network;
[0125] A matching unit, configured to match the water use characteristics of the water user to be classified with the water use characteristics of the classified water users in the feature database in the feature matching network to obtain the similarity between the water user to be classified and each classified water user;
[0126] The user pair generating unit is configured to input the similarity into the user pair generating network, and generate user pairs in the user pair generating network by using the classified water users with the greatest similarity and the water users to be classified.
[0127] Optionally, the user trains the generated model through the following modules:
[0128] A feature library construction module is used to construct a feature library of classified water users;
[0129] A sample user data set acquisition module, used to acquire a sample user data set, wherein the sample user data set includes a first water use characteristic of the sample user and a marked category of the sample user;
[0130] A user pair generation model construction module, used to construct the user pair generation model, the user pair generation model includes a feature matching network and a user pair generation network, the feature matching network includes a plurality of feature matching sub-networks;
[0131] A sample user data input module, used for extracting first water use characteristics of a batch of multiple sample users from the sample user data set and inputting them into the user pair generation model;
[0132] A similarity calculation module, used to calculate the similarity between the water use characteristics of the corresponding dimension in the first water use characteristics and the water use characteristics of the corresponding dimension of the same classified water user in the feature library in multiple feature matching sub-networks, and take a weighted sum as the similarity;
[0133] A user pair generation module, configured to generate user pairs using the classified water users with the greatest similarity and the sample users in the user pair generation network;
[0134] A classification loss calculation module, used to calculate the loss rate by using the marked categories of sample users in a plurality of user pairs and the categories of the classified water users;
[0135] A user generated model training condition judgment module is used to judge whether the training stop condition is met; if so, execute the second training completion determination module; if not, execute the user generated model adjustment module;
[0136] A second training completion determination module is used to determine that the user has completed training on the generated model;
[0137] The user pair generation model adjustment module is used to adjust the model parameters of the user pair generation model according to the loss rate and return the sample user data input module.
[0138] Optionally, the classification loss calculation module includes
[0139] A prediction value determination unit, configured to determine a prediction value for each user pair, wherein if the marked category of the sample user is the same as the category of the classified water user, the prediction value is 1, and if the marked category of the sample user is different from the category of the classified water user, the prediction value is 0;
[0140] The loss rate calculation unit is used to calculate the loss rate using the predicted values of multiple user pairs.
[0141] The user classification device based on machine learning provided in the embodiment of the present invention can execute the user classification method based on machine learning provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0142] Embodiment 4
[0143] Figure 6A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0144] like Figure 6 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0145] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0146] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 41 executes the various methods and processes described above, such as a user classification method based on machine learning.
[0147] In some embodiments, the user classification method based on machine learning may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the user classification method based on machine learning described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to perform the user classification method based on machine learning in any other appropriate manner (e.g., by means of firmware).
[0148] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0149] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0150] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0151] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0152] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0153] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0154] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0155] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A user classification method based on machine learning, characterized in that: include: Obtain historical water use data of water users to be classified; Inputting the historical water use data into a water use feature extraction model to obtain water use features of the water users to be classified; Inputting the water use characteristics into a pre-trained user pair generation model to obtain a user pair, wherein the user pair includes the water user to be classified and a classified water user; The category of the classified water users is determined as the category of the water users to be classified.
2. The user classification method based on machine learning according to claim 1, characterized in that: Obtain historical water consumption data of water users to be classified, including: The historical water consumption time series data of the water users to be classified within a preset historical time period is obtained.
3. The user classification method based on machine learning according to claim 2 is characterized in that: The historical water use data is input into the water use feature extraction model to obtain the water use features of the water users to be classified, including: Inputting the historical water use time series data into the water use feature extraction model; In the water use feature extraction model, the historical water use time series data is used to extract the daily maximum water use, daily average water use, water use peak time period, water use low-peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, and monthly water cost of the water user to be classified as water use features.
4. The user classification method based on machine learning according to claim 3 is characterized in that: The water use feature extraction model is trained in the following way: Obtain a water use time series data set, wherein the water use time series data set includes water use time series data samples and annotated daily maximum water use, daily average water use, water use peak time period, water use low peak time period, daily water use frequency, monthly water use billing gradient data, daily maximum water use duration, monthly maximum water use, monthly average water use, monthly maximum water fee, and monthly average water fee; Constructing a water use feature extraction model and initializing model parameters of the water use feature extraction model; Extracting water use time series data samples from the water use time series data set and inputting them into the water use feature extraction model, predicting the maximum daily water use, average daily water use, peak water use time period, low water use time period, daily water use frequency, monthly water use billing gradient data, the longest duration of daily water use, the maximum monthly water use, the average monthly water use, the maximum monthly water fee, and the average monthly water fee in the water use feature extraction model; The loss rate is calculated using the marked and predicted daily maximum water consumption, daily average water consumption, water consumption peak time period, water consumption low peak time period, daily water use frequency, monthly water billing gradient data, the longest duration of daily water use, monthly maximum water consumption, monthly average water consumption, monthly maximum water fee, and monthly average water fee; Determine whether the training stop condition is met; If so, determining that the water use feature extraction model has completed training; If not, the model parameters of the water use feature extraction model are adjusted according to the loss rate, and the process returns to the step of extracting water use time series data samples from the water use time series data set and inputting them into the water use feature extraction model.
5. The user classification method based on machine learning according to claim 3 is characterized in that: The user pair generation model is provided with a feature library, the feature library includes water use features of classified water users, the user pair generation model includes a feature matching network and a user pair generation network, and the water use features are input into the pre-trained user pair generation model to obtain user pairs, including: Inputting the water use characteristics of the water users to be classified into a feature matching network; In the feature matching network, the water use characteristics of the water user to be classified are matched with the water use characteristics of the classified water users in the feature library to obtain the similarity between the water user to be classified and each classified water user; The similarity is input into the user pair generation network, and a user pair is generated in the user pair generation network using the classified water user with the greatest similarity and the water user to be classified.
6. The user classification method based on machine learning according to claim 5, characterized in that: The user generates the model by training it in the following way: Construct a feature database of classified water users; Acquire a sample user data set, where the sample user data set includes a first water use characteristic of the sample user and a marked category of the sample user; Constructing the user pair generation model, wherein the user pair generation model includes a feature matching network and a user pair generation network, and the feature matching network includes a plurality of feature matching sub-networks; Extracting first water use characteristics of a batch of multiple sample users from the sample user data set and inputting them into the user pair generation model; Calculating the similarity between the water use characteristics of the corresponding dimension in the first water use characteristics and the water use characteristics of the corresponding dimension of the same classified water user in the feature library in multiple feature matching subnetworks, and taking a weighted sum as the similarity; In the user pair generation network, the classified water users with the greatest similarity and the sample users are used to generate user pairs; Calculate the loss rate by using the marked categories of the sample users in the plurality of user pairs and the categories of the classified water users; Determine whether the training stop condition is met; If so, determining that the user has completed training of the generated model; If not, adjust the model parameters of the user pair generation model according to the loss rate, and return to the step of extracting a batch of first water use characteristics of multiple sample users from the sample user data set and inputting them into the user pair generation model to obtain a user pair for each sample user.
7. The user classification method based on machine learning according to claim 6, characterized in that: The loss rate is calculated by the marked categories of the sample users in the plurality of user pairs and the categories of the classified water users, including The predicted value for each user pair, wherein if the labeled category of the sample user is the same as the category of the classified water user, the predicted value is 1, and if the labeled category of the sample user is different from the category of the classified water user, the predicted value is 0; The loss rate is calculated using the predicted values of multiple user pairs.
8. A user classification device based on machine learning, characterized in that: include: A historical water use data acquisition module is used to acquire historical water use data of water users to be classified; A water use feature extraction module, used to input the historical water use data into a water use feature extraction model to obtain the water use features of the water users to be classified; A user pair generation module, used for inputting the water use characteristics into a pre-trained user pair generation model to obtain a user pair, wherein the user pair includes the water user to be classified and a classified water user; The user category determination module is used to determine the category of the classified water users as the category of the water users to be classified.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the user classification method based on machine learning according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the user classification method based on machine learning as described in any one of claims 1 to 7 when executed.