Method, device, electronic device and storage medium for generating samples

By generating similar samples, the problem of unbalanced distribution of model training samples is solved, and the recognition accuracy of the model is improved. New samples are generated for a small number of service single samples to ensure their similarity with the original samples, and the accuracy of model recognition is solved. The problem of low sex.

CN112819018BActive Publication Date: 2024-09-24BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911052574.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-10-31
Publication Date
2024-09-24
Estimated Expiration
2039-10-31

AI Technical Summary

Technical Problem

In the existing technology, the number of malicious after-sales service orders and malicious complaint service orders is small, resulting in an unbalanced distribution of model training samples and low model recognition accuracy.

Method used

By generating service order samples, we determine the set of similar samples based on the feature vector of each service order sample, generate new service order samples, increase the number of a small number of service order samples, ensure the similarity between the new samples and the original samples, and then balance the training sample distribution.

Benefits of technology

It improves the recognition accuracy of the model, reduces the problem of unbalanced distribution of training samples, and enhances the model's ability to identify a small number of service single samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112819018B
    Figure CN112819018B
Patent Text Reader

Abstract

The present invention discloses a method, device, electronic device and storage medium for generating samples, and relates to the field of computer technology. A specific implementation of the method includes: generating a feature vector of a service order sample according to the feature parameters of each service order sample in a sample set; determining a similar sample set corresponding to each service order sample according to each feature vector; wherein the similar sample set includes multiple service order samples; generating a new service order sample according to each service order sample and its corresponding similar sample set. This implementation can avoid the problem of unbalanced distribution of training samples in training samples, poor model training results, and thus low recognition accuracy of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating samples. Background Art

[0002] At present, online shopping has become a way of life for users. However, after shopping online, users often apply for after-sales services, complaints and other services for various reasons. As more and more users shop online, the number of service orders for services applied for is also increasing. In order to speed up the processing, the service orders applied by users are usually processed through automatic review. Automatic review is usually implemented by using a trained model. After the trained model recognizes the service order, it is processed accordingly. In order to ensure the accuracy of model recognition, the model needs to be trained with a large number of samples.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] Since some types of service orders appear less frequently in the applied service orders, such as malicious after-sales service orders and malicious complaint service orders, the number of these service orders that can be used as model training samples is very small. This will result in fewer training samples of these types in the training samples for model training, an unbalanced distribution of training samples, poor model training results, and lower recognition accuracy of the model. Summary of the invention

[0005] In view of this, the embodiments of the present invention provide a method, device, system and storage medium for generating samples, which can avoid the problem of unbalanced distribution of training samples, poor model training results, and low recognition accuracy of the model.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for generating a sample is provided.

[0007] A method for generating samples according to an embodiment of the present invention includes: generating a feature vector of each service order sample according to feature parameters of the service order sample in a sample set; determining a similar sample set corresponding to each service order sample according to each feature vector; wherein the similar sample set includes multiple service order samples; and generating a new service order sample according to each service order sample and its corresponding similar sample set.

[0008] In one embodiment, determining a similar sample set corresponding to each of the service order samples according to each of the feature vectors includes: clustering the service order samples in the sample set according to each of the feature vectors to obtain multiple sample clusters; for each of the sample clusters, determining a similar sample cluster of the sample cluster according to a first distance between a central sample in the sample cluster and other sample clusters, and determining the service order samples in the similar sample cluster as a similar sample set of the service order samples in the sample cluster.

[0009] In another embodiment, determining similar sample clusters of the sample cluster based on the first distance between the central sample in the sample cluster and other sample clusters includes: calculating the first distance between the central sample in the sample cluster and the other sample clusters based on the second distance between the central sample in the sample cluster and the service order samples in the other sample clusters; and selecting a preset number of sample clusters with the smallest first distance from the other sample clusters as similar sample clusters of the sample cluster.

[0010] In another embodiment, generating a new service order sample based on each of the service order samples and its corresponding similar sample set includes: determining the sample difference between each of the service order samples and similar samples, wherein the similar samples are service order samples in the similar sample set corresponding to each of the service order samples; and generating the new service order sample based on the service order sample, the sample difference and a random number.

