A sample processing method, device, electronic device and storage medium
Through the independent forest-based anomaly detection method, the anomaly index is calculated and classified for the samples, which solves the problem of low sample classification efficiency in the existing technology, achieves automated and accurate sample classification, and reduces the cost of manual labeling.
Patent Information
- Application Number
- CN202011419201.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-12-07
AI Technical Summary
The sample classification efficiency in the existing technology is low, especially in the manual labeling process, which requires a lot of manpower and material resources, resulting in reduced efficiency.
Use anomaly detection methods, especially methods based on independent forests, to perform anomaly detection on sample collections, calculate the anomaly index of each sample, classify samples according to the anomaly index, and construct positive sample sub-sets and negative sample sub-sets to improve Sample classification efficiency.
Through automated anomaly detection and classification methods, the efficiency of sample classification is significantly improved, the cost and time of manual annotation are reduced, and the classification accuracy is improved.
Smart Images

Figure CN112508095B
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent decision-making technology, and in particular to a sample processing method, device, electronic device and storage medium. Background Art
[0002] Generally speaking, samples can be used in a variety of application scenarios, and most of these application scenarios involve sample processing processes such as sample classification. For example, supervised learning requires labeled samples for model training, which can predict classification relatively accurately. Unsupervised learning does not require labeled samples for model training, but generally only large-scale features can be obtained, and it is difficult to obtain good results for each sample. However, sample annotations are difficult to obtain directly in many scenarios, such as insurance fraud, theft, and deception. It often takes a lot of manpower and material resources to investigate and analyze to determine whether the sample is "yes" or "no"; some scenarios, such as image annotation, often rely on recruiting a large number of people to manually analyze the image. The above sample annotation process is essentially a generalization of the sample classification process. However, the above method of manually classifying samples reduces the efficiency of sample classification. Summary of the invention
[0003] The embodiments of the present application provide a sample processing method, device, electronic device and storage medium, which can improve the efficiency of sample classification.
[0004] In a first aspect, an embodiment of the present application provides a sample processing method, comprising:
[0005] Obtain a sample set to be processed;
[0006] Performing anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set;
[0007] The sample set is classified according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes a plurality of positive samples, and the negative sample subset includes a plurality of negative samples.
[0008] Optionally, the anomaly detection method is an independent forest-based method, and the anomaly detection method is used to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, including:
[0009] Inputting the sample set into the trained independent forest;
[0010] The root node of each independent tree included in the independent forest after training of each sample in the sample set is traversed to determine the leaf node of each sample in each independent tree, and the abnormality index of each sample is determined according to the root node and the leaf node of each sample in each independent tree.
[0011] Optionally, determining the abnormality index of each sample according to the root node and the leaf node where each sample is located in each independent tree includes:
[0012] Determine the path length of each sample from the root node to the leaf node in each independent tree;
[0013] The abnormality index of each sample is determined according to the path length of each sample from the root node to the leaf node in each independent tree.
[0014] Optionally, determining the abnormality index of each sample according to the path length of each sample from the root node to the leaf node in each independent tree includes:
[0015] Calculate the average path length of each sample according to the path length of each sample from the root node to the leaf node in each independent tree;
[0016] According to the average path length of each sample, an abnormality index of each sample is obtained.
[0017] Optionally, classifying the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset includes:
[0018] Determine, according to the abnormality index of each sample, a plurality of samples in the sample set whose abnormality index is greater than a preset value, determine the plurality of samples whose abnormality index is greater than the preset value as a plurality of positive samples, and construct a positive sample subset including the plurality of positive samples;
[0019] According to the abnormality index of each sample, multiple samples in the sample set whose abnormality index is less than or equal to a preset value are determined, and the multiple samples whose abnormality index is less than or equal to the preset value are determined as multiple negative samples, and a negative sample subset including the multiple negative samples is constructed.
[0020] Optionally, the method further comprises:
[0021] Using the positive sample subset and the negative sample subset to train the original supervised learning model to obtain a trained supervised learning model;
[0022] Use the trained supervised learning model to make classification predictions.
[0023] Optionally, the method further comprises:
[0024] Business processing is performed according to the positive sample subset and the negative sample subset.
[0025] In a second aspect, an embodiment of the present application provides a sample processing device, including:
[0026] An acquisition module, used to acquire a sample set to be processed;
[0027] A detection module, configured to perform anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set;
[0028] A classification module is used to classify the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes multiple positive samples and the negative sample subset includes multiple negative samples.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect.
[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method described in the first aspect.
[0031] To summarize, the electronic device can obtain a sample set to be processed, and use an anomaly detection method to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, and then classify the sample set according to the anomaly index of each sample to obtain a positive sample subset and a negative sample subset. Compared with the prior art that manually classifies samples, resulting in low sample classification efficiency, the embodiments of the present application can improve the efficiency of sample classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1It is a flow chart of a sample processing method provided in an embodiment of the present application;
[0034] Figure 2 is a flow chart of another sample processing method provided in an embodiment of the present application;
[0035] Figure 3 is a structural schematic diagram of a sample processing device provided in an embodiment of the present application;
[0036] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0038] See also Figure 1 , is a flow chart of a sample processing method provided in an embodiment of the present application. The method can be applied to an electronic device. The electronic device can be a terminal or a server. The terminal can include an intelligent terminal such as a laptop computer and a desktop computer. The server can be a server or a server cluster. Specifically, the method can include the following steps:
[0039] S101. Obtain a set of samples to be processed.
[0040] S102: Perform anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set.
[0041] In an embodiment of the present application, the electronic device may obtain a sample set to be processed from a local or other device. Other devices refer to devices that store the sample set to be processed. After obtaining the sample set to be processed, the server may use an anomaly detection method to perform anomaly detection on each sample in the sample set to obtain an anomaly index for each sample in the sample set. Among them, the anomaly detection method may be any of the following: a statistical-based method, a clustering-based method, or a special outlier detection algorithm. A special outlier detection algorithm may be a method based on an independent forest iForest. Among them, an independent forest may also be called a lonely forest.
[0042] In one embodiment, when the anomaly detection method is a method based on an independent forest, the electronic device uses the anomaly detection method to perform anomaly detection on each sample in the sample set, and the process of obtaining the anomaly index of each sample in the sample set is to input the sample set into the trained independent forest for the electronic device, and start traversing the root node of each independent tree included in the trained independent forest of each sample in the sample set to determine the leaf node of each sample in each independent tree, and determine the anomaly index of each sample based on the root node and leaf node of each sample in each independent tree. The anomaly index can be an anomaly score. The efficiency and accuracy of determining the anomaly index through the independent forest are relatively high.
[0043] In one embodiment, the process of the electronic device determining the abnormality index of each sample according to the root node and the leaf node of each independent tree where each sample is located can be: the electronic device determines the path length of each sample from the root node to the leaf node where each sample is located in each independent tree, and determines the abnormality index of each sample according to the path length of each sample from the root node to the leaf node where each sample is located in each independent tree. For example, the independent forest includes t independent trees. Taking sample 1 as an example, the electronic device can determine the path length of sample 1 from the root node to the leaf node where (sample 1) is located in each independent tree, thus obtaining t path lengths; the electronic device can determine the abnormality index of sample 1 according to the t path lengths.
[0044] In one embodiment, the process of determining the abnormality index of each sample by the electronic device according to the path length of each sample from the root node to the leaf node in each independent tree can be as follows: the electronic device calculates the average path length of each sample according to the path length of each sample from the root node to the leaf node in each independent tree, and obtains the abnormality index of each sample according to the average path length of each sample. For example, the independent forest includes t independent trees. Taking sample 1 as an example, the electronic device can determine the t path lengths of sample 1, then calculate the mean of the t path lengths to obtain the average path length of sample 1, and determine the abnormality index of sample 1 according to the average path length of sample 1.
[0045] In one embodiment, assuming that the independent forest is composed of t independent trees iTree, each iTree is a binary tree, the construction process of the independent tree can be as follows:
[0046] 1. Randomly select m (m is less than or equal to n) samples from the n samples included in the data set as the data set of the root node;
[0047] 2. Randomly extract a feature from the data set of the root node;
[0048] 3. Randomly select a value in the range of the feature (between max and min);
[0049] 4. Use this value to perform binary partitioning on the data set of the root node. The data set of the root node that is less than or equal to the selected value is divided into the left branch of the root node, and vice versa, it is divided into the right branch of the root node, thus obtaining the data set of the left branch and the data set of the right branch;
[0050] 5. Repeat steps 2-4 for each branch data set until one of the following conditions is met, and then stop to obtain an independent tree. The conditions are as follows:
[0051] The tree reaches the set depth
[0052] ·The node has only one data (cannot be cut)
[0053] In one embodiment, the electronic device iForest calculates the abnormality index by the following formula:
[0054]
[0055]
[0056] Where S(x,n) is the anomaly index, x is the data. h(x) is the average path length calculated based on the path length value of each independent tree in all independent trees of x, n is the number of samples, §=0.5772156649 is the Euler constant. The value range of S(x,n) is [0,1]. Where:
[0057] The closer S(x,n) is to 1, the higher the probability of an outlier.
[0058] The closer S(x,n) is to 0, the higher the probability of a normal point.
[0059] If S(x,n) of most of the data set is close to 0.5, it means that there are no obvious outliers in the entire data set.
[0060] S103. Classify the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes a plurality of positive samples, and the negative sample subset includes a plurality of negative samples.
[0061] Among them, positive samples can refer to samples belonging to a certain class, and negative samples can refer to samples that do not belong to a certain class.
[0062] In one embodiment, the electronic device classifies the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset. The process may be: the electronic device determines, according to the abnormality index of each sample, a plurality of samples in the sample set whose abnormality index is greater than a preset value, and determines the plurality of samples whose abnormality index is greater than the preset value as a plurality of positive samples, and constructs a positive sample subset including the plurality of positive samples; the electronic device determines, according to the abnormality index of each sample, a plurality of samples in the sample set whose abnormality index is less than or equal to a preset value, and determines the plurality of samples whose abnormality index is less than or equal to the preset value as a plurality of negative samples, and constructs a negative sample subset including the plurality of negative samples.
[0063] For example, the sample set includes sample 1, sample 2, sample 3, and sample 4. The preset value is 0.5. The anomaly indexes of both samples, sample 1 and sample 2, are less than 0.5, and the anomaly indexes of both samples, sample 3 and sample 4, are greater than 0.5. The electronic device can determine, based on the anomaly index of each sample, that samples 3 and sample 4 in the sample set have an anomaly index greater than 0.5, and can determine both samples 3 and sample 4 as positive samples, and construct a positive sample subset including sample 3 and sample 4; the electronic device can also determine, based on the anomaly index of each sample, that samples 1 and sample 2 in the sample set have an anomaly index less than or equal to 0.5, and determine both samples 1 and sample 2 as negative samples, and construct a negative sample subset including sample 1 and sample 2.
[0064] In one embodiment, after obtaining the positive sample subset and the negative sample subset, the electronic device may perform service processing according to the positive sample subset and the negative sample subset.
[0065] In an application scenario, the samples included in the sample set are user behavior data used to determine whether the corresponding user account is a malicious account, the user account corresponding to the positive sample included in the positive sample subset is a malicious account, and the user account corresponding to the negative sample included in the negative sample subset is not a malicious account. In an embodiment of the present application, when the electronic device is a server, the electronic device can add the user account corresponding to the positive sample included in the positive sample subset to a blacklist, and then if an access request from any user account added to the blacklist is received, the access request can be refused to be processed or a warning message can be sent to a user terminal that logs in to any user account added to the blacklist. In one embodiment, when the electronic device is a terminal, the electronic device can add the user account corresponding to the positive sample included in the positive sample subset to a blacklist, and send the blacklist to the corresponding server, so that if the server receives an access request from any user account added to the blacklist, the access request can be refused to be processed or a warning message can be sent to a user terminal that logs in to any user account added to the blacklist.
[0066] In another application scenario, the samples included in the sample set are behavioral data for determining whether the corresponding user is a fraudulent insurance user (such as medical data for determining whether the corresponding medical insurance card user is a fraudulent insurance user or behavioral data for determining whether the corresponding insured user is a fraudulent insurance user), the user corresponding to the positive sample included in the positive sample subset is a fraudulent insurance user, and the user corresponding to the negative sample included in the negative sample subset is not a malicious user. In one embodiment, when the electronic device is a server, the server can add the identification information of the user corresponding to the positive sample included in the positive sample subset to the untrustworthy list. Subsequently, for the insurance user recorded in the untrustworthy list, if the insurance request of the insurance user recorded in the untrustworthy list is received, the insurance request can be refused to be processed. When the electronic device is a terminal, the electronic device can add the identification information of the user corresponding to the positive sample included in the positive sample subset to the untrustworthy list, and can send the untrustworthy list to the corresponding server, so that if the server receives the insurance request of the insurance user recorded in the untrustworthy list, the insurance request can be refused to be processed.
[0067] In another application scenario, if the sample set includes the first driving data used to determine whether the corresponding car owner is a risky car owner, the car owner corresponding to the positive sample included in the positive sample subset is a risky car owner, and the car owner corresponding to the negative sample included in the negative sample subset is not a risky car owner. In one embodiment, the electronic device can add the car owner corresponding to the positive sample included in the positive sample subset to the risk list, and obtain the second driving data of the risky car owner to monitor the risky car owner. If the risk level of the risky car owner is determined to be a preset level based on the second driving data, a prompt message is sent to the user terminal of the risky car owner to prompt the risky car owner to pay attention to driving safety.
[0068] visible, Figure 1 In the illustrated embodiment, the electronic device can obtain a sample set to be processed, and use an anomaly detection method to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, thereby classifying the sample set according to the anomaly index of each sample to obtain a positive sample subset and a negative sample subset. The embodiment of the present application can improve the efficiency of sample classification.
[0069] See also Figure 2 , is a flow chart of another sample processing method provided in an embodiment of the present application. The method can be applied to the electronic device mentioned above. Figure 1 Example, Figure 2 The embodiment adds a scenario in which an unsupervised algorithm is used for a supervised algorithm. Specifically, the method may include the following steps:
[0070] S201: Obtain a set of samples to be processed.
[0071] S202: Perform anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set.
[0072] S203. Classify the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes a plurality of positive samples, and the negative sample subset includes a plurality of negative samples.
[0073] Among them, steps S201 to S203 can be found in Figure 1 The steps S101-S103 of the embodiment are not described in detail in the embodiment of the present application.
[0074] S204: Use the positive sample subset and the negative sample subset to train the original supervised learning model to obtain a trained supervised learning model.
[0075] S205. Use the trained supervised learning model to perform classification prediction.
[0076] In step S204-step S205, the electronic device can use the positive sample subset and the negative sample subset to train the original supervised learning model to obtain a trained supervised learning model, and use the trained supervised learning model to perform classification prediction. Among them, supervised learning means training through existing training samples to obtain an optimal model, and then using this model to map all new data samples to corresponding output results, and making a simple judgment on the output results to achieve the purpose of classification.
[0077] In one embodiment, the electronic device can train the original supervised learning model using the positive sample subset and the corresponding first label list, and the negative sample subset and the corresponding second label list to obtain a trained supervised learning model. This method can significantly reduce the manpower and time cost of sample annotation and achieve higher accuracy.
[0078] In one embodiment, the electronic device may perform data screening on the positive sample subset to obtain a screened positive sample subset; the electronic device may also perform data screening on the negative sample subset to obtain a screened negative sample subset. The electronic device may train the original supervised learning model using the screened positive sample subset and the screened negative sample subset to obtain a trained supervised learning model, and use the trained supervised learning model to perform classification prediction.
[0079] In one embodiment, the electronic device can specifically perform data screening on the positive sample subset using a preset feature selection algorithm to obtain a screened positive sample subset. Correspondingly, the electronic device can also perform data screening on the negative sample subset using a preset feature selection algorithm to obtain a screened negative sample subset.
[0080] In one embodiment, the electronic device can use the screened positive sample subset and the corresponding third label list, and the screened negative sample subset and the corresponding fourth label list to train the original supervised learning model to obtain a trained supervised learning model. This method can use an algorithm to initially screen samples, and then use a small amount of manpower to label them, balancing cost and accuracy.
[0081] In one embodiment, the electronic device may use the trained supervised learning model to perform classification prediction as follows: the electronic device uses the data to be predicted as input data of the supervised learning model, and the supervised learning model performs classification prediction based on the data to be predicted to obtain a classification prediction result.
[0082] In one embodiment, the electronic device determines the object (such as a user account, user or car owner) pointed to by each sample in the target sample subset, and obtains the historical abnormality index of the object pointed to by each sample, and the historical abnormality index includes the abnormality index recorded at each time within a preset time range; the electronic device accumulates the historical abnormality index of the object pointed to by each sample, obtains the accumulated result of the abnormality index of the object pointed to by each sample, sets a label for the corresponding sample according to the accumulated result of the abnormality index, and obtains the label list corresponding to the target sample subset. The target sample subset and the corresponding label list can be used to supervise the training process of the learning model. The target sample subset may include a positive sample subset and / or a negative sample subset, or may include a screened positive sample subset and / or a screened negative sample subset.
[0083] In one embodiment, the process of setting a label for the corresponding sample according to the accumulated result of the abnormal index of the object pointed to by each sample may be: the electronic device corrects the original label of the corresponding sample according to the accumulated result of the abnormal index of the object pointed to by each sample, and obtains the corrected label corresponding to the sample. In one embodiment, the electronic device may multiply each abnormal index in the historical abnormal index of the object pointed to by each sample by their respective attenuation coefficients and add them together to obtain the accumulated result of the abnormal index of the object pointed to by each sample. In one embodiment, the attenuation coefficient is related to time. In one embodiment, the electronic device may multiply each abnormal index in the historical abnormal index of the object pointed to by each sample by their respective attenuation coefficients and spatial coefficients and add them together to obtain the accumulated result of the abnormal index of the object pointed to by each sample. In one embodiment, the spatial coefficient is related to the location of the object pointed to by the sample (such as the account login location, the medical insurance use location, or the vehicle driving location), for example, the more abnormal the location, the higher the spatial coefficient. In one embodiment, the electronic device may multiply each abnormal index in the historical abnormal index of the object pointed to by each sample by their respective attenuation coefficients and add them together to obtain the accumulated result of the abnormal index of the object pointed to by each sample.
[0084] visible, Figure 2 In the illustrated embodiment, the electronic device can use the positive sample subset and the negative sample subset to train the original supervised learning model to obtain a trained supervised learning model, and use the trained supervised learning model to perform classification prediction. This process not only makes the sample labeling process simpler, but also avoids the situation where the model makes inaccurate predictions due to possible labeling errors in manual labeling.
[0085] The present application involves blockchain technology, such as extracting sample labels for samples and writing the correspondence between sample labels and anomaly indexes into the blockchain.
[0086] See also Figure 3 , is a schematic diagram of the structure of a sample processing device provided in an embodiment of the present application. The sample processing device can be applied to the electronic device mentioned above. The sample processing device may include:
[0087] The acquisition module 301 is used to acquire a sample set to be processed.
[0088] The detection module 302 is used to perform anomaly detection on each sample in the sample set by using an anomaly detection method to obtain an anomaly index of each sample in the sample set.
[0089] The classification module 303 is used to classify the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes multiple positive samples and the negative sample subset includes multiple negative samples.
[0090] In an optional embodiment, the anomaly detection method is an independent forest-based method, and the detection module 302 uses the anomaly detection method to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, specifically, the sample set is input into the trained independent forest; the root node of each independent tree included in the trained independent forest of each sample in the sample set is traversed to determine the leaf node of each sample in each independent tree, and the anomaly index of each sample is determined according to the root node and the leaf node of each sample in each independent tree.
[0091] In an optional embodiment, the detection module 302 determines the abnormality index of each sample based on the root node and the leaf node of each independent tree where each sample is located, specifically determining the path length of each sample from the root node to the leaf node of each independent tree; and determining the abnormality index of each sample based on the path length of each sample from the root node to the leaf node of each independent tree.
[0092] In an optional embodiment, the detection module 302 determines the abnormality index of each sample based on the path length of each sample from the root node to the leaf node in each independent tree, specifically, according to the path length of each sample from the root node to the leaf node in each independent tree, the average path length of each sample is calculated; based on the average path length of each sample, the abnormality index of each sample is obtained.
[0093] In an optional embodiment, the classification module 303 classifies the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, specifically, determining a plurality of samples in the sample set whose abnormality index is greater than a preset value according to the abnormality index of each sample, and determining the plurality of samples whose abnormality index is greater than the preset value as a plurality of positive samples, and constructing a positive sample subset including the plurality of positive samples; determining a plurality of samples in the sample set whose abnormality index is less than or equal to a preset value according to the abnormality index of each sample, and determining the plurality of samples whose abnormality index is less than or equal to the preset value as a plurality of negative samples, and constructing a negative sample subset including the plurality of negative samples.
[0094] In an optional implementation, the processing module 304 is used to train the original supervised learning model using the positive sample subset and the negative sample subset to obtain a trained supervised learning model; and perform classification prediction using the trained supervised learning model.
[0095] In an optional implementation, the processing module 304 is further configured to perform service processing according to the positive sample subset and the negative sample subset.
[0096] visible, Figure 3 In the illustrated embodiment, the sample processing device can obtain a sample set to be processed, and use an anomaly detection method to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, thereby classifying the sample set according to the anomaly index of each sample to obtain a positive sample subset and a negative sample subset. This method can improve the sample classification efficiency.
[0097] See also Figure 4 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device described in this embodiment may include: one or more processors 1000 and a memory 2000. The processor 1000 and the memory 2000 may be connected via a bus.
[0098] The processor 1000 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0099] The memory 2000 may be a high-speed RAM memory or a non-volatile memory, such as a disk memory. The memory 2000 is used to store a set of program codes, and the processor 1000 may call the program codes stored in the memory 2000. Specifically:
[0100] Processor 1000 obtains a sample set to be processed; performs anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set; classifies the sample set according to the anomaly index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes multiple positive samples, and the negative sample subset includes multiple negative samples.
[0101] In one embodiment, the anomaly detection method is an independent forest-based method, and the processor 1000 uses the anomaly detection method to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, specifically, the sample set is input into the trained independent forest; the root node of each independent tree included in the trained independent forest of each sample in the sample set is traversed to determine the leaf node of each sample in each independent tree, and the anomaly index of each sample is determined according to the root node and the leaf node of each sample in each independent tree.
[0102] In one embodiment, the processor 1000 determines the abnormality index of each sample based on the root node and the leaf node of each independent tree where each sample is located, specifically determining the path length of each sample from the root node to the leaf node of each independent tree; and determining the abnormality index of each sample based on the path length of each sample from the root node to the leaf node of each independent tree.
[0103] In one embodiment, the processor 1000 determines the abnormality index of each sample based on the path length of each sample from the root node to the leaf node in each independent tree, specifically, calculates the average path length of each sample based on the path length of each sample from the root node to the leaf node in each independent tree; and obtains the abnormality index of each sample based on the average path length of each sample.
[0104] In one embodiment, the processor 1000 classifies the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, specifically, determining a plurality of samples in the sample set whose abnormality index is greater than a preset value according to the abnormality index of each sample, and determining the plurality of samples whose abnormality index is greater than the preset value as a plurality of positive samples, and constructing a positive sample subset including the plurality of positive samples; determining a plurality of samples in the sample set whose abnormality index is less than or equal to a preset value according to the abnormality index of each sample, and determining the plurality of samples whose abnormality index is less than or equal to the preset value as a plurality of negative samples, and constructing a negative sample subset including the plurality of negative samples.
[0105] In one embodiment, the processor 1000 is further configured to train the original supervised learning model using the positive sample subset and the negative sample subset to obtain a trained supervised learning model; and perform classification prediction using the trained supervised learning model.
[0106] In one embodiment, the processor 1000 is further configured to perform service processing according to the positive sample subset and the negative sample subset.
[0107] In a specific implementation, the processor 1000 described in the embodiment of the present application may execute Figure 1 Example Figure 2 The implementation method described in the embodiment can also execute the implementation method described in the embodiment of the present application, which will not be repeated here.
[0108] Each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of sampling hardware or sampling software functional modules.
[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the computer-readable storage medium can be volatile or non-volatile. For example, the computer storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM). The computer-readable storage medium can mainly include a storage program area and a storage data area, wherein the storage program area can store an operating system, at least one application required for a function, etc.; the storage data area can store data created according to the use of the blockchain node, etc.
[0110] Among them, the blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0111] What is disclosed above is only a preferred embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiment and equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A sample processing method, It is characterized in that include: Obtain a set of samples to be processed; Performing anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set; The sample set is classified according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes a plurality of positive samples, and the negative sample subset includes a plurality of negative samples; wherein the samples of the sample set include first driving data for determining whether a corresponding car owner is a risky car owner, the car owner corresponding to the positive samples included in the positive sample subset is a risky car owner, and the car owner corresponding to the negative samples included in the negative sample subset is not a risky car owner; Performing data screening on the positive sample subset using a preset feature selection algorithm to obtain a screened positive sample subset, and performing data screening on the negative sample subset using a preset feature selection algorithm to obtain a screened negative sample subset; The original supervised learning model is trained using the screened positive sample subset and the corresponding third label list, as well as the screened negative sample subset and the corresponding fourth label list, to obtain a trained supervised learning model, which is used for classification prediction; wherein, the label list is determined as follows: determine the object pointed to by each sample in the target sample subset, and obtain the historical abnormality index of the object pointed to by each sample, the historical abnormality index includes the abnormality index of each time record within a preset time range; multiply each abnormality index in the historical abnormality index of the object pointed to by each sample by its own attenuation coefficient and spatial coefficient, and then add them to obtain the accumulated result of the abnormality index of the object pointed to by each sample, set a label for the corresponding sample according to the accumulated result of the abnormality index, and obtain the label list corresponding to the target sample subset; the target sample subset includes a positive sample subset and / or a negative sample subset, the spatial coefficient is related to the position of the object pointed to by the sample, and the more abnormal the position, the higher the spatial coefficient, the object includes the car owner, and the position includes the vehicle driving place; Add the car owner corresponding to the positive sample included in the positive sample subset to the risk list, and obtain the second driving data of the risk car owner; If it is determined according to the second driving data that the risk level of the risky vehicle owner is a preset level, a prompt message is sent to the user terminal of the risky vehicle owner to prompt the risky vehicle owner to pay attention to driving safety.
2. The method according to claim 1, It is characterized in that The anomaly detection method is an independent forest-based method, and the anomaly detection method is used to perform anomaly detection on each sample in the sample set to obtain an anomaly index of each sample in the sample set, including: Inputting the sample set into the trained independent forest; The root node of each independent tree included in the independent forest after training of each sample in the sample set is traversed to determine the leaf node of each sample in each independent tree, and the abnormality index of each sample is determined according to the root node and the leaf node of each sample in each independent tree.
3. The method according to claim 2, It is characterized in that Determining the abnormality index of each sample according to the root node and the leaf node where each sample is located in each independent tree includes: Determine the path length of each sample from the root node to the leaf node in each independent tree; The abnormality index of each sample is determined according to the path length of each sample from the root node to the leaf node in each independent tree.
4. The method according to claim 3, It is characterized in that Determining the abnormality index of each sample according to the path length of each sample from the root node to the leaf node in each independent tree includes: Calculate the average path length of each sample according to the path length of each sample from the root node to the leaf node in each independent tree; According to the average path length of each sample, an abnormality index of each sample is obtained.
5. The method according to any one of claims 1 to 4, It is characterized in that The classifying the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset includes: Determine, according to the abnormality index of each sample, a plurality of samples in the sample set whose abnormality index is greater than a preset value, determine the plurality of samples whose abnormality index is greater than the preset value as a plurality of positive samples, and construct a positive sample subset including the plurality of positive samples; According to the abnormality index of each sample, multiple samples in the sample set whose abnormality index is less than or equal to a preset value are determined, and the multiple samples whose abnormality index is less than or equal to the preset value are determined as multiple negative samples, and a negative sample subset including the multiple negative samples is constructed.
6. The method according to claim 1, It is characterized in that The method further comprises: Business processing is performed according to the positive sample subset and the negative sample subset.
7. A sample processing device, It is characterized in that The device is used to perform the method according to any one of claims 1 to 6, and the device comprises: An acquisition module, used to acquire a sample set to be processed; A detection module, configured to perform anomaly detection on each sample in the sample set using an anomaly detection method to obtain an anomaly index of each sample in the sample set; A classification module is used to classify the sample set according to the abnormality index of each sample to obtain a positive sample subset and a negative sample subset, wherein the positive sample subset includes multiple positive samples and the negative sample subset includes multiple negative samples.
8. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the processor and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 6.
