A two-way sampling method for unbalanced production data of SMT production line

By using a bidirectional sampling method, combined with the ClusterCentroids and SMOTE algorithms, the problems of overfitting and high computational cost in imbalanced datasets are solved, achieving a balanced sample set and improved classifier performance.

CN116304714BActive Publication Date: 2026-04-21HOHAI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HOHAI UNIV
Filing Date
2023-03-31
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

When dealing with imbalanced datasets, existing technologies such as SMOTE oversampling are computationally intensive and prone to amplifying noise, while ClusterCentroids undersampling is prone to losing key information, leading to overfitting problems.

Method used

A bidirectional sampling method is adopted, which uses the ClusterCentroids algorithm to retain the majority class cluster core and remove redundant samples, and combines the SMOTE algorithm to oversample the minority class, generate new samples, and adjust the sample set to achieve a balance between the majority and minority classes.

Benefits of technology

It effectively reduces computation time, mitigates the risk of noisy data, improves classifier performance, achieves rapid balance between minority and majority classes, and enhances the accuracy and efficiency of the classifier.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116304714B_ABST
    Figure CN116304714B_ABST
Patent Text Reader

Abstract

The application discloses a kind of two-way sampling methods for unbalanced data, including S1: setting boundary value m, all classes are divided into majority class sample set Smost and minority class sample set Smin with boundary value m;And m is as the target sample quantity of majority class and minority class;S2: using ClusterCentroid algorithm class the sample in majority class sample set is divided into several clusters, and the cluster core is retained and redundant sample is rejected;S3: by SMOTE algorithm to minority class sample oversampling, generate new sample set;S4: the adjusted majority class and minority class sample are merged into new data set.The method takes the average value of majority class and minority class as the target quantity, avoids generating or rejecting too many samples.Compared with ClusterCentroids undersampling, more features are retained, and the risk of overfitting is reduced.Compared with SMOTE oversampling, the application reduces the number of samples that need to be synthesized by the minority class, shortens the calculation time of the classifier, avoids the excessive density of minority class sample points, and reduces the risk of generating meaningless data and noise data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data sampling technology, specifically relating to a bidirectional sampling method for imbalanced data. Background Technology

[0002] With the development of big data technology and the Internet of Things (IoT), machine learning plays an important role in intelligent decision-making, pattern recognition, and optimization. Classification learning is one of the important research directions in machine learning. However, in actual production, the problem of imbalanced datasets will occur. Classifiers constructed based on imbalanced datasets will cause the prediction results to be more biased towards the majority class, while minority class samples are often the important research objects.

[0003] The main methods for addressing data imbalance at the data level are oversampling of the minority class and undersampling of the majority class. The SMOTE algorithm is frequently used for oversampling, which generates new samples among the nearest neighbors in the minority class to increase the sample size and achieve a more balanced sample count. However, this algorithm is somewhat blind in its neighbor selection, resulting in highly overlapping new data, high computational cost, and the new data often doesn't reveal much information and is prone to amplifying noise. For undersampling, ClusterCentroids undersampling based on K-means clustering is highly efficient in reducing the number of samples. It uses cluster cores to replace the data of the entire cluster. However, when the data imbalance rate is high, a small number of cluster centers can lead to the loss of crucial information and overfitting. Summary of the Invention

[0004] The purpose of this invention is to propose a bidirectional sampling method for imbalanced data, which solves the technical problems of large computational load, long classification time, and easy amplification of noise in the existing technology of SMOTE oversampling, and the loss of key information and overfitting caused by ClusterCentroids undersampling.

[0005] To achieve the above objectives, the present invention employs the following solution:

[0006] A bidirectional sampling method for imbalanced data includes the following steps:

[0007] Step S1: Set boundary values m All samples in the class are set to boundary values. m Divide the majority class sample set into Smost and the minority class sample set into Smin; and then... m As the target sample size for the majority and minority classes;

[0008] Step S2: Use the ClusterCentroid algorithm to divide the samples in the majority class sample set into several clusters, retain the cluster cores and remove redundant samples;

[0009] Step S3: Oversample the minority class samples using the SMOTE algorithm to generate new samples;

[0010] Step S4: Merge the adjusted majority and minority class samples into a new dataset.

[0011] Further optimization, in step S1, the boundary value m Obtain the maximum number of samples across all classes using the following method: N max and minimum value N min The average of the two is the dividing line. m All classes are bounded by values m Divided into majority class sample set S most and minority class sample sets S min ; and will m To determine the target number of samples for the majority and minority classes, and to avoid generating or removing too many samples.

[0012] In the formula, round () is the rounding function.