[0011] In another embodiment, the service order sample represents a negative sample; after generating a new service order sample based on each of the service order samples and its corresponding similar sample set, it also includes: determining the service order sample, the new service order sample and the pre-acquired positive sample as a new total sample set; classifying the new total sample set to obtain a negative sample set; determining the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set; and judging whether the generation of the new service order sample is successful based on the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set.

[0012] In yet another embodiment, generating a feature vector of the service order sample based on feature parameters of each service order sample in the sample set includes: standardizing the feature parameters of each service order sample; and generating the feature vector of the service order sample based on the standardized feature parameters.

[0013] In another embodiment, before generating the feature vector of the service order sample based on the feature parameters of each service order sample in the sample set, it also includes: filtering the sample set from the initial total sample set based on a sample label, and the sample label is used to indicate whether the service order sample in the initial total sample set is a negative sample.

[0014] To achieve the above objective, according to another aspect of the present invention, a device for generating a sample is provided.

[0015] A device for generating samples according to the present invention comprises: a generating unit, used to generate a feature vector of each service order sample according to the feature parameters of the service order sample in the sample set; a determining unit, used to determine a similar sample set corresponding to each service order sample according to each feature vector; wherein the similar sample set comprises a plurality of service order samples; the generating unit is further used to generate a new service order sample according to each service order sample and its corresponding similar sample set.

[0016] In one embodiment, the determination unit is specifically used to: cluster the service order samples in the sample set according to each of the feature vectors to obtain multiple sample clusters; for each of the sample clusters, determine a similar sample cluster of the sample cluster according to a first distance between a central sample in the sample cluster and other sample clusters, and determine the service order samples in the similar sample cluster as a similar sample set of the service order samples in the sample cluster.

[0017] In another embodiment, the determination unit is specifically used to: calculate the first distance between the central sample in the sample cluster and the other sample clusters based on the second distance between the central sample in the sample cluster and the service order samples in the other sample clusters; and select a preset number of sample clusters with the smallest first distance from the other sample clusters as similar sample clusters of the sample cluster.

[0018] In another embodiment, the generating unit is specifically used to: determine the sample difference between each service order sample and a similar sample, wherein the similar sample is a service order sample in a similar sample set corresponding to each service order sample; and generate the new service order sample according to the service order sample, the sample difference and a random number.

[0019] In yet another embodiment, the service order sample represents a negative sample; the determining unit is further configured to determine the service order sample, the new service order sample and the pre-acquired positive sample as a new total sample set;

[0020] The device also includes:

[0021] A classification unit is used to classify the new total sample set to obtain a negative sample set; a judgment unit is used to determine the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set, and judge whether the new service order sample is successfully generated based on the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set.

[0022] In yet another embodiment, the generating unit is specifically used to: standardize the characteristic parameters of each of the service order samples; and generate the characteristic vector of the service order sample according to the standardized characteristic parameters.

[0023] In yet another embodiment, the generating unit is specifically used to: filter out the sample set from the initial total sample set according to a sample label, wherein the sample label is used to indicate whether a service order sample in the initial total sample set is a negative sample.

[0024] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0025] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating samples provided by the embodiment of the present invention.

[0026] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0027] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the method for generating a sample provided by the embodiment of the present invention is implemented.

[0028] One embodiment of the above invention has the following advantages or beneficial effects: In the embodiment of the present invention, based on the feature vector of the service order sample, the similar sample set of each service order sample can be calculated, and then for each service order sample, a new service order sample can be generated based on its corresponding similar sample set. In this way, through the embodiment of the present invention, a new service order sample can be generated for a small number of service order samples in the training samples. The new service order sample is generated for each service order sample based on its corresponding similar sample set, ensuring the similarity between the new service order sample and each service order sample. At the same time, a new service order sample is generated, and the number of a small number of service order samples is increased, thereby avoiding the imbalance of the distribution of training samples in the training samples, the poor model training results, and the improvement of the recognition accuracy of the model.

[0029] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0031] Figure 1 is a schematic diagram of a main process of a method for generating a sample according to an embodiment of the present invention;

[0032] Figure 2 is a schematic diagram of another main process of a method for generating a sample according to an embodiment of the present invention;

[0033] Figure 3 is a schematic diagram of main units of an apparatus for generating samples according to an embodiment of the present invention;

