Classification method, device, storage medium and equipment for unbalanced data
The SVM algorithm is used to calculate support vectors and sample distances, and perform downsampling based on support vectors, which solves the problem of removing redundant samples in imbalanced data, improves classification accuracy, and achieves more efficient classification of imbalanced data.
Patent Information
- Application Number
- CN202011584448.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-12-28
AI Technical Summary
Existing imbalanced data classification methods are difficult to effectively remove redundant samples and noise samples when processing imbalanced data, resulting in low classification accuracy. In particular, the sample overlap problem generated by the SMOTE algorithm and the downsampling method fail to fully consider the data distribution. Features.
Calculate the support vector set through the SVM algorithm, calculate the distance between the majority class sample and the support vector, perform downsampling based on distance and sample position statistics, adjust the majority class set, and use the distance measurement data of the support vector to delete redundant samples and improve classification accuracy. .
It effectively deletes redundant majority class samples, improves the classification accuracy of imbalanced data, and improves the performance of the classifier, especially the performance on imbalanced data sets.
Smart Images

Figure CN112579711B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to a method, device, storage medium and equipment for classifying imbalanced data. Background Art
[0002] There are two main approaches to the problem of imbalanced data classification: data level and algorithm level. Data level methods include upsampling and downsampling, which can reduce the imbalance and improve the classification effect by changing the data distribution; algorithm level methods can improve the classification accuracy by analyzing the defects of existing algorithms in processing imbalanced data, improving the algorithms or proposing new algorithms, such as cost-sensitive learning and ensemble learning.
[0003] At present, most of the improved models based on the SMOTE (Synthetic Minority Oversampling Technique) algorithm are used in the study of imbalanced data. However, the SMOTE algorithm will cause overlap in the generated samples of the minority class, because the generated samples are randomly generated from the minority class samples, ignoring the distribution characteristics of the adjacent samples. For example, SVM SMOTE sampling generates new samples based on the hyperplane of SVM, and Borderline SMOTE sampling generates samples near the boundary points of the minority class. The above upsampling methods reduce the imbalance between classes by increasing the number of minority class samples.
[0004] Downsampling refers to reducing the number of majority class samples to reduce the imbalance between classes, and using some indicators to select samples from the majority class that are equivalent to the number of minority class samples. However, some current methods have not been able to ensure that only redundant samples and noise samples are removed, and the classification accuracy is low.
[0005] Therefore, when solving the imbalanced classification problem at the data level, it is important to measure the degree of imbalance in data distribution between the minority class and the majority class. How to increase the effective minority class sample data and delete the redundant majority class sample data has important research value. Summary of the invention
[0006] The technical problem to be solved by the embodiments of the present invention is: to provide a classification method, device, storage medium and equipment for imbalanced data, use the distance between the data sample and the support vector to measure the local density information of the data sample, consider the imbalance degree of the data from the distribution, and improve the accuracy of imbalanced data classification.
[0007] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a classification method for imbalanced data, the method comprising the following steps:
[0008] Obtain an unbalanced data set; wherein the unbalanced data set includes a majority class set and a minority class set;
[0009] Calculate the support vector set of the imbalanced data set by using the SVM algorithm;
[0010] Calculate a first distance from each sample in the majority class set to each support vector in the support vector set;
[0011] Calculate sample position statistics according to the first distance;
[0012] Calculate the class position statistic according to the sample position statistic;
[0013] The majority class set is downsampled according to the class bit statistics to obtain a downsampled majority class set.
[0014] As a preferred solution, the calculation formula of the first distance is:
[0015]
[0016] In formula (1), c -1 is the majority class set, x i ∈c -1 Represents x i c -1 The elements in x i is the i-th sample in the majority class set, x i =(x i1 ,x i2 ,…,x in ), s j is the jth support vector in the support vector set, s i =(s i1 ,s i2 ,…,s in ), d(x i ,s j ) is the first distance between the i-th sample in the majority class sample and the j-th support vector in the support vector set.
[0017] As a preferred solution, the calculation formula of the sample position statistic is as follows:
[0018]
[0019] In formula (2), Q k (s) is x i The set of k nearest neighbor support vectors, s j ∈Q k (s) means s j Q kThe elements in (s), μ k (x i ) is the sample position statistic of the i-th sample in the majority class set.
[0020] As a preferred solution, the calculation formula of the class bit statistic is as follows:
[0021]
[0022] In formula (3), w i is the class statistic of the i-th sample in the majority class set.
[0023] As a preferred solution, downsampling the majority class set according to the class bit statistics specifically includes:
[0024] The samples in the majority class set are sorted by w i Sort by size and divide into two parts according to the median;
[0025] w i The smaller part, downsampling (m -1 -m1)m1 / m -1 samples; where m1 is the number of samples in the minority class set, m -1 is the number of samples in the majority class set;
[0026] w i The larger part, downsampling (m -1 -m1)(1-m1 / m -1 ) samples.
[0027] As a preferred solution, the method further comprises:
[0028] The classification results are evaluated using the confusion matrix.
[0029] In order to solve the above technical problems, in a second aspect, an embodiment of the present invention provides a classification device for unbalanced data, the device comprising:
[0030] A data acquisition module, used to acquire an unbalanced data set; wherein the unbalanced data set includes a majority class set and a minority class set;
[0031] A support vector calculation module, used for calculating a support vector set of the imbalanced data set by using a SVM algorithm;
[0032] A first distance calculation module, used to calculate a first distance from each sample in the majority class set to each support vector in the support vector set;
[0033] A sample position statistics calculation module, used to calculate the sample position statistics according to the first distance;
[0034] A class position statistic calculation module, used for calculating the class position statistic according to the sample position statistic;
[0035] A downsampling module is used to downsample the majority class set according to the class bit statistics to obtain a downsampled majority class set.
[0036] As a preferred solution, the device further comprises:
[0037] The evaluation module is used to evaluate the classification results through the confusion matrix.
[0038] In order to solve the above technical problems, in a third aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed, the classification method for unbalanced data as described in any one of the first aspects is implemented.
[0039] In order to solve the above technical problems, in a fourth aspect, an embodiment of the present invention provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and configured to be executed by the processor, wherein the computer program, when executed by the processor, implements the classification method for unbalanced data as described in any one of the first aspects.
[0040] Compared with the prior art, the embodiments of the present invention provide a method, device, storage medium and equipment for classifying imbalanced data, which have the following beneficial effects: first, an imbalanced data set is obtained, and then a support vector set of the imbalanced data set is calculated by a SVM algorithm, and then a first distance from each sample in the majority class set to each support vector in the support vector set is calculated, and then the sample position statistic is calculated again according to the first distance, and then the class position statistic is calculated according to the sample position statistic, and finally the majority class set is downsampled according to the class position statistic to obtain the downsampled majority class set; the local density information of the data sample is measured by the distance between the data sample and the support vector, the imbalance degree of the data is considered from the distribution, and the imbalanced classification data is subjected to support vector-based downsampling, which can effectively delete redundant majority class samples and improve the accuracy of imbalanced data classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical features of the embodiments of the present invention, the drawings required for use in the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 It is a flow chart of a preferred embodiment of a method for classifying imbalanced data provided by the present invention;
[0043] Figure 2 It is a structural schematic diagram of a preferred embodiment of a classification device for imbalanced data provided by the present invention;
[0044] Figure 3 It is a structural schematic diagram of a preferred embodiment of a terminal device provided by the present invention. DETAILED DESCRIPTION
[0045] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, the specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and examples. The following examples are only used to illustrate the present invention, but are not intended to limit the scope of protection of the present invention. Based on the embodiments of the present invention, other embodiments obtained by those skilled in the art without paying creative work should all belong to the scope of protection of the present invention.
[0046] In the description of the present invention, it should be understood that the numbers themselves, such as "first", "second", etc., are only used to distinguish the objects described, have no sequential or technical meaning, and cannot be understood as stipulating or implying the importance of the objects described.
[0047] It should be noted that with the rapid development of my country's economy, the demand for electricity in society is increasing. In order to ensure the normal operation of transmission lines, it is of great significance to correctly classify common faults. The faults of common transmission lines are collected using technologies such as the power Internet of Things and drone information collection systems. The data shows that due to the randomness of transmission line faults, the defect data is limited, and the uncertainty of the number of occurrences of various types of faults leads to an unbalanced amount of data for various types of faults. In view of the characteristics of transmission line faults and the defects of existing fault classification methods, it is of great research value to study more effective transmission line fault classification technology.
[0048] Figure 1 The figure is a flow chart of a preferred embodiment of a method for classifying imbalanced data provided by the present invention.
[0049] like Figure 1 As shown, the method comprises the following steps:
[0050] S11: Obtain an unbalanced data set; wherein the unbalanced data set includes a majority class set and a minority class set;
[0051] S12: Calculate the support vector set of the imbalanced data set by using the SVM algorithm;
[0052] S13: Calculate a first distance from each sample in the majority class set to each support vector in the support vector set;
[0053] S14: Calculating sample position statistics according to the first distance;
[0054] S15: Calculating class position statistics according to the sample position statistics;
[0055] S16: Down-sample the majority class set according to the class bit statistics to obtain a down-sampled majority class set.
[0056] Specifically, in an embodiment of the present invention, the classification method is applied to transmission line fault classification.
[0057] As an example, the bird nest dataset and the insulator dataset are selected as examples. The positive class of the bird nest dataset is the data with bird nests, and the negative class is the data without bird nests; the positive class of the insulator dataset is the data of damaged insulators, and the negative class is the data of normal insulators.
[0058] First, we obtain an unbalanced dataset T = {(x1,y1),(x2,y2),…,(x N ,y N ), where x i ∈R n , is the i-th sample, and any sample in the unbalanced data set T is represented by x i =(x i1 ,x i2 ,…,x in ), y i ∈{+1,-1},i=1,2,…N,y i is the class label, +1 is a positive example, -1 is a negative example. The dataset T is divided into the minority class set c1 and the majority class set c according to the label. -1 , the number of which is recorded as m1 and m respectively -1 , and initialize Among them, the positive and negative classification table of the data set is shown in Table 1.
[0059] Table 1
[0060]
[0061] Then, the support vector set S of the data set T is calculated by the SVM algorithm, where |S| represents the number of support vectors and any support vector is represented by s i =(s i1 ,s i2 ,…,s in ).
[0062] Next, calculate the majority class set C -1 For each sample x in i To each support vector s in the support vector set S i The first distance, each sample x i |S| distances are calculated respectively. In this embodiment, the Euclidean distance is used to calculate the first distance, that is, the calculation formula of the first distance is:
[0063]
[0064] In formula (1), c -1 is the majority class set, x i ∈c -1 Represents x i c -1 The elements in x i is the i-th sample in the majority class set, x i =(x i1 ,x i2 ,…,x in ), s j is the jth support vector in the support vector set, s i =(s i1 ,s i2 ,…,s in ), d(x i ,s j ) is the first distance between the i-th sample in the majority class sample and the j-th support vector in the support vector set.
[0065] Again, the sample position statistics are calculated according to the first distance. In this embodiment of the present invention, the i-th sample x of a given data set is i , define a sample position statistic based on the support vector, the calculation formula of the sample position statistic is as follows:
[0066]
[0067] In formula (2), Q k (s) is x i The set of k nearest neighbor support vectors, s j ∈Q k (s) means s j Q k The elements in (s), μ k (x i ) is the sample position statistic of the i-th sample in the majority class set, μ k (x i ) expresses the i-th sample x i Nearby density information.
[0068] Next, the class position statistic is calculated according to the sample position statistic. The calculation formula of the class position statistic is as follows:
[0069]
[0070] In formula (3), w i is the class statistic of the i-th sample in the majority class set, w i is x i In c -1 The proportion of the total density reflects the x i The intra-class density, x i The higher the density nearby, the greater the i and μ k (x i ) is smaller.
[0071] Finally, the majority class set is downsampled according to the class position statistics to obtain the downsampled majority class set, which specifically includes:
[0072] The samples in the majority class set are sorted by w i Sort by size and divide into two parts according to the median;
[0073] w i The smaller part, downsampling (m -1 -m1)m1 / m -1 samples; where m1 is the number of samples in the minority class set, m -1 is the number of samples in the majority class set;
[0074] w i The larger part, downsampling (m -1 -m1)(1-m1 / m -1 ) samples.
[0075] Among them, w i The smaller part indicates that the support vectors around this sample are dense. Excessive downsampling in this area will reduce the diversity of the majority class samples and increase the risk of misclassifying multi-class samples. On the contrary, w i The larger part indicates that the support vectors around this sample are relatively sparse. Appropriate downsampling in this area can effectively reduce the number of multi-class samples and has a lower impact on the classification accuracy.
[0076] In a preferred embodiment, the method further comprises:
[0077] S17: Evaluate the classification results through the confusion matrix.
[0078] Specifically, the samples that are actually positive are divided into two parts: predicted positive and predicted negative, and the samples that are actually negative are divided into two parts: predicted negative and predicted positive. Their numbers are abbreviated as: TP, FP, TN, FN, and the confusion matrix is shown in Table 2.
[0079] Table 2
[0080]
[0081] The classification effect is evaluated by the following indicators:
[0082] Indicates the classification ability of the classifier for the overall samples;
[0083] Represents the precision of the classifier;
[0084] It represents the recall rate of the classifier and the accuracy rate of the minority class samples;
[0085] Consider both the precision and recall of the minority class.
[0086] The above evaluation indicators have different focuses. The larger the value of each indicator, the better the classification effect. In the imbalanced classification problem, the focus is on F1. The larger the F1 value, the better the classification performance of minority class samples.
[0087] The experimental data are analyzed and processed to evaluate the classification performance of the present invention on unbalanced data. The comparison results of the evaluation indicators of the Bird's Nest dataset on each algorithm are shown in Table 3, and the comparison results of the evaluation indicators of the insulator dataset on each algorithm are shown in Table 4.
[0088] Table 3
[0089]
[0090] Table 4
[0091]
[0092] From the comparison of Table 3 and Table 4, it can be seen that the various evaluation indicators of the classification method of the present invention are higher than those of the original data and other algorithms, indicating that the method of the present invention has better performance in the problem of imbalanced data classification.
[0093] It should be understood that the present invention implements all or part of the processes in the above-mentioned unbalanced data classification method, and can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned unbalanced data classification method can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0094] Figure 2 The figure shows a schematic diagram of the structure of a preferred embodiment of a device for classifying unbalanced data provided by the present invention. The device can implement the entire process of the method for classifying unbalanced data described in any of the above embodiments.
[0095] like Figure 2 As shown, the device comprises:
[0096] The data acquisition module 21 is used to acquire an unbalanced data set; wherein the unbalanced data set includes a majority class set and a minority class set;
[0097] A support vector calculation module 22, used for calculating a support vector set of the imbalanced data set by using an SVM algorithm;
[0098] A first distance calculation module 23, used to calculate a first distance from each sample in the majority class set to each support vector in the support vector set;
[0099] A sample position statistics calculation module 24, configured to calculate the sample position statistics according to the first distance;
[0100] A class position statistics calculation module 25, used to calculate the class position statistics according to the sample position statistics;
[0101] The downsampling module 26 is configured to downsample the majority class set according to the class bit statistics to obtain a downsampled majority class set.
[0102] Specifically, in an embodiment of the present invention, the classification device is applied to transmission line fault classification.
[0103] Preferably, the calculation formula of the first distance is:
[0104]
[0105] In formula (1), c -1 is the majority class set, x i ∈c -1 Represents x i c -1 The elements in x i is the i-th sample in the majority class set, x i =(x i1 ,x i2 ,…,x in ), s j is the jth support vector in the support vector set, s i =(s i1 ,s i2 ,…,s in ), d(x i ,s j ) is the first distance between the i-th sample in the majority class sample and the j-th support vector in the support vector set.
[0106] Preferably, the calculation formula of the sample position statistic is as follows:
[0107]
[0108] In formula (2), Q k (s) is x i The set of k nearest neighbor support vectors, s j ∈Q k (s) means s j Q k The elements in (s), μ k (x i ) is the sample position statistic of the i-th sample in the majority class set, μ k (x i ) expresses the i-th sample x i Nearby density information.
[0109] Preferably, the calculation formula of the class bit statistic is as follows:
[0110]
[0111] In formula (3), w i is the class statistic of the i-th sample in the majority class set, wi is x i In c -1 The proportion of the total density reflects the x i The intra-class density, x i The higher the density nearby, the greater the i and μ k (x i ) is smaller.
[0112] Preferably, the downsampling module 26 is specifically used for:
[0113] The samples in the majority class set are sorted by w i Sort by size and divide into two parts according to the median;
[0114] w i The smaller part, downsampling (m -1 -m1)m1 / m -1 samples; where m1 is the number of samples in the minority class set, m -1 is the number of samples in the majority class set;
[0115] w i The larger part, downsampling (m -1 -m1)(1-m1 / m -1 ) samples.
[0116] Preferably, the device further comprises:
[0117] The evaluation module 27 is used to evaluate the classification result through the confusion matrix.
[0118] Figure 3 The figure shows a schematic diagram of the structure of a preferred embodiment of a terminal device provided by the present invention, and the terminal device can implement the entire process of the unbalanced data classification method described in any of the above embodiments.
[0119] like Figure 3 As shown, the device includes a memory 31 and a processor 32; wherein the memory 32 stores a computer program, and the computer program is configured to be executed by the processor 31, and when executed by the processor 31, implements the classification method for unbalanced data as described in any of the above embodiments.
[0120] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 32 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the terminal device.
[0121] The processor 32 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 any conventional processor, etc.
[0122] The memory 31 can be used to store the computer program and / or module, and the processor 32 realizes various functions of the terminal device by running or executing the computer program and / or module stored in the memory 31, and calling the data stored in the memory 31. The memory 31 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 31 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0123] It should be noted that the above terminal device includes, but is not limited to, a processor 32 and a memory 31. Those skilled in the art can understand that Figure 3 The structural diagram is merely an example of the above-mentioned terminal device and does not constitute a limitation on the terminal device. The terminal device may include more components than shown in the figure, or a combination of certain components, or different components.
[0124] The embodiments of the present invention provide a method, device, storage medium and equipment for classifying imbalanced data. First, an imbalanced data set is obtained. Then, a support vector set of the imbalanced data set is calculated by a SVM algorithm. Next, a first distance from each sample in a majority class set to each support vector in a support vector set is calculated. Then, a sample position statistic is calculated based on the first distance. Then, a class position statistic is calculated based on the sample position statistic. Finally, the majority class set is downsampled based on the class position statistic to obtain a downsampled majority class set. The distance between the data sample and the support vector is used to measure the local density information of the data sample. The imbalance degree of the data is considered from the distribution perspective. Downsampling based on the support vector is used for the imbalanced classification data. This can effectively delete redundant majority class samples and improve the accuracy of imbalanced data classification.
[0125] The above description is only a preferred embodiment of the present invention, but the protection scope of the present invention is not limited thereto. It should be pointed out that for those skilled in the art, several equivalent obvious variations and / or equivalent substitutions can be made without departing from the technical principles of the present invention. These obvious variations and / or equivalent substitutions should also be regarded as the protection scope of the present invention.
Claims
1. A classification method for imbalanced data, characterized in that: The method comprises: Obtain an unbalanced data set; wherein the unbalanced data set includes a majority class set and a minority class set; Calculate the support vector set of the imbalanced data set by using the SVM algorithm; Calculate a first distance from each sample in the majority class set to each support vector in the support vector set; Calculate sample position statistics according to the first distance; Calculate the class position statistic according to the sample position statistic; Down-sampling the majority class set according to the class bit statistics to obtain a down-sampled majority class set; Wherein, the classification method is applied to the classification of power transmission line faults; the unbalanced data set includes but is not limited to the bird's nest data set and the insulator data set; The categories of the bird nest data set include data with bird nests and data without bird nests; if the number of the data with bird nests is greater than the number of the data without bird nests, the data with bird nests is the majority class set of the bird nest data set; if the number of the data with bird nests is less than the number of the data without bird nests, the data with bird nests is the minority class set of the bird nest data set; The categories of the insulator data set include insulator damage data and normal insulator data; if the number of the insulator damage data is greater than the number of the normal insulator data, the insulator damage data is the majority class set of the insulator data set; if the number of the insulator damage data is less than the number of the normal insulator data, the insulator damage data is the minority class set of the insulator data set; The calculation formula of the first distance is: In formula (1), c -1 is the majority class set, x i ∈c -1 Represents x i c -1 The elements in x i is the i-th sample in the majority class set, x i =(x i1 ,x i2 ,…,x in ), s j is the jth support vector in the support vector set, s i =(s i1 ,s i2 ,…,s in ), d(x i ,s j ) is the first distance between the i-th sample in the majority class sample and the j-th support vector in the support vector set; The calculation formula of the sample location statistic is as follows: In formula (2), Q k (s) is x i The set of k nearest neighbor support vectors, s j ∈Q k (s) means s j Q k The elements in (s), μ k (x i ) is the sample position statistic of the i-th sample in the majority class set; The calculation formula of the class bit statistic is as follows: In formula (3), w i is the class statistic of the i-th sample in the majority class set.
2. The method for classifying imbalanced data according to claim 1, characterized in that: The downsampling of the majority class set according to the class bit statistics specifically includes: The samples in the majority class set are sorted by w i Sort by size and divide into two parts according to the median; w i The smaller part, downsampling (m -1 -m1)m1 / m -1 samples; where m1 is the number of samples in the minority class set, m -1 is the number of samples in the majority class set; w i The larger part, downsampling (m -1 -m1)(1-m1 / m -1 ) samples.
3. A method for classifying imbalanced data according to any one of claims 1 to 2, characterized in that: The method further comprises: The classification results are evaluated using the confusion matrix.
4. A classification device for imbalanced data, characterized in that: The device comprises: A data acquisition module, used to acquire an unbalanced data set; wherein the unbalanced data set includes a majority class set and a minority class set; A support vector calculation module, used for calculating a support vector set of the imbalanced data set by using a SVM algorithm; A first distance calculation module, used to calculate a first distance from each sample in the majority class set to each support vector in the support vector set; A sample position statistics calculation module, used to calculate the sample position statistics according to the first distance; A class position statistic calculation module, used for calculating the class position statistic according to the sample position statistic; A downsampling module, used for downsampling the majority class set according to the class bit statistics to obtain a downsampled majority class set; Wherein, the classification device is applied to the classification of power transmission line faults; the unbalanced data set includes but is not limited to the bird's nest data set and the insulator data set; The categories of the bird nest data set include data with bird nests and data without bird nests; if the number of the data with bird nests is greater than the number of the data without bird nests, the data with bird nests is the majority class set of the bird nest data set; if the number of the data with bird nests is less than the number of the data without bird nests, the data with bird nests is the minority class set of the bird nest data set; The categories of the insulator data set include insulator damage data and normal insulator data; if the number of the insulator damage data is greater than the number of the normal insulator data, the insulator damage data is the majority class set of the insulator data set; if the number of the insulator damage data is less than the number of the normal insulator data, the insulator damage data is the minority class set of the insulator data set; The calculation formula of the first distance is: In formula (1), c -1 is the majority class set, x i ∈c -1 Represents x i c -1 The elements in x i is the i-th sample in the majority class set, x i =(x i1 ,x i2 ,…,x in ), s j is the jth support vector in the support vector set, s i =(s i1 ,s i2 ,…,s in ), d(x i ,s j ) is the first distance between the i-th sample in the majority class sample and the j-th support vector in the support vector set; The calculation formula of the sample location statistic is as follows: In formula (2), Q k (s) is x i The set of k nearest neighbor support vectors, s j ∈Q k (s) means s j Q k The elements in (s), μ k (x i ) is the sample position statistic of the i-th sample in the majority class set; The calculation formula of the class bit statistic is as follows: In formula (3), w i is the class statistic of the i-th sample in the majority class set.
5. The imbalanced data classification device according to claim 4, characterized in that: The device also includes: The evaluation module is used to evaluate the classification results through the confusion matrix.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method for classifying unbalanced data according to any one of claims 1 to 3 is implemented.
7. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a computer program stored in the memory and configured to be executed by the processor, and when the computer program is executed by the processor, the method for classifying unbalanced data according to any one of claims 1 to 3 is implemented.