[0013] Further optimization, step S2 specifically includes the following steps:

[0014] Step S2.1: For the majority class sample set S most The k-means++ algorithm is used for clustering to divide them into... m Cluster C = (C1, C2, ..., C m ), C i Indicates the first i Clusters, i ∈[1 ,m ].

[0015] Step S2.2: Retain the cluster core c =( c 1 , c 2 ,…, c m ), remove other data, m Each cluster core forms a new sample set, which serves as the adjusted majority class sample set. NewS most , NewS most =( c 1 , c2 ,…, c i …, c m ), c i Indicates the first i The cluster core of each cluster.

[0016] Further optimization, step S3 specifically includes the following steps:

[0017] Step S3.1: For the minority class sample set S min The Euclidean distance is used to find each sample point. K The nearest neighbor samples, K It is a positive integer greater than or equal to 3. To prevent the line connecting a sample point to its nearest neighbor from passing through the majority class sample space, K It should not be too large.

[0018] Step S3.2: Based on the sample size NumS min and target quantity m Distance setting sampling rate n 1 and n 2 According to the sampling ratio w Random selection t For each sample, randomly select from its K nearest neighbors. n 1 Next, the rest one sample K Randomly selected from the nearest neighbor samples n 2 Second-rate;

[0019] ;

[0020] ;

[0021] ;

[0022] ;