[0034] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0035] Figure 5 It is a schematic diagram of the structure of a computer system suitable for implementing the embodiment of the present invention. DETAILED DESCRIPTION

[0036] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0037] It should be pointed out that the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.

[0038] The method for generating samples provided by the embodiment of the present invention is applicable to the scenario of generating service order samples. In general, the service order can be manually reviewed, but since the manual review of the service order consumes a lot of manpower and time costs, and has high subjectivity and randomness, the service order can be automatically reviewed by setting some rules. During the automatic review, since the number of some types of service orders is small, if the rules are not set comprehensively, these types of service orders cannot be effectively identified, such as malicious after-sales service orders, malicious complaint service orders, etc. During the automatic review, the service order can also be identified by the model, but the number of some types of service orders that can be used as model training samples is very small, resulting in a small number of these types of training samples in the training samples of the model training, the distribution of training samples is unbalanced, the model training results are poor, and the recognition accuracy of the model is low. Many of the methods currently used to solve the problem of sample data imbalance do not take into account the sparseness of a small number of samples in all samples (such as the sparseness of malicious after-sales service order samples), which affects the process of generating new samples, so that after the new samples are generated, the imbalance of the samples is further aggravated. In an embodiment of the present invention, for a small number of service order samples, new service order samples can be generated by the method of the embodiment of the present invention, while ensuring the similarity between the new service order samples and the original service order samples, the number of service order samples is increased, thereby reducing the imbalance of training samples.

[0039] An embodiment of the present invention provides a method for generating a sample, which can be executed by a computing device, such as Figure 1 As shown, the method includes the following steps.

[0040] S101: Generate a feature vector of each service order sample according to the feature parameters of each service order sample in the sample set.

[0041] The service order sample includes characteristic parameters of the service order, that is, the characteristic parameters included in the service order sample.

[0042] In the embodiment of the present invention, this step may be specifically performed as follows: standardizing the characteristic parameters of each service order sample; and generating a characteristic vector of the service order sample according to the standardized characteristic parameters.

[0043] For each service order sample, its feature parameters are first standardized, and then a feature vector of the service order sample is generated according to the standardized feature parameters to ensure the correctness of the feature vector.

[0044] It should be noted that the training samples for training the model for identifying service orders can be obtained from all service orders to obtain the initial total sample set. Since the service order includes a large number of service orders as positive samples and a small number of service orders as negative samples, the initial total sample set includes positive samples and negative samples, and the number of positive samples is large and the number of negative samples is small. Both positive samples and negative samples can include the above-mentioned feature parameters. Since the number of negative samples is small, in order to avoid uneven sample distribution, the number of negative samples needs to be increased, so the embodiment of the present invention can be used to generate negative samples, that is, the sample set in the embodiment of the present invention can represent the sample set of negative samples, the service order sample in the sample set can represent the negative sample, and the method of the embodiment of the present invention can be used to generate new negative samples. The specific content of the above negative samples can be set according to the needs of the bureau. For example, the negative sample can be a malicious after-sales service order sample, then the positive sample is a normal after-sales service order sample, and the negative sample can be a malicious complaint service order sample, then the positive sample is a normal complaint service order sample.

[0045] In one implementation of the embodiment of the present invention, the sample set in the embodiment of the present invention may represent a sample set of negative samples, and the service order samples in the sample set may represent negative samples. After obtaining the initial total sample set, a sample label may be marked on each service order sample, and the sample label is used to indicate whether the service order sample in the total sample set is a negative sample. Since the embodiment of the present invention is for a small number of negative samples, before executing step S101, it may include: filtering out the sample set from the initial total sample set according to the sample label.

[0046] The service order samples in the initial total sample set are all marked with sample labels, so negative samples can be screened out according to the labels, and then the sample set in this step is screened out, that is, the sample set of malicious after-sales service order samples is screened out.

[0047] S102: Determine a similar sample set corresponding to each service order sample according to each feature vector.

[0048] Among them, the similar sample set includes multiple service order samples. In the embodiment of the present invention, in order to ensure that the generated new sample is the required sample, the similar sample set corresponding to each service order sample is first determined, so that the new sample is generated by the similar sample set corresponding to the service order sample to ensure the accuracy of the generated new sample. For example, when the service order sample is a malicious after-sales service order sample, in order to ensure that the generated new sample is a malicious after-sales service order sample, the similar sample set corresponding to each malicious after-sales service order sample is first determined, so that the new sample is generated by the similar sample set corresponding to the malicious after-sales service order sample to ensure the accuracy of the generated new sample.

