Data processing method and device based on clustering least square method

By combining the clustering algorithm with the least squares algorithm and using the error feedback mechanism to eliminate abnormal data, the existing least squares method's fitting accuracy and ill-conditioned problems in large-scale data processing are solved, and more accurate data fitting results are achieved. .

CN118626758APending Publication Date: 2024-09-10CHENGDU JOVIAN TECH EXPL +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410646317.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-10

Smart Images

  • Figure CN118626758A
    Figure CN118626758A
Patent Text Reader

Abstract

The invention discloses a data processing method and device based on a clustering least square method, and belongs to the field of data processing.The method comprises the steps that a clustering algorithm and a least square algorithm are fused through a computer program; a J (mk) value selection range of the clustering algorithm program module is controlled through error feedback of an output result of the least square algorithm program module and actual data in the computer, so that abnormal data is eliminated by utilizing the clustering algorithm program module, and a least square fitting result is closer to a target value; wherein J (mk) represents the sum of squares of the distance from the k-class objects mk to the clustering center; the data comprises aviation integrated electronic information equipment test data, and the aviation integrated electronic information equipment test data is input into a computer running the program through a computer input unit. The method is simple and high in realizability, and data processing can be more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and more specifically, to a data processing method and device based on clustering least squares method. Background Art

[0002] In many research areas such as scientific experiments, computer image processing, and signal processing, data processing is involved. In order to analyze the relationship between things, predict future trends, and make reasonable decisions, data fitting must be performed. Data fitting is widely used in many fields, so it has always been a hot topic. Its essence is to fit the curves and surfaces of data through given discrete data points, and use smooth curves and surfaces to approximate these discrete points, so as to achieve better fitting results. It is an important research topic in mathematics and other disciplines.

[0003] The least square method of curve fitting is to use polynomial function for fitting and give up making the required function strictly pass through each given point (x i ,y i ) requirements, only requires the fitting curve to reflect the basic relationship of the data, which can eliminate the error of the measurement data itself to a certain extent, and is widely used in actual engineering data processing. The core content of the least squares method of data fitting is: according to the given data set (x i ,y i )(i=0,1,...,m) selects the approximate function form, that is, given the function class Φ, find the function f(x)∈Φ so that the error v i =f(x i )-y i The sum of squares of (i=0,1,...,m) is the smallest, that is:

[0004]

[0005] In geometric terms, it is to find the i ,y i The curve y=f(x) with the smallest sum of squares of distances between )(i=0,1,...,m) is Figure 1 As shown. The function f(x) is called the fitting function or the least squares solution, and the method of finding the fitting function f(x) is called the least squares method of curve fitting. Figure 1 It can be seen that the original data points are evenly distributed on both sides of the fitting curve f(x), and reflect the trend and characteristics of data changes. By using the least squares method to analyze the measured data, an approximate function form can be fitted based on the measured data to obtain a relatively accurate solution. In practical problems, due to the different observation accuracy of each point, weighted variance is often introduced.

[0006] The advantages of the least squares method are: Least squares curve fitting is a common method for measuring data processing. The best square approximation can approximate the function more evenly in an interval, and has the advantages of being simple, time-effective, and widely used, and can be easily implemented through a simple computer program. When the regression model meets the assumed conditions, the least squares method is used to estimate its regression parameters with good statistical properties, such as unbiasedness, consistency, and minimum variance.

[0007] The disadvantage of the least squares method is that since the amount of data to be processed in actual engineering tests is very large, if the least squares method is applied to the entire measurement data for one-time fitting, its fitting accuracy will be difficult to guarantee. The least squares method based on gradient information can easily fall into the local optimum, and the fitted function sometimes cannot meet the actual requirements. The actual test data vary greatly, and the purpose of data fitting for the test data is also different, so the results of data fitting using the least squares method often fail to meet the expected requirements. For example, due to occasional gross errors, outliers appear, or the probability distribution of the data deviates from the normal distribution. At this time, the fitting results using the least squares method will lose their good statistical properties. On the other hand, when the order of the normal equation is high, it often becomes ill-conditioned, so it must be treated with caution and handled skillfully. One of the effective methods is to introduce orthogonal polynomials to improve its ill-conditioned properties.

[0008] However, the prior art has the following technical problems: the accuracy needs to be improved. Summary of the invention

[0009] The purpose of the present invention is to overcome the deficiencies of the prior art and to provide a data processing method and device based on the least squares method of clustering, which can make data processing more accurate.