[0023] In the above formula, ceil () is the floor function, such as ceil ( y (greater than) y The smallest integer; f loor () is the floor function, such as f loor ( z (not greater than) z The largest integer.

[0024] Step S3.3: In the minority class sample points x and the neighbors drawn each time x n A new sample is randomly generated on the connection between them. x new .

[0025] In the above formula, rand () is a random function. rand (0,1) represents a random number between 0 and 1.

[0026] Step S3.4: Add the generated sample points to the original sample set to obtain the adjusted minority class sample set. NewS min .

[0027] Further optimization involves setting K to 10. Further optimization also includes balancing the sample set in step S4. NewS ={ NewS most , NewS min}

[0028] Compared with existing technologies, the beneficial effects are:

[0029] In the bidirectional sampling method for imbalanced data proposed in this invention, the average of the majority and minority classes is used as the target number to avoid generating or removing too many samples. Compared to ClusterCentroids undersampling, the proposed SMOTECU sets more cluster centers, retaining more features and reducing the risk of overfitting. Compared to SMOTE oversampling, the proposed SMOTECU reduces the number of minority class samples that need to be synthesized, shortens the classifier's computation time, and avoids excessively dense minority class sample points, thereby reducing the risk of generating meaningless and noisy data. This bidirectional sampling method can efficiently reduce and increase the number of samples, quickly balancing the minority and majority classes, thus improving the classifier's performance. Attached Figure Description

[0030] Figure 1 This is a flowchart of the bidirectional sampling method for imbalanced data described in this invention;

[0031] Figure 2 This is a schematic diagram of a bidirectional sampling method for imbalanced data. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] This embodiment uses a company's SMT production line as the sampling object, collecting operational data on three types of downtime: normal operation, planned downtime, and unplanned downtime. SMT (Surface Mount Technology) is a popular technology and process in the electronics assembly industry. This technology enables electronic products to have a series of advantages such as being lighter, thinner, shorter, smaller, more multifunctional, more reliable, and lower cost. After years of development, SMT technology has become quite mature and is widely used in the electronics manufacturing industries such as computers, communications, consumer electronics, and industrial automation. SMT production line equipment mainly consists of printers, placement machines, and reflow ovens, representing a typical high-volume assembly line production mode.

[0034] like Figure 1 , 2 As shown, a bidirectional sampling method for imbalanced data includes:

[0035] Step S1: Collect operational data for normal operation, unplanned downtime, and planned downtime from the AOI (Auto Optical Inspection) and SPI (Solder Paste Inspection) production lines in the SMT production cluster, and extract imbalance data samples. The data for normal operation includes the processing interval time and pin count difference recorded by the equipment during the fixture's movement on the conveyor belt; the data for unplanned downtime includes the downtime and pin count difference recorded by the equipment when equipment malfunctions or operator error causes unexpected downtime; since this production process involves shift changes without interrupting production, the data for planned downtime includes the downtime and pin count difference recorded by the equipment during order switching and inspection. The imbalance data for the AOI production line includes three sample sets: normal operation, unplanned downtime, and planned downtime; similarly, the imbalance data for the SPI production line also includes three sample sets: normal operation, unplanned downtime, and planned downtime. Due to space limitations, some of the collected data is shown in Table 1.

[0036] Table 1. Sample data from AOI and SPI production lines

[0037] ;

[0038] Extract two features: the interval between the two fixtures and whether the number of solder pins changes.

[0039] Feature 1: The interval between the two jigs

[0040] The start time of the next jig - the start time of the previous jig = the cycle processing time of the previous jig.

[0041] Feature 2: Differences in whether the front and rear continuous jigs have welded FPCs

[0042] If the number of pins per FPC in the previous fixture minus the number of pins in the next fixture equals 0,

[0043] Output = 1;

[0044] Not: Output = 0

[0045] If the number of pins of the FPCs soldered on the two jigs are different, it means that the two jigs belong to different orders. At this time, a production order switch occurs, and the machine stops due to the switch line and inspection, which is a planned downtime process.

[0046] Step S2: Calculate the average number of samples for the three types of downtime in the AOI production line based on the collected data samples. m The average number of samples for the three types of downtime in the SPI production line is 4999. m The value is 3377. m The normal operation is divided into a majority class sample set as the boundary. S most Planned and unplanned shutdowns were categorized into minority sample sets. S min The data structure and imbalance rate collected in the AOI and SPI production lines were calculated respectively, as shown in Table 2. The imbalance rate is the number of samples of the most numerous class / the number of samples of the fewest class.

[0047] Table 2 AOI and SPI Dataset Information

[0048]

[0049] Step S3: Using the average value m To achieve the target number, undersampling using ClusterCentroids was used to divide the normal operation data of the AOI production line into 4999 clusters and the normal operation data of the SPI production line into 3377 clusters. Cluster cores were retained, and redundant samples were removed to obtain the adjusted majority class sample set. NewS most .

[0050] Step S4: Using the average value mTo achieve the target number, SMOTE oversampling is performed on both planned and unplanned shutdown samples.

[0051] Step S4.1: Based on the sample size NumS min and target quantity m Distance setting sampling rate n 1 and n 2 In this embodiment, K =10.

[0052] ;

[0053] ;

[0054] ;

[0055] ;

[0056] For the AOI production line, 127 samples were randomly selected from the 174 samples planned for shutdown, and the sampling rate was set accordingly. n 11 The sampling rate is set to 28 for the remaining samples, and the sampling multiplier is set accordingly. n 12 It is 27. t 1 =127. From the 11 samples collected during unplanned shutdowns, 5 samples were randomly selected and the sampling rate was set. n 21 The sampling rate is set to 454 for the remaining samples. n 22 It is 453. t 2 =5.

[0057] For the SPI production line, 47 samples were randomly selected from the 90 samples planned for shutdown to set the sampling rate. n 13 The sampling rate was set to 37 for the remaining samples, and the sampling multiplier was set accordingly. n 23 It is 36. t 3 =47. Two samples were randomly selected from the three samples from unplanned shutdowns, and the sampling rate was set accordingly. n 14 The sampling factor is set to 1125 for the remaining samples. n 24 It is 1124. t 4 =2.

[0058] Step S4.2: In the minority class sample points xand the neighbors drawn each time x n A new sample is randomly generated on the connection between them. x new .

[0059] ;

[0060] Step S4.3: Add the generated sample points to the original sample set to obtain the adjusted minority class sample set. NewS min .

[0061] Step S5: Merge the processed data to obtain a balanced sample set. NewS ={ NewS most , NewS min Table 3 shows the partial balance sample data for the AOI and SPI production lines.

[0062] Table 3. Partial sample data after processing by the SMOTECU algorithm

[0063]

[0064] Analysis and comparison:

[0065] The processed data is then subjected to Min-Max normalization to control the values ​​between 0 and 1. This is done by dividing the difference between the original data and the minimum value of the sample data by the range.

[0066]

[0067] x’ For the normalized data, x 0 The original data, x min The minimum value of the sample data. x max This is sample data.

[0068] The training and test sets were divided into a 7:3 ratio and fed into three classifiers: Random Forest, RBF network, and RBFSVM. The test was repeated ten times, and the average values ​​of macro-F1, macro-AUC, and running time were calculated. The results were compared with SMOTE oversampling and ClusterCentroids undersampling. Table 4 shows the confusion matrix, and the test results are shown in Tables 5, 6, and 7.

[0069] Table 4 Confusion Matrix

[0070]

[0071] Where TP is the number of true negative cases, FN is the number of false negative cases, FP is the number of false positive cases, TN is the number of true negative cases, TPR is the true positive rate, and FPR is the false positive rate.

[0072] ;

[0073] macro-F1 and macro-AUC are the average F1-score and AUC values ​​for each category.

[0074] Table 5 Comparison of different macro-F1 algorithms

[0075] ;

[0076] Table 6 Comparison of macro-AUC for different algorithms

[0077] ;

[0078] Table 7 Comparison of running times of different algorithms

[0079] ;

[0080] As shown in Table 4-6, the classifier based on the ClusterCentroids algorithm exhibited overfitting (100% accuracy and less than 2 seconds runtime), while the classifiers based on SMOTE and SMOTECU both showed better classification performance. Furthermore, the runtime of the classifier based on SMOTECU was shorter than that of the oversampling classifier based on SMOTE. Among them, the RBF neural network classification model based on SMOTECU had a significant time-saving advantage compared to SMOTE.

[0081] With increasingly fierce market competition, maximizing and improving production efficiency in production workshops is crucial for electronics manufacturers to achieve sustained high economic benefits. However, in today's manufacturing industry, seemingly well-functioning production workshops are not actually operating at their best, and there is significant room for improvement in the value of equipment and operators, resulting in substantial losses for enterprises. By analyzing three types of downtime, companies can understand the utilization efficiency of equipment on the production line, identify areas of efficiency loss, and develop improvement plans. Building an online classification model for these three types of downtime can significantly reduce the manpower and time spent on traditional manual statistical methods and enable real-time statistics for these three types of downtime. Since the number of unplanned downtime samples during operation is extremely small, the data has a high imbalance rate. Therefore, the SMOTECU algorithm proposed in this invention ensures that the machine learning classification model for the three types of downtime has high accuracy and fast response performance.

[0082] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.

Claims

1. A bidirectional sampling method for unbalanced production data of an SMT production line, characterized in that, Collecting running data of AOI and SPI two production lines in SMT production line cluster, including the following steps: Step S1: Set boundary values m All classes are bounded by values m Divide the majority class sample set S most and minority class sample set S min ; and will m As the target sample size for the majority and minority classes; Boundary value m Obtained as follows: find the maximum value of the number of samples in all classes N max And the minimum value N min Take the average of the two as the boundary m Divide all classes into majority class sample set and minority class sample set with boundary value m S most And minority class sample set S min ; and the target number of samples as the majority class and the minority class is m ​​ ; In the formula, round () is a rounding function; Step S2: using ClusterCentroid algorithm class to divide the samples in the majority class sample set into several clusters, retaining the cluster core and removing the redundant samples; Step S3: oversampling the minority class samples through the SMOTE algorithm to generate a new sample set; specifically including the following steps: Step S3.1: For the minority class sample set S min , find the k nearest neighbors of each sample point using the Euclidean distance, K K is a positive integer greater than or equal to 3;​ Step S3.2: setting a sampling rate according to the difference between the number of samples of the minority class sample set and the target number NumS min and the target number m of samples, setting a sampling rate n 1 and n 2 , randomly sampling samples according to the sampling ratio w t , randomly sampling, in each sample, times from the times of nearest neighbor samples of the sample K n 1 , and randomly sampling, in the remaining times of nearest neighbor samples of the sample, times from the times of nearest neighbor samples of the sample K n 2 ​​​​​ ; ; ; ; In the above formula, ceil () is an integer function, ceil ( y ) is the smallest integer greater than y . f loor () is a floor function, f loor ( z ) is the largest integer not greater than z . Step S3.3: In the minority class sample points x and the nearest neighbor sample points selected each time x n A new sample is randomly generated on the connection between them. x new ; ; In the above formulae, rand () is a random function, rand (0,1) denotes a random number between 0 and 1; Step S3.4: Adding the generated sample points to the original sample set to obtain an adjusted minority sample set NewS min ; Step S4: merging the adjusted majority class and minority class samples into a new data set.

2. The bidirectional sampling method of SMT production line unbalanced production data according to claim 1, characterized in that, The step S2, specifically including the following steps: Step S2.1: For the majority class sample set S most , cluster it using the k-means++ algorithm into m clusters C =( C 1 , C 2 ,…, C i …, C m ), C i denotes the i th cluster, i ∈[1 ,m ] Step S2.2: Keep cluster core, reject other data, m The cluster core constitutes a new sample set as the adjusted majority class sample set NewS most , NewS most =( c 1 , c 2 ,…, c i …, c m ), c i represents the cluster core of the i th cluster.

3. The method of claim 2, wherein the SMT production line unbalanced production data bidirectional sampling method is characterized in that, Take K 10.

4. The bidirectional sampling method of unbalanced production data of an SMT production line according to claim 3, characterized in that, In the step S4, the balanced sample set NewS ={ NewS most , NewS min}.

Citation Information

Patent Citations

  • Density-based unbalanced data hybrid sampling algorithm

    CN113378987A