[0049] In one implementation of an embodiment of the present invention, this step can be specifically performed as follows: clustering the service order samples in the sample set according to each feature vector to obtain multiple sample clusters; for each sample cluster, determining the similar sample clusters of the sample cluster according to the first distance between the central sample in the sample cluster and other sample clusters, and determining the service order samples in the similar sample clusters as the similar sample set of the service order samples in the sample cluster.

[0050] In the embodiment of the present invention, the service order samples in the sample set can be clustered, and the service order samples with similarity can be clustered into one category to obtain multiple sample clusters, each of which includes a central sample. For each sample cluster in the multiple sample clusters, the similar sample clusters of the sample cluster can be determined by the first distance between the central sample of the sample cluster and other sample clusters, and then the service order samples in these similar sample clusters can be used as the similar sample set of the sample cluster. In this way, the similar sample set of each sample cluster can be determined.

[0051] Generally, the smaller the distance between two sample clusters, the higher the similarity. Therefore, in the embodiment of the present invention, for each sample cluster, the method of determining its similar sample clusters can be: based on the second distance between the central sample in the sample cluster and the service order samples in other sample clusters, calculate the first distance between the central sample in the sample cluster and other sample clusters; and select a preset number of sample clusters with the smallest first distance from other sample clusters as similar sample clusters of the sample cluster.

[0052] The distance between the central sample of the sample cluster and other sample clusters can be obtained by the second distance between the central sample in the sample cluster and the service order samples in the other sample clusters. And according to the second distance, the first distance between the central sample in the sample cluster and other sample clusters is calculated. After the first distance between the central sample of the sample cluster and other sample clusters is obtained, the other sample clusters can be arranged in order according to the size of the first distance, and after the arrangement order of other sample clusters is obtained, a preset number of sample clusters with the smallest first distance can be selected from other sample clusters as similar sample clusters of the sample cluster.

[0053] S103: Generate a new service order sample according to each service order sample and its corresponding similar sample set.

[0054] For each service order sample, a new service order sample can be generated based on the service order samples included in its corresponding similar sample set. In this way, multiple new service order samples can be generated based on each service order sample, and then more new service order samples can be generated based on all service order samples, thereby increasing the number of service order samples.

[0055] In the embodiment of the present invention, if the number of new service order samples obtained after executing S103 cannot meet the demand, the process of step S101 to step S103 in the embodiment of the present invention can be executed again for the new service order samples, so as to obtain more service order samples. When the service order samples in the embodiment of the present invention are negative samples, usually, in order to ensure the balance of the samples, the number of service order samples needs to be equal to the number of positive samples in the initial total sample set, so the number of new service order samples generated can be determined according to the number of positive samples in the initial total sample set.

[0056] In another implementation method of the embodiment of the present invention, the specific method of generating a new service order sample in this step can be: determining the sample difference between each service order sample and a similar sample, where the similar sample is a service order sample in a similar sample set corresponding to each service order sample; and generating a new service order sample based on the service order sample, the sample difference and a random number.

[0057] After determining each service order sample and its corresponding similar sample set, for each service order sample, the service order sample in the corresponding similar sample set is its similar sample, and each service order can generate a new service order sample based on each of its similar samples. Specifically, determine the sample difference between each service order sample and a similar sample, that is, subtract each service order sample from the similar sample to obtain the difference between the two. Then generate a new service order sample based on the service order sample, the sample difference and the random number. The random number can be a randomly generated number between 0 and 1, and then calculate the product of the sample difference and the random number, and then add it to the service order sample to obtain a new service order sample.

[0058] It should be noted that the above calculation processes can all be completed through the feature vector of the service order sample.

[0059] When the service order sample in the implementation of the present invention represents a negative sample, after executing step S103, it can be judged whether the generation of the new service sample order is successful. In another implementation of the embodiment of the present invention, after executing step S103, it also includes: determining the service order sample, the new service order sample and the pre-acquired positive sample as a new total sample set; classifying the new total sample set to obtain a negative sample set; determining the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set, and judging whether the generation of the new service order sample is successful based on the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set.