[0010] The object of the present invention is achieved through the following solutions:

[0011] A data processing method based on the least squares method of clustering comprises the following steps:

[0012] The clustering algorithm and the least squares algorithm are integrated by computer program, and the error feedback between the output result of the least squares algorithm program module and the actual data is used to control the J(m k ) value selection range, so as to use the clustering algorithm program module to eliminate abnormal data, so that the least squares fitting result is closer to the target value; Among them, J(m k ) represents an object m of class k k The sum of squares of distances to cluster centers; the data includes aviation integrated electronic information equipment test data, and the aviation integrated electronic information equipment test data is input into a computer running the program through a computer input unit.

[0013] Furthermore, the clustering algorithm and the least squares algorithm are integrated by using a computer program, and the error feedback between the output result of the least squares algorithm program module and the actual data is used to control the J(m k ) value selection range, so as to use the clustering algorithm program module to eliminate abnormal data, so that the least squares fitting result is closer to the target value, which specifically includes the following sub-steps:

[0014] Step 1, assuming that the input data of n samples are (x1, p1, ..., q1), (x2, p2, ..., q2), ..., (xn, pn, ..., qn), and the test output data are y1, y2, ...yn, where n = [1, 2, ...] represents the sampling point; x, p, ..., q represents m different input feature parameters;

[0015] Step 2, the input data (x, p, ..., q) enters the clustering algorithm program module for processing through the computer input unit;

[0016] Step 3: The clustering algorithm program module outputs data to the least squares algorithm program module. The least squares algorithm program module obtains the corresponding fitting function z=f(x,p,...,q) according to the algorithm principle, and the test results z1,z2,...z n Output;

[0017] Step 4, z1,z2,...z n With test data y1,y2,...y n Enter the mean square error calculation program module to calculate the mean square error E:

[0018]

[0019] Step 5: When the E value meets the error requirement, the unit least squares method results z1, z2, ... z are output by computer. n Direct output; if the error requirement is not met, E is fed back to the clustering algorithm program module to correct J(m k ) requirement range. If the E value is large, reduce J(m k ) and increase the elimination points; if the E value is small, expand J(m k ) so that more useful data can be fitted into the least squares program module.

[0020] Furthermore, the input data (x, p, ..., q) enters the clustering algorithm module through the computer input unit for processing, which specifically includes the following sub-steps:

[0021] Step a), cluster each parameter set (x, p, ..., q) separately, that is, select k1, k2, ..., km data points and record them as [C1, C2, ..., C ki ], i = 1, ..., m, m represents the number of different input feature parameters of x, p, ..., q, as the center of each of the ki categories;

[0022] Step b), for each parameter set (x, p, ..., q), calculate the Euclidean distance from the remaining elements to the center of the ki class, and each data is assigned to the class closest to it. The Euclidean distance calculation formula is:

[0023] d ji =|a j -C ki |a∈[x,p,...,q];

[0024] i=1,…,m, represents the number of different input feature parameters; j=1,…,n, represents the number of sampling points;

[0025] Step c), for each parameter set (x, p, ..., q), first calculate the mean of all objects in each class as the new cluster center r according to the clustering results. ki , and then calculate the sum of the squares of the distances of all objects from the cluster center of their category, that is, the J value:

[0026]

[0027] Step d), calculate the effect evaluation function:

[0028]

[0029] in:

[0030] d kj =1, a j ∈r ki ;

[0031] d kj =0,a j Not r ki ;

[0032] kx=[k1,k2,...km];

[0033] Step f), determine J(m k ) whether it meets the user's requirements, if so, the data is output from the module; if not, according to D = || a j -r ki || 2 Sort, remove D=||a j -r ki || 2large data point, and then re-enter step b) until J(m k ) meets the requirements, and the data is output from the clustering algorithm module.

[0034] Furthermore, in step 1, the collected data of the corresponding scene is input for the application scenario requiring data fitting; the corresponding scene includes machine learning, digital twin system, artificial intelligence and machine vision.

[0035] Furthermore, in step a), ki data points [C1, C2, …, C ki ] is not required to come from sample data points.

[0036] Further, in step f), the user requirement may set a requirement range.

[0037] A data processing device based on clustering least squares method comprises a processor and a memory. A program is stored in the memory. When the program is loaded by the processor, the data processing method based on clustering least squares method as described in any one of the above items is executed.

