Method, device and equipment for determining training sample, and storage medium
By classifying and fusing the initial sample set multiple times to form the target fused sample set, the memory consumption problem caused by the large number of training samples is solved, and the training efficiency and accuracy of the model are improved.
Patent Information
- Application Number
- CN202310566335.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-05-18
AI Technical Summary
The large number of training samples leads to excessive computer memory consumption, resulting in low model training efficiency and affecting the accuracy of product marketing activities.
By classifying the initial sample set to form user sample clusters, and performing multiple fusion processes on the samples within the clusters, the target fusion sample set is determined as the training sample, thereby reducing the number of samples and maintaining the relationship between samples.
It reduces computer memory consumption, improves model training efficiency, and ensures model accuracy.
Smart Images

Figure CN116467632B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication technology, and in particular relates to a method, apparatus, device and storage medium for determining training samples. Background Technology
[0002] As product marketing activities continue to evolve, historical marketing data accumulates, meaning the number of historical samples continues to grow. To accurately predict the target users of product marketing, models can be built based on historical sample data. However, the large number of training samples leads to excessive computer memory consumption, resulting in low model training efficiency. Summary of the Invention
[0003] This application provides a method, apparatus, device, and storage medium for determining training samples, which can maintain the connection between user samples, reduce the number of training samples, thereby reducing computer memory consumption during target model training, improving the training efficiency of the target model, and ensuring the accuracy of the target model.
[0004] In a first aspect, embodiments of this application provide a method for determining training samples, the method comprising:
[0005] The initial sample set is classified to obtain at least one user sample cluster. The initial user sample set includes multiple user samples, and the user samples include business data of historical users and tags. The tags are used to indicate the group to which the historical users belong. Each user sample cluster includes at least one of the user samples.
[0006] Multiple sample fusion processes are performed on each user sample cluster to obtain multiple fused sample sets. Each fused sample set includes at least one fused sample, and the number of fused samples in different fused sample sets is different. Each fused sample includes fused service data and fused tags. The fused service data is obtained by fusing the service data of at least one user sample in the user sample cluster, and the fused tags are obtained by fusing the tags of at least one user sample corresponding to the fused service data.
[0007] In the multiple fusion sample sets of each user sample cluster, determine the target fusion sample set for each user sample cluster;
[0008] The fused samples of the target fused sample set in the at least one user sample cluster are determined as training samples of the target model, which is used to predict the user's group based on the user's business data.
[0009] Secondly, embodiments of this application provide a training sample determination apparatus, the apparatus comprising:
[0010] A classification module is used to classify an initial sample set to obtain at least one user sample cluster. The initial user sample set includes multiple user samples, and each user sample includes business data of historical users and tags. The tags are used to indicate the group to which the historical users belong, and each user sample cluster includes at least one of the user samples.
[0011] The fusion module is used to perform multiple sample fusion processes on each of the user sample clusters to obtain multiple fused sample sets. Each fused sample set includes at least one fused sample, and the number of fused samples in different fused sample sets is different. Each fused sample includes fused service data and fused tags. The fused service data is obtained by fusing the service data of at least one user sample in the user sample cluster, and the fused tags are obtained by fusing the tags of at least one user sample corresponding to the fused service data.
[0012] The first determining module is used to determine the target fusion sample set of each user sample cluster from multiple fusion sample sets of each user sample cluster;
[0013] The second determining module is used to determine the fused samples of the target fused sample set in the at least one user sample cluster as training samples of the target model, wherein the target model is used to predict the user's group based on the user's business data.
[0014] Thirdly, embodiments of this application provide an electronic device, the device including: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the training sample determination method as described in any of the above.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the training sample determination method as described in any of the above claims.
[0016] The method, apparatus, device, and storage medium for determining training samples in this application embodiment classifies an initial sample set to obtain at least one user sample cluster; performs multiple sample fusion processes on the user samples in each user sample cluster to obtain multiple fused sample sets; determines the target fused sample set for each user sample cluster from the multiple fused sample sets; and determines the fused samples of the target fused sample set in at least one user sample cluster as the training samples for the target model. Thus, in this application embodiment, classifying the initial sample set and fusing the user samples in each user sample cluster to obtain the training samples for the target model maintains the connection between the user samples, reduces the number of training samples, thereby reducing computer memory consumption during target model training, improving the training efficiency of the target model, and ensuring the accuracy of the target model. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the method for determining training samples provided in an embodiment of this application;
[0019] Figure 2 This is a schematic diagram of an embodiment of the method for determining training samples provided in this application.
[0020] Figure 3 This is a schematic diagram of the structure of the training sample determination device provided in the embodiments of this application;
[0021] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0022] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0023] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0024] As product marketing activities continue to evolve, historical marketing data accumulates, meaning the number of historical samples continues to grow. To accurately predict the target users of product marketing, models can be built based on historical sample data. However, the large number of training samples leads to excessive computer memory consumption, resulting in low model training efficiency.
[0025] To address the problems of the prior art, embodiments of this application provide a method, apparatus, device, and storage medium for determining training samples. The method for determining training samples provided in this application embodiment will be described first below.
[0026] Figure 1 A flowchart illustrating a method for determining training samples according to an embodiment of this application is shown. Figure 1 As shown, a method for determining training samples may include the following steps S101 to S104.
[0027] S101. Classify the initial sample set to obtain at least one user sample cluster. The initial user sample set includes multiple user samples, which include historical user business data and tags. The tags are used to indicate the group to which the historical user belongs, and each user sample cluster includes at least one user sample.
[0028] S102. Perform multiple sample fusion processes on each user sample cluster to obtain multiple fused sample sets. Each fused sample set includes at least one fused sample, and the number of fused samples in different fused sample sets is different. Each fused sample includes fused business data and fused tags. The fused business data is obtained by fusing the business data of at least one user sample in the user sample cluster, and the fused tags are obtained by fusing the tags of at least one user sample corresponding to the fused business data.
[0029] S103. In the multiple fusion sample sets of each user sample cluster, determine the target fusion sample set of each user sample cluster.
[0030] S104. The fused samples of the target fused sample set in at least one user sample cluster are determined as training samples of the target model. The target model is used to predict the user's group based on the user's business data.
[0031] The method for determining training samples in this embodiment classifies an initial sample set to obtain at least one user sample cluster; performs multiple sample fusion processes on the user samples in each user sample cluster to obtain multiple fused sample sets; determines the target fused sample set for each user sample cluster from the multiple fused sample sets; and determines the fused samples of the target fused sample set in at least one user sample cluster as the training samples for the target model. Thus, this embodiment, by classifying the initial sample set and fusing the user samples in each user sample cluster to obtain the training samples for the target model, maintains the connection between the user samples, reduces the number of training samples, thereby reducing computer memory consumption during target model training, improving the training efficiency of the target model, and ensuring the accuracy of the target model.
[0032] The specific implementation methods for each of the above steps are described below.
[0033] In S101, the initial user sample set mentioned above may include multiple user samples, which include business data and tags of historical users.
[0034] The business data can include historical user consumption data within a historical period. Taking insurance product marketing data as an example, it can specifically include user basic information, user plan usage information, user consumption amount, user communication data, and other characteristic variables. Of course, this application's embodiments are not limited to the insurance industry; they can also be used in other business scenarios such as predicting user product preferences (e.g., whether a user will upgrade their communication plan), targeted user marketing, user churn retention, or business growth prediction. For example, based on the user's group affiliation, preferred media data can be recommended to the user; the media data can be music, video, or news, etc.
[0035] The aforementioned tags can be used to indicate the group to which a historical user belongs. For example, the tags can indicate whether a historical user belongs to a first group or a second group. The first group may be someone who has purchased a certain insurance, while the second group may be someone who has not purchased the insurance. In this embodiment of the application, the first group and the second group are not limited to these, and can also be set according to the user's needs.
[0036] In some embodiments, the above-mentioned S101 may specifically include:
[0037] Calculate the similarity between user samples based on the business data of multiple user samples in the initial sample set;
[0038] Based on the similarity between user samples, the initial sample set is classified to obtain at least one user sample cluster. The similarity of user samples in different user sample clusters is different.
[0039] The above calculation of the similarity between user samples based on the business data of multiple user samples in the initial sample set can be achieved by using Euclidean distance to calculate the similarity between user samples based on the business data of multiple user samples in the initial sample set, including data on characteristic variables such as user basic information, user package usage information, user consumption amount, and user communication data.
[0040] The above method classifies the initial sample set based on the similarity between user samples to obtain at least one user sample cluster. This classification can be based on the calculated similarity between samples, with user groups of high similarity being labeled as a user sample cluster. The similarity between the same user sample cluster is high, while the similarity between different user sample clusters is low.
[0041] In this embodiment, the initial sample set is classified by calculating the similarity between each user sample to obtain different user sample clusters. This reduces the sample size and maintains the connection between each user sample when user samples are fused in subsequent user sample clusters.
[0042] In S102, each of the above-mentioned fusion sample sets may include at least one fusion sample, and the number of fusion samples in different fusion sample sets is different.
[0043] The aforementioned fused sample may include fused business data and fused tags, wherein the fused business data is obtained by fusing the business data of at least one user sample in the user sample cluster, and the fused tags are obtained by fusing the tags of at least one user sample corresponding to the fused business data.
[0044] In some embodiments, the above-described S102 may specifically include:
[0045] Repeat the following steps to obtain multiple fused sample sets:
[0046] Based on the service data of at least one user sample in each user sample cluster, determine the fused service data of each fused sample;
[0047] Determine the fusion label of each fusion sample based on the label of at least one user sample in each user sample cluster;
[0048] Each fused sample is defined as a fused sample set.
[0049] The above-mentioned multiple sample fusion processing for each user sample cluster can be exemplified by performing 1 to Zi fusion processing on Zi user samples of the i-th user sample cluster Gi in m user sample clusters. Different fusion times correspond to different fusion sample sets, where m is a positive integer greater than 1, i is any one of m, and Zi is the number of user samples in the i-th user sample cluster Gi.
[0050] Based on the business data of at least one user sample in each user sample cluster, the fused business data of each fused sample in multiple fused sample sets is determined. For example, when at least one user sample in a user sample cluster is fused and there is only one fused sample in the fused sample set, the feature values of each feature variable of the fused sample can be shown in the following formula (1):
[0051]
[0052] in, Let G represent the i-th user sample cluster. i (A total of m clusters) are fused into the feature value of the j-th feature variable in a single fused sample. The business data includes N feature variables, X. Gi (x z x j ) represents the user sample cluster G i The feature value of each sample (where x) z Indicates the row number, x j (representing the column number), for each sample data X Gi Sum the row samples in each column, where Z represents the user sample cluster G. i The number of samples included is used to obtain the feature value of the j-th feature variable of a single fused sample. There are a total of N feature variables. These are calculated sequentially to obtain the fused business data of the single fused sample.
[0053] If a user sample cluster needs to be merged into multiple fused samples, then at least one user sample in the user sample cluster is divided into groups of multiple fused samples in the fused sample set according to similarity. The user samples in each group are then fused according to the above formula (1) to determine the fused business data of each fused sample, thereby obtaining the fused sample set. The number of fused samples in different fused sample sets is different. At least one user sample in the user sample cluster is divided into groups of the corresponding number of fused samples according to similarity.
[0054] The above method of determining the fusion label of each fusion sample in multiple fusion sample sets based on the label of at least one user sample in each user sample cluster can be achieved by selecting the fusion label of each fusion sample from the labels of the user samples associated with each fusion sample according to the principle of majority rule.
[0055] In this embodiment, multiple sample fusion processes are performed on each user sample cluster. Based on the business data and labels of at least one user sample in each user sample cluster, the fused business data and fused labels of each fused sample in multiple fused sample sets are determined. This can reduce the number of training samples while maintaining the connection between each user sample, thereby reducing computer memory consumption during target model training, improving the training efficiency of the target model, and ensuring the accuracy of the target model.
[0056] In S103, in order to ensure that the target model still has good prediction accuracy after the initial sample set is fused, the target fusion sample set needs to maintain good original data information without loss when training the target model based on the target fusion sample set. Therefore, the above-mentioned target fusion sample set is the fusion sample set corresponding to the minimum fusion quality evaluation index among multiple fusion sample sets.
[0057] In some embodiments, the above-described S103 may specifically include:
[0058] Obtain the information gain ratio of each fusion sample set in multiple fusion sample sets of each user sample cluster;
[0059] Based on the number of fused samples in each fused sample set and the information gain ratio of each fused sample set, the fusion quality evaluation index of each fused sample set is determined.
[0060] The fusion sample set corresponding to the minimum fusion quality evaluation index in each user sample cluster is determined as the target fusion sample set for each user sample cluster.
[0061] The information gain ratio of each fusion sample set in the multiple fusion sample sets of each user sample cluster can be obtained directly. Alternatively, it can be calculated based on the first and second sample counts of each fusion sample set in the multiple fusion sample sets of each user sample cluster. Based on the first and second sample counts of each fusion sample set, the information entropy of each fusion sample set is calculated. Based on the information entropy of each fusion sample set, the information gain of each fusion sample set is calculated. Based on the information gain of each fusion sample set, the information gain ratio of each fusion sample set is calculated.
[0062] The fusion quality evaluation index of the above-mentioned fusion sample set includes two parts: one is the number of fused samples in the fusion sample set, and the other is the information gain rate of the fusion sample set.
[0063] The above-mentioned fusion quality evaluation index for each fusion sample set is determined based on the number of fusion samples in each fusion sample set and the information gain ratio of each fusion sample set. This can be achieved by standardizing the number of fusion samples using the ln logarithm normalization and then subtracting the information gain ratio of the fusion sample set to obtain the fusion quality evaluation index for the fusion sample set, as shown in the following formula (2):
[0064] C(ki) =ln(ki) - ΔGain(ki) Formula (2)
[0065] Where ki represents the number of fused samples in the fused sample set, ΔGain(ki) represents the information gain ratio of the fused sample set, and C(ki) represents the fusion quality evaluation index of the ki-th fused sample set.
[0066] In this embodiment, the fusion sample set corresponding to the minimum fusion quality evaluation index is determined as the target fusion sample set. This ensures that the fusion samples can still maintain good original data without loss, so that the target model can still have good prediction accuracy after the user samples in the initial user sample set are fused. It also reduces the training complexity of the target model, thereby saving computing resources.
[0067] In some embodiments, obtaining the information gain ratio of each fusion sample set in multiple fusion sample sets of each user sample cluster may specifically include:
[0068] Obtain the first sample count and the second sample count of each fusion sample set in multiple fusion sample sets of each user sample cluster. The first sample count is the number of fusion samples in the fusion sample set whose fusion label indicates the first group, and the second sample count is the number of fusion samples in the fusion sample set whose fusion label indicates the second group.
[0069] Calculate the information entropy of each fused sample set based on the number of the first and second samples in each fused sample set;
[0070] The information gain of each fused sample set is calculated based on the information entropy of each fused sample set.
[0071] The information gain ratio of each fused sample set is calculated based on the information gain of each fused sample set.
[0072] The first sample count is the number of fused samples in the fused sample set whose fused label indicates the first group, and the second sample count is the number of fused samples in the fused sample set whose fused label indicates the second group. For example, the first sample count is the number of fused samples in the fused sample set whose fused label indicates that they have purchased a certain insurance, and the second sample count is the number of fused samples in the fused sample set whose fused label indicates that they have not purchased the same insurance.
[0073] The information entropy of each fusion sample set is calculated based on the number of the first and second samples in each fusion sample set, as shown in the following formulas (3) and (4):
[0074] Entropy(Gi(l))=p Pl *log2(p Pl )-p Nl *log2(p Nl ) Formula (3)
[0075]
[0076] Where Entropy(Gi(l)) is the information entropy of the ith user sample cluster Gi fused into l fused samples, Gi(l) is the l-th fused sample set of the ith user sample cluster Gi, l is a positive integer from 1 to ki, and count(G i (l(P))) is G i The number of the first sample in (l), count(G) i (l(N))) is G i (l) is the number of the second sample.
[0077] The information gain of each fusion sample set is calculated based on the information entropy of each fusion sample set, as shown in the following formula (5):
[0078]
[0079] Wherein, Entropy(Gi) is the overall information entropy of the i-th user sample cluster Gi (including Zi user samples); Let be the sum of the information entropy of each fused sample set (fusing from 1 to ki fused samples) of the i-th user sample cluster Gi; Gain(ki) is the information gain of the ki-th fused sample set in the i-th user sample cluster Gi.
[0080] The information gain ratio of each fusion sample set is calculated based on the information gain of each fusion sample set, as shown in the following formula (6):
[0081] ΔGain(ki)=[Gain(ki)-Gain(1)] / Gain(1) Formula (6)
[0082] The above ΔGain(ki) is the information gain ratio of the ki-th fused sample set in the i-th user sample cluster Gi, and Gain(1) is the information gain of the 1-th fused sample set in the i-th user sample cluster Gi.
[0083] In this embodiment, the information entropy of each fusion sample set is accurately calculated based on the first and second sample counts of each fusion sample set, and then the information gain of each fusion sample set is calculated. Finally, the information gain rate of each fusion sample set is accurately obtained, thereby accurately obtaining the fusion quality evaluation index of the fusion sample set.
[0084] In S104, the aforementioned target model is used to predict the user's group based on the user's business data.
[0085] The training samples of the target model can be used for model training. For example, they can be input into a logistic regression model for training to obtain the target model, which is ultimately used to predict user labels.
[0086] As one implementation of this application, in order to detect and correct erroneous data in the initial sample set, the following steps may be included before S101 above:
[0087] The initial sample set is preprocessed to obtain the first sample set. The preprocessing includes at least one of the following: duplicate removal, missing padding, and abnormal truncation.
[0088] The aforementioned S101 may specifically include:
[0089] The first sample set is classified to obtain at least one user sample cluster.
[0090] The above preprocessing may include at least one of deduplication, missing padding, and abnormal truncation. Specific preprocessing may include:
[0091] (1) Duplicate deletion: For samples with duplicate single key values (such as user identifier), only the one with the latest update time is retained, and the duplicate samples are deleted.
[0092] (2) Missing imputation: Statistically analyze the missing information of each feature variable, remove features with a missing rate of more than 80%, and imput the remaining features with missing values using the mean.
[0093] (3) Outlier truncation: The values of the mean plus or minus three standard deviations are used as the outlier cutoff points for each feature variable, and the feature values of the feature variables with outliers are truncated.
[0094] In this embodiment, the initial sample set is preprocessed before classification. This process removes duplicate data and corrects invalid and missing values, ensuring data integrity and thus improving the accuracy of the training samples.
[0095] As another implementation of this application, in order to predict the user's group, the following steps may be included after S104 above:
[0096] The target model is trained based on the fused business data and fused labels of the training samples.
[0097] The aforementioned target model can be used to input user business data into the target model to predict user tags; users whose tags indicate a target group are then identified as target users. The target group can be either a first group or a second group.
[0098] The above-mentioned training of the target model based on the fused business data and fused labels of the training samples can be achieved by inputting the fused business data and fused labels of the training samples into the logistic regression model for training, thereby obtaining the target model.
[0099] In this embodiment, by modeling the training samples, calculating the error between the training samples and the predicted values, and then adjusting and evaluating the parameters of the optimal model, the user group with high preference for insurance products is output based on the prediction results of the optimal model, and used as the target users for the next marketing campaign, thereby improving the marketing success rate.
[0100] To facilitate understanding of the method for determining training samples in the embodiments of this application, the application process of the method for determining training samples is described below:
[0101] This application proposes an innovative method for replacing a small number of group feature samples with various types of classified samples. It also designs an algorithm for iteratively calculating the number of group feature samples to ensure the effectiveness of the sample replacement and reduce data complexity. Furthermore, it considers the relationship between group samples to build a model, which can ensure the accuracy of the processed sample prediction while saving a lot of memory and computing resources.
[0102] This method can be applied to various application scenarios such as user behavior prediction and business trend prediction using data modeling and analysis methods. Especially with the increasing volume and complexity of data, using this application can significantly reduce the manpower, time and other costs of user modeling, analysis and prediction.
[0103] This application's solution includes four modules: a data cleaning module, a population labeling module, a data dimensionality reduction module, and a model evaluation module. The device flow is as follows: Figure 2 As shown, the details are as follows:
[0104] 1. Data Cleaning Module
[0105] This module primarily takes as input a large, multi-dimensional dataset S (equivalent to the initial sample set mentioned above) for specific business operations and user modeling analysis (including data on user product preferences, targeted marketing, user churn retention, and business growth forecasting, taking user insurance product marketing data as an example), comprising N data feature variables (e.g., user basic information, user package usage information, user spending amount, user communication data, etc.), totaling M sample data (equivalent to the user samples mentioned above) (M >> N), and outputs cleaned and pre-processed data. Specific processing includes:
[0106] (1) Data duplicate verification (i.e. the above-mentioned duplicate deletion): For samples with duplicate single key values (such as user identifier), only the one with the latest update time is retained, and the duplicate samples are deleted.
[0107] (2) Data missing value imputation (i.e. missing imputation above): Statistically analyze the missing status of each feature variable, remove features with a missing rate of more than 80%, and use the mean to imput the remaining features with missing values.
[0108] (3) Data outlier handling (i.e. the above outlier truncation handling): Use the values of the mean plus or minus three standard deviations as the outlier cutoff points for each feature variable, and truncate the feature values of the feature variables that have outliers.
[0109] 2. Group tagging module
[0110] Let S' be the dataset after cleaning and processing by Module 1 (equivalent to the first sample set mentioned above), including N' feature variables and M' sample data. S' remains a large, high-dimensional user analysis dataset. This module focuses on user grouping. To condense and extract user features in a group-based manner, it aggregates highly similar samples and distinguishes samples with significant differences. Specific details are as follows:
[0111] (1) Data set acquisition: Acquire the historical insurance package product marketing activity record data S' of all users, and mark the users who successfully converted through the marketing activities (i.e., users who purchased insurance package products) and the users who did not successfully convert through the marketing activities (i.e., users who did not purchase insurance package products) (equivalent to the first group and the second group mentioned above).
[0112] (2) Similarity calculation: Based on the N data feature variables in the S' dataset, similar users are classified, and the similarity between user samples is calculated using Euclidean distance.
[0113] (3) Group Labeling: Based on the calculated similarity between samples, the user activity record features are classified according to similarity to reduce the sample size. Users with high similarity are labeled as a group cluster. The similarity between the same group cluster is high, and the similarity between different group clusters is low. Assume that the final m group labels are (G1, G2, ..., Gm).
[0114] 3. Data Dimensionality Reduction Module
[0115] Based on the m user groups (i.e., the user sample clusters mentioned above) (G1, G2, ..., Gm) output from Module 2, the samples in each group are represented by X. Gi Let X belong to Gi, i = 1, 2, ..., m, and each sample X Gi Each module contains N feature variables that are identical to the previously input data. The specific contents of this module are as follows:
[0116] (1) Group Feature Convergence: The group features are condensed (i.e., the above convergence process). This operation is to condense and extract group features, select the expected value of each group sample, and initially reduce the sample size. First, the mathematical expectation convergence is performed on the features of m user groups (G1, G2, ..., Gm), and the feature value T of each group sample is calculated to be condensed into 1 sample. Gi (j):
[0117]
[0118] Among them, T Gi (j) represents the condensation of the i-th group Gi (out of m groups) into the j-th feature value in a single sample, X. Gi (x z x j ) represents each sample data in the population Gi (where x z Indicates the row number, x j (representing the column number), for each sample data X Gi Sum the row samples in each column, where Zi represents the number of samples in the population Gi, and thus obtain the feature value of a single sample. There is a total of 1 sample and N features.
[0119] (2) Calculate the condensation effect evaluation index (i.e. fusion quality evaluation index): In order to ensure that the original data information is not lost after the sample is condensed, it is necessary to determine the optimal number of condensed samples so that the original sample data can still ensure that the model has good prediction accuracy after being condensed, and reduce the complexity of the model, thereby saving computing resources.
[0120] An evaluation index for measuring the complexity and effectiveness of data condensation is constructed, consisting of two parts. The first part is the number of condensed samples ki in each population Gi, standardized using the ln logarithmic normalization. The second part is the information gain ratio, which is the information gain ratio of ki condensed samples compared to 1 condensed sample, where ki is calculated sequentially from 1 to Zi. The evaluation index C(ki) is further calculated through an iterative process, as detailed below:
[0121] ΔGain(ki)=[Gain(ki)-Gain(1)] / Gain(1)
[0122] Let Gi(l(P)) be the positive sample (i.e., the user who successfully converted through marketing) in the l-th condensed sample of the i-th group Gi, and let Gi(l(N)) be the negative sample (i.e., the user who failed to convert through marketing). The value of l ranges from 1 to ki. The information gain Gain(ki) is calculated below (ki ranges from 1 to Zi):
[0123]
[0124] Entropy(Gi) is the overall information entropy of the Zi samples of the i-th population Gi; Let be the sum of the information entropy values of the condensed samples from 1 to ki for the i-th group Gi.
[0125] Entropy(Gi(l))=p Pl *log2(p Pl )-p Nl *log2(p Nl )
[0126]
[0127]
[0128] Entropy(Gi(l)) is the information entropy of the i-th population Gi condensed into l condensed samples; count(G i (l)) represents the number of samples in the i-th group Gi, count(G i (l(P))) represents the number of positive samples in the i-th group Gi, count(G i (l(N))) represents the number of negative samples in the i-th group Gi, where the number of positive samples is the number of users who were successfully converted by the marketing campaign, and the number of negative samples is the number of users who were not successfully converted by the marketing campaign.
[0129] Therefore, based on ki and ΔGain(ki), the evaluation index C(ki) is constructed as follows:
[0130] C(ki) = ln(ki) - ΔGain(ki)
[0131] (3) Determine the number of condensed samples: First, for the i-th population Gi, calculate the information gain Gain(1) when k=1, which is condensed into a single sample. Then, calculate Gain(k) by incrementing k from 1 to Z to obtain ΔGain(k). The results are then summarized into an evaluation index set {C(ki)} (where k=1, 2, ..., Zi). Finally, obtain the ki value that minimizes C(ki) from the index set {C(ki)}, thus determining the optimal number of condensed samples Ki, i.e.: Ki=Min({C(ki)}). This splits the i-th population Gi into Ki subgroups. The expected value of the group features is calculated for each subgroup. Therefore, the i-th population Gi (original sample size is Zi) ultimately uses Ki condensed samples, which greatly reduces the sample size. At the same time, the model prediction effect is guaranteed according to the gain efficiency index.
[0132] 4. Model Evaluation Module
[0133] The condensed samples (equivalent to training samples) output by Module 3 (including ∑ki samples from m user groups) are used for model training. The samples are then input into the logistic regression model for training. Finally, the labels of the user groups are predicted. That is, by modeling the condensed samples and calculating the error between the condensed samples and the predicted values, the optimal model parameters are adjusted and evaluated. Based on the prediction results of the optimal model (equivalent to the target model), the user groups with high preference for insurance products are output as the target user groups for the next marketing campaign, thereby improving the marketing success rate.
[0134] Based on the training sample determination method provided in the above embodiments, this application also provides specific implementations of the training sample determination apparatus. Please refer to the following embodiments.
[0135] Please see Figure 3 The training sample determination device 300 provided in this application embodiment may include the following modules: classification module 301, fusion module 302, first determination module 303, and second determination module 304.
[0136] The classification module 301 is used to classify the initial sample set to obtain at least one user sample cluster. The initial user sample set includes multiple user samples. The user samples include business data of historical users and tags. The tags are used to indicate the group to which the historical users belong. Each user sample cluster includes at least one user sample.
[0137] The fusion module 302 is used to perform multiple sample fusion processes on each user sample cluster to obtain multiple fusion sample sets. Each fusion sample set includes at least one fusion sample, and the number of fusion samples in different fusion sample sets is different. Each fusion sample includes fusion business data and fusion label. The fusion business data is obtained by fusing the business data of at least one user sample in the user sample cluster, and the fusion label is obtained by fusing the label of at least one user sample corresponding to the fusion business data.
[0138] The first determining module 303 is used to determine the target fusion sample set of each user sample cluster from multiple fusion sample sets of each user sample cluster.
[0139] The second determining module 304 is used to determine the fused samples of the target fused sample set in at least one user sample cluster as training samples of the target model, which is used to predict the user's group based on the user's business data.
[0140] The training sample determination apparatus of this application embodiment classifies an initial sample set to obtain at least one user sample cluster; performs multiple sample fusion processes on the user samples in each user sample cluster to obtain multiple fused sample sets; determines the target fused sample set for each user sample cluster from the multiple fused sample sets of each user sample cluster; and determines the fused samples of the target fused sample set in at least one user sample cluster as the training samples of the target model. Thus, this application embodiment, by classifying the initial sample set and performing fusion processes on the user samples in each user sample cluster to obtain the training samples of the target model, can maintain the connection between the user samples, reduce the number of training samples, thereby reducing computer memory consumption during target model training, improving the training efficiency of the target model, and ensuring the accuracy of the target model.
[0141] In some embodiments, the fusion module 302 described above may specifically include:
[0142] Repeat the following steps to obtain multiple fused sample sets:
[0143] The first determining unit is used to determine the fused service data of each fused sample based on the service data of at least one user sample in each user sample cluster.
[0144] The second determining unit is used to determine the fusion label of each fusion sample based on the label of at least one user sample in each user sample cluster.
[0145] The third determining unit is used to determine each fusion sample as a fusion sample set.
[0146] In some embodiments, the first determining module 303 described above may specifically include:
[0147] The acquisition unit is used to acquire the information gain rate of each fusion sample set in multiple fusion sample sets of each user sample cluster;
[0148] The fourth determining unit is used to determine the fusion quality evaluation index of each fusion sample set based on the number of fusion samples in each fusion sample set and the information gain ratio of each fusion sample set.
[0149] The fifth determining unit is used to determine the fusion sample set corresponding to the minimum fusion quality evaluation index in each user sample cluster as the target fusion sample set for each user sample cluster.
[0150] In some embodiments, the above-mentioned acquisition unit may specifically include:
[0151] The acquisition subunit is used to acquire the first sample number and the second sample number of each fusion sample set in multiple fusion sample sets of each user sample cluster. The first sample number is the number of fusion samples in the fusion sample set whose fusion label indicates the first group, and the second sample number is the number of fusion samples in the fusion sample set whose fusion label indicates the second group.
[0152] The first calculation subunit is used to calculate the information entropy of each fusion sample set based on the first sample number and the second sample number of each fusion sample set.
[0153] The second calculation subunit is used to calculate the information gain of each fused sample set based on the information entropy of each fused sample set.
[0154] The third calculation subunit is used to calculate the information gain ratio of each fused sample set based on the information gain of each fused sample set.
[0155] In some embodiments, the above-mentioned classification module may specifically include:
[0156] The calculation unit is used to calculate the similarity between user samples based on the business data of multiple user samples in the initial sample set.
[0157] The classification unit is used to classify the initial sample set according to the similarity between user samples, so as to obtain at least one user sample cluster. The similarity of user samples in different user sample clusters is different.
[0158] As one implementation of this application, in order to detect and correct erroneous data in the initial sample set, the above-mentioned apparatus may further include:
[0159] The preprocessing module is used to preprocess the initial sample set to obtain the first sample set. The preprocessing includes at least one of deduplication, missing padding, and abnormal truncation.
[0160] The classification module is specifically used to classify the first sample set to obtain at least one user sample cluster.
[0161] As another implementation of this application, in order to predict the user's group, the above-mentioned device may further include:
[0162] The training module is used to train the target model based on the fused business data and fused labels of the training samples.
[0163] Based on the training sample determination apparatus provided in the above embodiments, this application also provides specific implementations of electronic devices. Please refer to the following embodiments.
[0164] Figure 4 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0165] An electronic device may include a processor 401 and a memory 402 storing computer program instructions.
[0166] Specifically, the processor 401 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0167] Memory 402 may include mass storage for data or instructions. For example, and not limitingly, memory 402 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 402 may include removable or non-removable (or fixed) media. Where appropriate, memory 402 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 402 is non-volatile solid-state memory.
[0168] In a particular embodiment, memory 402 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.
[0169] The processor 401 implements any of the above-described methods by reading and executing computer program instructions stored in the memory 402.
[0170] In one example, the electronic device may also include a communication interface 403 and a bus 410. For example, Figure 4 As shown, the processor 401, memory 402, and communication interface 403 are connected through bus 410 and complete communication with each other.
[0171] The communication interface 403 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0172] Bus 410 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 410 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0173] The electronic device can execute the training sample determination method in the embodiments of this application, thereby achieving the combination Figure 1 and Figure 3 The method and apparatus for determining training samples are described.
[0174] Furthermore, in conjunction with the training sample determination method in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the training sample determination methods in the above embodiments.
[0175] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0176] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0177] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0178] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0179] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A method for determining training samples, characterized in that, The method comprises the following steps: classifying an initial sample set to obtain at least one user sample cluster, wherein the initial sample set comprises a plurality of user samples, the user samples comprise service data of historical users and labels, the labels are used to indicate the groups to which the historical users belong, and each user sample cluster comprises at least one user sample; performing a plurality of sample fusion processes on each user sample cluster to obtain a plurality of fusion sample sets, wherein each fusion sample set comprises at least one fusion sample, the number of fusion samples in different fusion sample sets is different, each fusion sample comprises fusion service data and a fusion label, the fusion service data is obtained by fusing service data of at least one user sample in the user sample cluster, and the fusion label is obtained by fusing labels of at least one user sample corresponding to the fusion service data; determining a target fusion sample set of each user sample cluster in the plurality of fusion sample sets of each user sample cluster; determining fusion samples of the target fusion sample set in the at least one user sample cluster as training samples of a target model, and the target model is used to predict the groups to which users belong according to service data of the users; The method comprises the following steps: obtaining information gain rates of each fusion sample set in the plurality of fusion sample sets of each user sample cluster; determining fusion quality evaluation indexes of each fusion sample set according to the number of fusion samples in each fusion sample set and the information gain rates of each fusion sample set; determining the fusion sample set corresponding to the minimum fusion quality evaluation index in each user sample cluster as the target fusion sample set of each user sample cluster; The fusion quality evaluation index of each fusion sample set is determined through the following formula: C ( ki ) = ln(ki) - ; wherein ki represents the number of fusion samples in the fusion sample set, represents the information gain rate of the fusion sample set, and C(ki) represents the fusion quality evaluation index of the ki-th fusion sample set. The information gain rate of the fusion sample set is determined through the following formula: ; wherein, is the information gain rate of the kth fusion sample set in the ith user sample cluster Gi, is the information gain of the 1st fusion sample set in the ith user sample cluster Gi, is the information gain of the kth fusion sample set in the ith user sample cluster Gi.
2. The method of claim 1, wherein, The method comprises the following steps: repeating the following steps to obtain a plurality of fusion sample sets: determining fusion service data of each fusion sample according to service data of at least one user sample in each user sample cluster; determining fusion labels of each fusion sample according to labels of at least one user sample in each user sample cluster; determining each fusion sample as a fusion sample set.
3. The method of claim 1, wherein, The method comprises the following steps: obtaining a first sample number and a second sample number of each fusion sample set in the plurality of fusion sample sets of each user sample cluster, the first sample number is the number of fusion samples in the fusion sample set whose fusion label indicates a first group, and the second sample number is the number of fusion samples in the fusion sample set whose fusion label indicates a second group; According to the first sample quantity and the second sample quantity of each of the fusion sample sets, information entropy of each of the fusion sample sets is calculated; According to the information entropy of each of the fusion sample sets, information gain of each of the fusion sample sets is calculated; According to the information gain of each of the fusion sample sets, information gain rate of each of the fusion sample sets is calculated.
4. The method of claim 1, wherein, The classification of the initial sample set to obtain at least one user sample cluster comprises: According to the service data of the plurality of user samples in the initial sample set, similarity between each of the user samples is calculated; According to the similarity between each of the user samples, the initial sample set is classified to obtain at least one user sample cluster, and the similarity of the user samples in different user sample clusters is different.
5. The method of claim 1, wherein, Before the classification of the initial sample set to obtain at least one user sample cluster, the method further comprises: The initial sample set is preprocessed to obtain a first sample set, and the preprocessing comprises at least one of repeated deletion, missing filling and abnormal truncation processing; The classification of the initial sample set to obtain at least one user sample cluster comprises: The first sample set is classified to obtain at least one user sample cluster.
6. The method of claim 1, wherein, After the fusion sample of the target fusion sample set in the at least one user sample cluster is determined as a training sample of the target model, the method further comprises: According to the fusion service data and the fusion label of the training sample, the target model is trained.
7. A device for determining training samples, characterized in that, The device comprises: A classification module is configured to classify an initial sample set to obtain at least one user sample cluster, wherein the initial sample set comprises a plurality of user samples, the user samples comprise service data and labels of historical users, the labels are used to indicate the belonging groups of the historical users, and each of the user sample clusters comprises at least one of the user samples; A fusion module is configured to perform multiple sample fusion processing on each of the user sample clusters to obtain a plurality of fusion sample sets, wherein each of the fusion sample sets comprises at least one fusion sample, the number of the fusion samples in different fusion sample sets is different, each of the fusion samples comprises fusion service data and a fusion label, the fusion service data is obtained by fusing the service data of at least one user sample in the user sample cluster, and the fusion label is obtained by fusing the labels of at least one user sample corresponding to the fusion service data; A first determination module is configured to determine a target fusion sample set of each of the user sample clusters in the plurality of fusion sample sets of each of the user sample clusters; A second determination module is configured to determine a fusion sample of the target fusion sample set in the at least one user sample cluster as a training sample of a target model, and the target model is used to predict the belonging groups of users according to the service data of the users; The determination of the target fusion sample set of each of the user sample clusters in the plurality of fusion sample sets of each of the user sample clusters comprises: An information gain rate of each of the fusion sample sets in the plurality of fusion sample sets of each of the user sample clusters is obtained; According to the number of the fusion samples in each of the fusion sample sets and the information gain rate of each of the fusion sample sets, a fusion quality evaluation index of each of the fusion sample sets is determined; The fusion sample set corresponding to the minimum fusion quality evaluation index in each of the user sample clusters is determined as a target fusion sample set of each of the user sample clusters; The fusion quality evaluation index of each of the fusion sample sets is determined according to the number of fusion samples in each of the fusion sample sets and the information gain rate of each of the fusion sample sets, and is determined by the following formula: C ( ki ) = ln(ki) - ; wherein ki represents the number of fusion samples in the fusion sample set, represents the information gain rate of the fusion sample set, and C(ki) represents the fusion quality evaluation index of the ki-th fusion sample set. The information gain rate of the fusion sample set is determined by the following formula: ; wherein, is the information gain rate of the kth fusion sample set in the ith user sample cluster Gi, is the information gain of the 1st fusion sample set in the ith user sample cluster Gi, is the information gain of the kth fusion sample set in the ith user sample cluster Gi.
8. An electronic device, comprising: The device comprises a processor and a memory storing computer program instructions; the processor executes the computer program instructions to implement the training sample determination method of any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the training sample determination method of any one of claims 1-6.
Citation Information
Patent Citations
Fault diagnosis method based on decision tree algorithm
CN110716820A