[0060] The initial total sample set includes the acquired positive samples and negative samples. After step S103, the new service order sample can be added to the initial total sample set to obtain a new total sample set, that is, the service order sample, the new service order sample and the pre-acquired positive sample are determined as the new total sample set. Then the new total sample set is classified by a classifier, etc. to obtain a negative sample set and a positive sample set. Here, the negative sample set and the positive sample set are obtained by classification by a classifier. Then, the negative samples in the negative sample set can be identified to obtain the number of negative samples classified correctly and the number of negative samples in the negative sample set. Therefore, according to the number of negative samples in the negative sample set and the number of samples classified correctly in the negative sample set, it can be judged whether the generation of the new service order sample is successful.

[0061] In the embodiment of the present invention, based on the feature vector of the service order sample, the similar sample set of each service order sample can be calculated, and then for each service order sample, a new service order sample can be generated based on its corresponding similar sample set. In this way, through the embodiment of the present invention, a new service order sample can be generated for a small number of service order samples in the training sample. The new service order sample is generated for each service order sample based on its corresponding similar sample set, ensuring the similarity between the new service order sample and each service order sample. At the same time, a new service order sample is generated, and the number of a small number of service order samples is increased, thereby avoiding the imbalance of the distribution of training samples in the training sample, the poor model training results, and the improvement of the recognition accuracy of the model.

[0062] Combine the following Figure 1 The embodiment shown in Figure 1 Taking the service order sample of the embodiment shown as a malicious after-sales service order sample as an example, the method of generating a sample in the embodiment of the present invention is specifically described. Figure 2 As shown, the method includes the following steps.

[0063] S201: Obtain an initial total sample set from the after-sales application form.

[0064] Among them, the after-sales application form includes a large number of normal after-sales service forms and a small number of malicious after-sales service forms. The initial total sample set obtained from the after-sales application form includes normal after-sales service form samples and a small number of malicious after-sales service form samples, that is, positive samples and negative samples.

[0065] S202: Filter a malicious after-sales service order sample set from the initial total sample set according to the sample label.

[0066] After obtaining the initial total sample set, a sample label can be marked for each sample in the initial total sample set. The sample label indicates whether the sample is a malicious after-sales service order sample. For example, a sample label of 1 indicates that the sample is a malicious after-sales service order sample, and a sample label of 0 indicates that the sample is a normal after-sales service order sample. Therefore, in this step, the malicious after-sales service order sample set can be filtered out from the initial total sample set based on the sample label.

[0067] S203: Generate a feature vector for each malicious after-sales service order sample by taking the feature parameters of each malicious after-sales service order sample in the malicious after-sales service order sample set.

[0068] Among them, the characteristic parameters represent the relevant information of the after-sales service application form, such as the order type involved in the after-sales service form, merchant identification, after-sales item category, after-sales item identification, ordering account information, after-sales service order behavior in the ordering account history, delivery address information, delivery mobile phone information, purchase behavior, risk behavior information, account risk label information, etc.

[0069] The characteristic parameters of malicious after-sales service order samples can be advanced and standardized to generate corresponding feature vectors.

[0070] S204: Clustering the malicious after-sales service order samples in the malicious after-sales service order sample set according to the feature vector to obtain multiple sample clusters.

[0071] The specific process of clustering in this step can be: a. Randomly select a point as the center point m; b. Find all points within a distance R from the center point m, record them as set G, and assume that these points belong to cluster M, where R can be set in advance; c. Calculate the vector from the center point m to each point in the set G and add them to obtain the vector shift; d. The center point moves along the direction of shift, and the moving distance is ||shift||; e. Repeat b, c and d until convergence. All points encountered in this iterative process are classified as cluster M; f. Calculate the distance between the center points of the two clusters. If the distance between the center points of the two clusters is less than the threshold, merge the two clusters; g. Repeat the above steps until all points are visited; h. For each point, the cluster with the highest number of visits to the point is taken as the cluster to which the point belongs.

[0072] A point in the above clustering process represents a malicious after-sales service order sample. Through the above clustering process, multiple sample clusters of malicious after-sales service order samples can be obtained. In the embodiment of the present invention, clustering is usually completed by a non-parametric clustering method.