[0038] The beneficial effects of the present invention include:

[0039] The method of the present invention is simple and highly feasible. By introducing the mechanism of error feedback control, the least squares algorithm and the clustering algorithm are closely combined, and J(m k ) value range, so that the output result of the least squares algorithm is closer to the actual demand, thus making the final data processing more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0041] Figure 1 is the least squares fitting curve graph;

[0042] Figure 2 It is a schematic diagram of a method according to an embodiment of the present invention;

[0043] Figure 3 It is the UVPA noise coefficient test data curve;

[0044] Figure 4 This is the first output result of the least squares method;

[0045] Figure 5Schematic diagram of clustering algorithm to remove points with large errors in UVPA noise coefficient test data;

[0046] Figure 6 This is the second output result of the least squares method;

[0047] Figure 7 This is the final output result of the least squares method;

[0048] Figure 8 is the mean square error curve of 7 iterations. DETAILED DESCRIPTION

[0049] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.

[0050] In view of the problems in the background, the inventors of the present invention further discovered after creative thinking:

[0051] K-means clustering algorithm is a classic and effective algorithm in cluster analysis. This algorithm is based on the idea of ​​partitioning. Assume that the original data set is d-dimensional, and the original data set is X = {x i |x i ∈R d ,i=1,2,...,N}. Through cluster analysis, the original data is clustered into k categories, and k categories are recorded as m k (k=1,2,...,K). Each class has a cluster center, and the cluster center of each class is c k (k=1,2,...,K), then the sum of the squares of the distances from objects in each class to the cluster center is:

[0052]

[0053] Cluster analysis is to minimize the sum of squares of distances from objects of all classes to the cluster center, so the function for effect evaluation is:

[0054]

[0055] in:

[0056] d ki =1,x i ∈c i

[0057] d ki =0,x i For others

[0058] By preprocessing the original data set through the K-means clustering algorithm process, the data will be divided into k categories, and each data will be assigned to the class closest to it. Then, we can calculate the Euclidean distance from each object to the cluster center and select the largest distance as the outlier. Therefore, the data is clustered into classes through the clustering algorithm, and those data that do not belong to the task class are outliers.

[0059] Therefore, the present invention essentially proposes a novel data processing method based on the least squares algorithm framework of the clustering algorithm, which is implemented based on the computer hardware running program. Figure 2 As shown in the figure, this method deeply integrates the clustering algorithm and the least squares algorithm based on a computer program, and controls the J(m k ) value selection range, so as to use the clustering algorithm program module to eliminate abnormal data, so that the least squares fitting result is closer to the target value, thereby improving the accuracy of the method.

[0060] The solution of the present invention can innovatively add a feedback mechanism to implement the solution based on the clustering algorithm plus the least squares method. The overall workflow is designed as follows:

[0061] Step 1, for application scenarios that require data fitting, etc., assume that the input data of n samples is (x1, p1, ..., q1), (x2, p2, ..., q2), ..., (xn, pn, ..., qn), and the test output data is y1, y2, ...yn, where n = [1, 2, ...] represents the sampling points, and x, p, ..., q represents m different input feature parameters. In order to obtain an accurate fitting curve for predicting the output of other sampling points, it is hoped to find a suitable function expression so that the input x, p, ..., q outputs the corresponding test output data y1, y2, ...yn;

[0062] Step 2: Input data (x, p, ..., q) into the clustering algorithm program module. The workflow of the clustering algorithm program module is as follows:

[0063] Step a), cluster each parameter set (x, p, ..., q) separately, that is, select k1, k2, ..., km data points and record them as [C1, C2, ..., C ki ](i=1,…,m), where m represents the number of different input feature parameters of x,p,…,q, and serves as the center of each of the ki categories, where the ki data points [C1,C2,…,C ki ] is not required to come from sample data points;

[0064] Step b), for each parameter set (x, p, ..., q), calculate the Euclidean distance from the remaining elements to the center of the ki class, and each data is assigned to the class closest to it. The Euclidean distance calculation formula is:

[0065] d ji =|a j -C ki |a∈[x,p,...,q];

[0066] i=1,…,m (number of different input feature parameters), j=1,…,n (number of sampling points).

[0067] Step c), for each parameter set (x, p, ..., q), first calculate the mean of all objects in each class as the new cluster center r according to the clustering results. ki , and then calculate the sum of the squares of the distances of all objects from the cluster center of their category, that is, the J value:

[0068]

[0069] Step d), calculate the effect evaluation function

[0070]

[0071] in:

[0072] d kj =1,a j ∈r ki ;

[0073] d kj =0,a j Not r ki ;

[0074] kx=[k1,k2,...km];

[0075] Step f), determine J(m k ) whether it meets the user's requirements (the user can set the required range), if so, the data is output from the module; if not, according to D = || a j -r ki || 2 Sort, remove D=||a j -r ki || 2 large data point, and then re-enter step b) until J(m k ) meets the requirements, and the data is output from the clustering algorithm module;

[0076] Step 3: The clustering algorithm module outputs data into the least squares algorithm module. The least squares method obtains the corresponding fitting function z=f(x,p,...,q) according to the algorithm principle. The test results are z1,z2,...z n Output;

[0077] Step 4, z1,z2,...z n With test data y1,y2,...y n Enter the mean square error calculation module to calculate the mean square error E:

[0078]

[0079] Step 5: When the E value meets the error requirement, the least squares method results z1, z2, ... z n Output directly; if the error requirement is not met, E is fed back to the clustering algorithm module to correct J(m k ) requirement range. If the E value is large, reduce J(m k ) and increase the elimination points; if the E value is small, expand J(m k ) so that more useful data can be fitted into the least squares module.

[0080] Since aviation integrated electronic information equipment is integrated equipment, and different functional units are realized by multiple modules, the core indicators of most functional units of the whole machine are jointly determined by the indicators of multiple cascade modules. Due to the complexity of the indicator parameters of each module, there are large differences in the working mode of modules in different functional units, and the influence of multiple factors such as the working mode, working environment, and test instruments, the mapping relationship between core functional indicators and module indicators is complex and diverse. Therefore, the relationship between core functional indicators and module indicators is deeply analyzed, and their physical characteristics are studied and discussed. Functions are constructed to calculate core functional indicators through module indicators. On the basis of existing knowledge, there is a further understanding of the connection between modules. Combined with the characteristics of different modules, further exploration is carried out between core indicators and module indicators.

[0081] The following is further explained in conjunction with the accompanying drawings and example scenario data. For the sensitivity test data, the collected data is shown in Table 1. The target data of the fitting curve is sensitivity (represented by y), and the input test data is frequency (represented by a), UVPA gain data (represented by b), UVPA noise coefficient data (represented by c), and UVRT noise coefficient data (represented by d).

[0082] Table 1 Correspondence between UV function sensitivity index and module index

[0083]

[0084]

[0085] Regarding the clustering algorithm, the input test data UVPA gain data (represented by b), UVPA noise coefficient data (represented by c) and UVRT noise coefficient data (represented by d) are clustered respectively. For example, the UVPA noise coefficient data is Figure 3 As shown. The first calculation is to calculate the circle farthest from the cluster center, D = || a j -r ki || 2 Remove the point with the largest value.

[0086] Regarding the least squares method, Figure 4 The least squares method output results are given and compared with the test results.

[0087] Regarding the mean square error calculation, the mean square error is calculated to be 0.2709. If it does not meet the requirements, the error is fed back to the clustering algorithm module.

[0088] Regarding the clustering algorithm, the clustering algorithm will eliminate the second one that is farthest from the cluster center, D = || a j -r ki || 2 Remove the point with the largest value. Send the data to the least squares module. Figure 5 shown.

[0089] Regarding the least squares method, Figure 6 The second calculation result of the least squares method is given, and the output result is compared with the test result.

[0090] Regarding the mean square error calculation, the mean square error is calculated to be 0.113. If it does not meet the requirements, the error is fed back to the clustering algorithm module.

[0091] After 7 iterations, the least squares method outputs the following results: Figure 7 , which is consistent with the measured data. The mean square error curve is shown in Figure 8 As shown in the figure, it shows that the calculated results are getting closer and closer to the measured data, and the model is becoming more and more accurate.

[0092] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.

[0093] According to one aspect of an embodiment of the present invention, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in the above various optional implementations.

[0094] In addition to the above examples, those skilled in the art may obtain other embodiments based on the above disclosure or by using the knowledge or technology in the relevant field to make changes. The features of each embodiment may be interchangeable or replaced. The changes and modifications made by those skilled in the art do not depart from the spirit and scope of the present invention and should be within the scope of protection of the claims attached to the present invention.

Claims