[0073] S205: For each sample cluster, determine similar sample clusters of each sample cluster according to the distance between the central sample in the sample cluster and other sample clusters.

[0074] The distance between the center sample in the sample cluster and other sample clusters is the first distance. i Represents each cluster, with Center i Represents cluster C i The center point of is the center sample, where i is an integer greater than 0 and less than T, and T represents the number of sample clusters obtained in step S204. The distance between the center point of each cluster and other clusters can be obtained by the calculation method of formula 1.

[0075]

[0076] In Formula 1, d(Center i ,P j ) represents cluster C i The center point and cluster C j The distance between them, i is an integer greater than 0 and less than T, and not equal to i, P jk Represents cluster C j The kth point in, k is an integer greater than 0 and less than L, T represents the cluster C j The number of points is included in . From formula 1, we can see that cluster C i The center point and cluster C j The distance between clusters C i The center point and cluster C j The distance between the points is included.

[0077] After calculating the distance between the central sample of each sample cluster and other sample clusters, for each sample cluster, it can be sorted according to the value of the distance between the central sample of the sample cluster and other sample clusters, and a preset number of sample clusters with the smallest distance in the sequence are determined as similar sample clusters of the sample cluster.

[0078] It should be noted that the above calculation process can be implemented by the KNN algorithm.

[0079] S206: The malicious after-sales service order samples in the similar sample clusters of each sample cluster are used as the similar sample set of the malicious after-sales service order samples in each sample cluster.

[0080] For each sample cluster, after a similar sample cluster of the sample cluster is determined, the malicious after-sales service order samples in the similar sample cluster can be used as a similar sample set of the malicious after-sales service order samples in the sample cluster.

[0081] S207: Generate a new malicious after-sales service order sample according to each malicious after-sales service order sample and its corresponding similar sample set.

[0082] In step S206, a similar sample set of each malicious after-sales service order sample is determined, and each malicious after-sales service order sample can be combined with its corresponding similar sample set to generate a new malicious after-sales service order sample. Specifically, the new malicious after-sales service order sample can be generated using Formula 2.

[0083] New=x+rand(0,1)*(N h -x) (2)

[0084] In Formula 2, New represents a new malicious after-sales service order sample, x represents any malicious after-sales service order sample, and N h represents the hth malicious after-sales service order sample in the similar sample set corresponding to x, k is an integer greater than 0 and less than Y, Y represents the number of malicious after-sales service order samples in the similar sample set corresponding to x, and rand(0,1) represents a random number between 0 and 1.

[0085] It should be noted that in this step, Formula 2 can be repeatedly used to generate new malicious after-sales service order samples.

[0086] S208: Determine whether the new malicious after-sales service order sample is generated successfully based on the initial total sample set and the new malicious after-sales service order sample.

[0087] After executing step S207, the generated new malicious after-sales service order sample can be added to the initial total sample set to obtain a new total sample set. For the initial total sample set, the number of malicious after-sales service order samples and the number of normal after-sales service order samples are known, and the new total sample set can also be determined.

[0088] In this step, the samples in the new total sample set can be reclassified, and then the classification results can be used to determine whether the new malicious after-sales service order sample is successfully generated. After classifying the samples in the new total sample set, a new malicious after-sales service order sample set and a new normal after-sales service order sample set can be obtained, and the number of samples included in the new malicious after-sales service order sample set and the new normal after-sales service order sample set can be determined. Further, the number of malicious after-sales service order samples correctly identified after classification can be obtained, so that the new malicious after-sales service order sample generation can be determined by calculating the precision and recall rate.

[0089] Among them, the precision rate is the number of malicious after-sales service order samples correctly identified divided by the number of malicious after-sales service order samples in the new malicious after-sales service order sample set, and the recall rate is the number of malicious after-sales service order samples correctly identified divided by the number of malicious after-sales service order samples in the new total sample set. After calculating the precision rate and recall rate, you can compare them with the preset values ​​to determine whether the new malicious after-sales service order sample is successfully generated.

[0090] The classification of the new total sample set in this step can be achieved through the SVM classification algorithm.

[0091] In an embodiment of the present invention, a new malicious after-sales service order sample can be generated by the method of the embodiment of the present invention. The new malicious after-sales service order sample is generated for each malicious after-sales service order sample based on its corresponding similar sample set, thereby ensuring the similarity between the new malicious after-sales service order sample and each malicious after-sales service order sample. At the same time, a new malicious after-sales service order sample is generated to increase the number of malicious after-sales service order samples, thereby avoiding the problem that the number of malicious after-sales service order samples is too small and the distribution of training samples is unbalanced, resulting in poor training results and reduced accuracy in identifying after-sales service orders.

[0092] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a device 300 for generating a sample, such as Figure 3 As shown, the device 300 includes:

[0093] A generating unit 301, configured to generate a feature vector of each service order sample according to a feature parameter of the service order sample in the sample set;

[0094] A determination unit 302 is used to determine a similar sample set corresponding to each of the service order samples according to each of the feature vectors; wherein the similar sample set includes a plurality of service order samples;

[0095] The generating unit 301 is further configured to generate a new service order sample according to each of the service order samples and its corresponding similar sample set.

[0096] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 1 The method of the illustrated embodiment is the same and will not be repeated here.

[0097] In an implementation manner of the embodiment of the present invention, the determining unit 302 is specifically configured to:

[0098] Clustering the service single samples in the sample set according to each of the feature vectors to obtain multiple sample clusters;

[0099] For each of the sample clusters, a similar sample cluster of the sample cluster is determined according to the first distance between the central sample in the sample cluster and other sample clusters, and the service order samples in the similar sample cluster are determined as a similar sample set of the service order samples in the sample cluster.

[0100] In another implementation of the embodiment of the present invention, the determining unit 302 is specifically configured to:

[0101] Calculating a first distance between the central sample in the sample cluster and the other sample clusters according to a second distance between the central sample in the sample cluster and the service order samples in the other sample clusters;

[0102] A preset number of sample clusters with the smallest first distance are selected from the other sample clusters as similar sample clusters of the sample cluster.

[0103] In another implementation of the embodiment of the present invention, the generating unit 301 is specifically used to: determine the sample difference between each service order sample and a similar sample, where the similar sample is a service order sample in a similar sample set corresponding to each service order sample;

[0104] Generate the new service order sample according to the service order sample, the sample difference and a random number

[0105] In another implementation of the embodiment of the present invention, the service order sample represents a negative sample; the determining unit 302 is further configured to determine the service order sample, the new service order sample and the pre-acquired positive sample as a new total sample set;

[0106] The device 300 further includes:

[0107] A classification unit 303 is used to classify the new total sample set to obtain a negative sample set;

[0108] The judgment unit 304 is used to determine the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set, and judge whether the new service order sample is successfully generated based on the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set.

[0109] In another implementation of the embodiment of the present invention, the generating unit 302 is specifically configured to: standardize the characteristic parameters of each of the service order samples;

[0110] A feature vector of the service order sample is generated according to the standardized feature parameters.

[0111] In another implementation of the embodiment of the present invention, the generating unit 301 is specifically used to: filter out the sample set from the initial total sample set according to a sample label, and the sample label is used to indicate whether the service order sample in the initial total sample set is a negative sample.

[0112] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 1 or Figure 2 The method of the illustrated embodiment is the same and will not be repeated here.

[0113] In the embodiment of the present invention, based on the feature vector of the service order sample, the similar sample set of each service order sample can be calculated, and then for each service order sample, a new service order sample can be generated based on its corresponding similar sample set. In this way, through the embodiment of the present invention, a new service order sample can be generated for a small number of service order samples in the training sample. The new service order sample is generated for each service order sample based on its corresponding similar sample set, ensuring the similarity between the new service order sample and each service order sample. At the same time, a new service order sample is generated, and the number of a small number of service order samples is increased, thereby avoiding the imbalance of the distribution of training samples in the training sample, the poor model training results, and the improvement of the recognition accuracy of the model.

[0114] According to an embodiment of the present invention, the present invention also provides an electronic device and a readable storage medium.

[0115] The electronic device of the present invention comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the method for generating samples provided in an embodiment of the present invention.

[0116] Figure 4 An exemplary system architecture 400 is shown to which the method for generating samples or the apparatus for generating samples according to the embodiments of the present invention can be applied.

[0117] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0118] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0119] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0120] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as product information - only an example) to the terminal device.