1. A data processing method based on clustering least squares method, characterized in that: The following steps are involved: The clustering algorithm and the least squares algorithm are integrated by computer program, and the error feedback between the output result of the least squares algorithm program module and the actual data is used to control the J(m k ) value selection range, so as to use the clustering algorithm program module to eliminate abnormal data, so that the least squares fitting result is closer to the target value; Among them, J(m k ) represents an object m of class k k The sum of squares of distances to cluster centers; the data includes aviation integrated electronic information equipment test data, and the aviation integrated electronic information equipment test data is input into a computer running the program through a computer input unit.

2. The data processing method based on clustering least squares method according to claim 1, characterized in that: The clustering algorithm and the least squares algorithm are integrated by using a computer program, and the error feedback between the output result of the least squares algorithm program module and the actual data is used to control the J(m) of the clustering algorithm program module in the computer. k ) value selection range, so as to use the clustering algorithm program module to eliminate abnormal data, so that the least squares fitting result is closer to the target value, which specifically includes the following sub-steps: Step 1, assuming that the input data of n samples are (x1, p1, ..., q1), (x2, p2, ..., q2), ..., (xn, pn, ..., qn), and the test output data are y1, y2, ...yn, where n = [1, 2, ...] represents the sampling point; x, p, ..., q represents m different input feature parameters; Step 2, the input data (x, p, ..., q) enters the clustering algorithm program module for processing through the computer input unit; Step 3: The clustering algorithm program module outputs data to the least squares algorithm program module. The least squares algorithm program module obtains the corresponding fitting function z=f(x,p,...,q) according to the algorithm principle, and the test results z1,z2,...z n Output; Step 4, z1,z2,...z n With test data y1,y2,...y n Enter the mean square error calculation program module to calculate the mean square error E: Step 5: When the E value meets the error requirement, the unit least squares method results z1, z2, ... z are output by computer. n Direct output; if the error requirement is not met, E is fed back to the clustering algorithm program module to correct J(m k ) requirement range. If the E value is large, reduce J(m k ) and increase the elimination points; if the E value is small, expand J(m k ) so that more useful data can be fitted into the least squares program module.

3. The data processing method based on clustering least squares method according to claim 2, characterized in that: The input data (x, p, ..., q) enters the clustering algorithm module through the computer input unit for processing, which specifically includes the following sub-steps: Step a), cluster each parameter set (x, p, ..., q) separately, that is, select k1, k2, ..., km data points and record them as [C1, C2, ..., C ki ], i = 1, ..., m, m represents the number of different input feature parameters of x, p, ..., q, as the center of each of the ki categories; Step b), for each parameter set (x, p, ..., q), calculate the Euclidean distance from the remaining elements to the center of the ki class, and each data is assigned to the class closest to it. The Euclidean distance calculation formula is: d ji =|a j -C ki |a∈[x,p,...,q]; i=1,…,m, represents the number of different input feature parameters; j=1,…,n, represents the number of sampling points; Step c), for each parameter set (x, p, ..., q), first calculate the mean of all objects in each class as the new cluster center r according to the clustering results. ki , and then calculate the sum of the squares of the distances of all objects from the cluster center of their category, that is, the J value: Step d), calculate the effect evaluation function: in: d kj =1,a j ∈r ki ; d kj =0,a j Not r ki ; kx=[k1,k2,...km]; Step f), determine J(m k ) whether it meets the user's requirements, if so, the data is output from the module; if not, according to D = || a j -r ki || 2 Sort, remove D=||a j -r ki || 2 large data point, and then re-enter step b) until J(m k ) meets the requirements, and the data is output from the clustering algorithm module.

4. The data processing method based on clustering least squares method according to claim 2, characterized in that: In step 1, the collected data of the corresponding scene is input for the application scenario that requires data fitting; the corresponding scene includes machine learning, digital twin system, artificial intelligence and machine vision.

5. The data processing method based on clustering least squares method according to claim 3, characterized in that: In step a), ki data points [C1, C2, …, C ki ] is not required to come from sample data points.

6. The data processing method based on clustering least squares method according to claim 2, characterized in that: In step f), the user requirement may set a requirement range.

7. A data processing device based on clustering least squares method, characterized in that: The invention comprises a processor and a memory, wherein a program is stored in the memory, and when the program is loaded by the processor, the data processing method based on the clustering least square method as claimed in any one of claims 1 to 6 is executed.