[0121] It should be noted that the method for generating samples provided in the embodiment of the present invention is generally performed by the server 405, and accordingly, the device for generating samples is generally set in the server 405. The method for generating samples provided in the embodiment of the present invention is generally performed by the terminal devices 401, 402, 403, and accordingly, the device for generating samples is generally set in the terminal devices 401, 402, 403.

[0122] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0123] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 suitable for implementing an embodiment of the present invention. Figure 5 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0124] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0125] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0126] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0127] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0128] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a unit, a program segment, or a part of a code, and the above-mentioned unit, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0129] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be arranged in a processor, for example, it may be described as: a processor includes a generating unit and a determining unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the generating unit may also be described as a "unit of the function of the generating unit".

[0130] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the method for generating samples provided by the present invention.

[0131] 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 may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for generating samples, It is characterized in that include: Generating a feature vector of each service order sample according to the feature parameters of the service order sample in the sample set; Determine a similar sample set corresponding to each of the service order samples according to each of the feature vectors; wherein the similar sample set includes a plurality of service order samples; Generate a new service order sample according to each of the service order samples and its corresponding similar sample set; The determining, according to each of the feature vectors, a similar sample set corresponding to each of the service order samples comprises: Clustering the service single samples in the sample set according to each of the feature vectors to obtain multiple sample clusters; For each of the sample clusters, determine a similar sample cluster of the sample cluster according to a first distance between a central sample in the sample cluster and other sample clusters, and determine the service order samples in the similar sample cluster as a similar sample set of the service order samples in the sample cluster; Generating a new service order sample according to each of the service order samples and its corresponding similar sample set includes: Determine a sample difference between each service order sample and a similar sample, where the similar sample is a service order sample in a similar sample set corresponding to each service order sample; The new service order sample is generated according to the service order sample, the sample difference and a random number.

2. The method according to claim 1, It is characterized in that The determining, according to the first distance between the central sample in the sample cluster and other sample clusters, a similar sample cluster of the sample cluster comprises: Calculating a first distance between the central sample in the sample cluster and the other sample clusters according to a second distance between the central sample in the sample cluster and the service order samples in the other sample clusters; A preset number of sample clusters with the smallest first distance are selected from the other sample clusters as similar sample clusters of the sample cluster.

3. The method according to claim 1, It is characterized in that The service order sample represents a negative sample; After generating a new service order sample according to each of the service order samples and its corresponding similar sample set, the method further includes: Determine the service order sample, the new service order sample and the pre-acquired positive sample as a new total sample set; Classifying the new total sample set to obtain a negative sample set; Determine the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set, and judge whether the new service order sample is successfully generated based on the number of samples included in the negative sample set and the number of samples correctly classified in the negative sample set.

4. The method according to claim 1, It is characterized in that Generating a feature vector of each service order sample according to the feature parameters of each service order sample in the sample set includes: Standardizing the characteristic parameters of each of the service order samples; A feature vector of the service order sample is generated according to the standardized feature parameters.

5. The method according to claim 1, It is characterized in that Before generating the feature vector of each service order sample according to the feature parameters of each service order sample in the sample set, the method further includes: The sample set is screened out from the initial total sample set according to a sample label, where the sample label is used to indicate whether a service order sample in the initial total sample set is a negative sample.

6. A device for generating a sample, It is characterized in that include: A generating unit, configured to generate a feature vector of each service order sample according to a feature parameter of the service order sample in the sample set; A determination unit, configured to determine a similar sample set corresponding to each of the service order samples according to each of the feature vectors; wherein the similar sample set includes a plurality of service order samples; The generating unit is further configured to generate a new service order sample according to each of the service order samples and its corresponding similar sample set; The determination unit is specifically configured to: cluster the service order samples in the sample set according to each of the feature vectors to obtain a plurality of sample clusters; calculate the first distance between the central sample in the sample cluster and the other sample clusters according to the second distance between the central sample in the sample cluster and the service order samples in the other sample clusters; and select a preset number of sample clusters with the smallest first distance from the other sample clusters as similar sample clusters of the sample cluster; The generating unit is specifically used to: determine the sample difference between each service order sample and a similar sample, wherein the similar sample is a service order sample in a similar sample set corresponding to each service order sample; and generate the new service order sample according to the service order sample, the sample difference and a random number.

7. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.