Adaptive K value under-sampling method based on multi-modal density perception

Through the methods of multimodal density perception and adaptive K value adjustment, combined with shape-aware kernel functions, multi-scale density fusion and noise suppression, the problems of low accuracy and poor adaptability of overlapping instance recognition in class-imbalanced data of traditional methods are solved, and accurate recognition and information retention of complex data distribution are achieved.

CN120632601APending Publication Date: 2025-09-12UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510735665.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Traditional machine learning methods suffer from low accuracy in overlapping instance recognition and poor adaptability in class-imbalanced data due to fixed K values ​​and single Gaussian kernel density estimation, and are particularly unstable under complex data distributions.

Method used

A multimodal density-aware adaptive K-value undersampling method is adopted, combined with the shape-aware kernel function (DCA-Kernel), multi-scale density fusion (MDF) and noise suppression weight mechanism (NSW). Through a multi-level collaborative optimization framework, the K value is dynamically selected and noise is suppressed to adapt to the data distribution in different density areas.

Benefits of technology

It significantly improves the recognition accuracy and algorithm adaptability of overlapping instances, realizes refined processing of complex data distribution, improves the visibility of minority classes and maximizes the retention of effective information of majority classes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632601A_ABST
    Figure CN120632601A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive K value undersampling method based on multi-modal density perception, and belongs to the field of machine learning data preprocessing. The method comprises the following steps: constructing a shape sensing kernel function, and converting an Euclidean distance into a Mahalanobis distance through a k-nearest neighbor covariance matrix, so that a kernel shape adapts to a data cluster distribution form; calculating density estimation of each scale by adopting a multi-bandwidth shape sensing kernel, and realizing multi-scale fusion based on index weight distribution of global density deviation; constructing a noise suppression weight in combination with a local outlier factor to correct density estimation; and executing two-stage search: marking potential overlapping examples by taking majority classes as anchor points, and dynamically selecting klarge or ksmall values for secondary judgment according to density comparison of the majority classes and minority classes. The problem of insufficient precision caused by a fixed k value and a single Gaussian kernel is solved through a multi-modal density sensing framework, accurate positioning of overlapped instances under complex distribution and optimal reservation of majority class information are realized, and the classification performance of class imbalance data is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning data preprocessing, and in particular to a class imbalance data processing method combining multimodal density evaluation and adaptive k value adjustment. Background Art

[0002] In the field of machine learning, the problem of class-imbalanced data classification is a common problem in key scenarios such as fraud detection and medical diagnosis. When instances of the minority and majority classes overlap, traditional classification algorithms tend to favor the majority class, significantly reducing the accuracy of minority class recognition. Existing solutions primarily adjust class distributions through data-level resampling, but these solutions still face the following technical bottlenecks:

[0003] (1) The drawbacks of the fixed k-value strategy: KNN-based undersampling methods rely on a fixed k-value to identify overlapping instances, but the optimal k-value varies significantly across different density regions. For example, high-density regions require a larger k-value to capture global structure, while using a larger k-value in low-density regions will mistakenly delete non-overlapping instances, resulting in a loss of majority class information.

[0004] (2) Deficiencies in density assessment: Traditional methods often use Gaussian kernel functions to estimate local density. However, this method is difficult to accurately estimate density and is easily affected by the variable distribution shape, uneven distribution density, and outliers of the data community.

[0005] Traditional methods fail to fully consider the complexity of data distribution, resulting in unstable performance on datasets with varying densities and overlaps. Therefore, a method for handling class-imbalanced data that can accurately estimate density, resist noise interference, and adaptively adjust the strength of the approach to regions of varying density is urgently needed to improve the accuracy of overlapping instance recognition and algorithm adaptability.

[0006] To address the above issues, the present invention proposes an adaptive undersampling method based on multimodal density perception. This invention aims to address the problems of insufficient accuracy and poor adaptability of existing methods in overlapping instance recognition. By proposing a multi-level collaborative optimization framework that combines shape-aware kernel function (DCA-Kernel), multi-scale density fusion (MDF) and noise suppression weight mechanism (NSW), the robustness to different density regions is enhanced, and reliable adaptive K value selection is achieved for different density regions, thereby maximizing the retention of effective information of the majority class while improving the visibility of the minority class. Summary of the Invention

[0007] The purpose of this invention is to solve the problems of low accuracy and poor adaptability in overlapping instance recognition of class-imbalanced data in machine learning due to a fixed K value and a single Gaussian kernel density estimation. Through multimodal density perception and adaptive K value adjustment, it is possible to accurately identify overlapping samples under complex data distributions and optimize the retention of majority class information.

[0008] In order to achieve the above-mentioned purpose, the present invention adopts the following technical means:

[0009] The present invention provides an adaptive K-value undersampling method based on multimodal density perception, comprising the following steps:

[0010] S1: For each data point, the covariance matrix of its k nearest neighbors is calculated, and the inverse matrix of the covariance matrix is ​​embedded in the Gaussian kernel function to generate a shape-adaptive shape-aware kernel function, where the Euclidean distance is converted to the Mahalanobis distance so that the kernel function shape adapts to the distribution of the data cluster;

[0011] S2: using the shape-aware kernel functions of multiple different bandwidths to calculate density estimates at each scale, dynamically assigning weights through an exponential function based on the deviation of the density at each scale from the global density mean, and fusing the density estimates at each scale to obtain a fused density;

[0012] S3: Calculate the local outlier factor of each data point, and perform nonlinear mapping on the fusion density based on the local outlier factor to suppress noise, so as to obtain a corrected density;

[0013] S4: Based on the modified density, a two-stage search strategy is performed:

[0014] In the first stage, the majority class instance is used as the anchor to search for the minority class instance within the K nearest neighbors and mark the potential overlapping instances;

[0015] In the second stage, the minority class instances in the potential overlapping instances are used as anchor points, and the K value is selected according to the comparison result of the majority class instance density and the minority class instance density: if the majority class instance density is greater than the minority class instance, the first preset k_large value is selected for overlap judgment; otherwise, the second preset k_small value is selected, and the overlapped instances are undersampled, and the majority class instances judged to be overlapping areas are proposed.

[0016] In the above solution, the construction of the shape perception kernel function (DCA-Kernel) includes the following sub-steps:

[0017] S1.1: For each data point x i , calculate the covariance matrix cov of its k-nearest neighbors i , which captures the shape of the local distribution of clusters, is given by:

[0018]

[0019] Among them, μ i is the mean of the k-nearest neighbor points, N i is x i The k nearest neighbor set of x j Belong to the set N iThe jth nearest neighbor data point, cov i The eigenvector of represents the main direction of data distribution, and the eigenvalue reflects the variance in each direction;

[0020] S1.2: The inverse matrix cov of the covariance matrix i -1 Embedded kernel function, shape-adaptive kernel function, the formula is as follows:

[0021]

[0022] Among them, σ i The kernel function replaces the Euclidean distance with the Mahalanobis distance to make the kernel function shape adaptively match the distribution of the data cluster. Indicates a dedicated location.

[0023] In the above scheme, the multi-scale density fusion (MDF) includes the following sub-steps:

[0024] S2.1: Based on the shape-aware kernel function (DCA-Kernel) with multiple preset bandwidths, calculate the density estimation value at each scale respectively, and the expression is:

[0025]

[0026] where σ k are different bandwidths, σ1<σ2<σ3 are preset different bandwidths, corresponding to small, medium and large scales respectively;

[0027] S2.2: Estimation of density value ρ at each scale scalek (x i ) and the global density mean μ global The absolute deviation is dynamically assigned weights through an exponential function, and the expression is:

[0028]

[0029] Where β is the weight adjustment factor;

[0030] S2.3: Weighted fusion of density estimates at each scale to obtain fusion density ρ fusion (x i ), the expression is:

[0031]

[0032] By dynamically selecting the optimal scale combination, noise interference in low-density areas is suppressed and the global structure in high-density areas is preserved.

[0033] In the above scheme, the noise suppression weight mechanism (NSW) includes the following sub-steps:

[0034] S3.1: Calculate each data point x based on the preset k nearest neighbors i Local outlier factor LOF k (x j ), quantify its degree of outlier;

[0035] S3.2: The local outlier factor LOF k (x j ) is mapped to the [0, 1] interval through a nonlinear function to generate noise suppression weights, which are expressed as:

[0036]

[0037] S3.3: Modify the fusion density according to the noise suppression weight to obtain the final density estimate:

[0038] ρ final (x i )=w NSW (x i )·ρ fusion (x i )

[0039] Among them, the weight of outliers with high LOF values ​​is close to 0, and the weight of normal points is close to 1.

[0040] In the above solution, the undersampling process based on local density includes the following sub-steps:

[0041] S4.1: Using the majority class instance as an anchor, search for minority class instances within its first preset k_large value neighborhood. If a minority class instance exists, mark the majority class instance as a potential overlapping instance.

[0042] S4.2: Perform a secondary search using the minority class instances among the potential overlapping instances as anchors:

[0043] If the modified density ρ of the majority class instances final (x i ) is greater than the modified density ρ of the minority class instances final (x j ) then selecting the first preset k_large value to perform a secondary nearest neighbor search;

[0044] If the modified density ρ of the majority class instances final (x i ) is less than the modified density ρ of the minority class instances final (x j ) then select the first preset k_small value to perform a secondary nearest neighbor search;

[0045] If the majority class instance is still a neighbor of the minority class instance in the secondary search, it is determined to be an overlapping instance and is removed by undersampling.

[0046] Because the present invention adopts the above technical means, it has the following beneficial effects:

[0047] 1. Through the technical means of shape-aware kernel function (DCA-Kernel) (step S1), the problem that the traditional Gaussian kernel function cannot adapt to the complex data distribution form due to its fixed shape is solved. The kernel function shape is accurately matched with the data cluster distribution form, which significantly improves the accuracy of local density estimation and avoids the problem of misjudging noise in low-density areas due to the excessive coverage of the kernel function.

[0048] 2. Through the technical means of multi-scale density fusion (MDF) (step S2), the problem of poor adaptability of a single fixed bandwidth in different density areas is solved, and the effect of dynamically selecting the optimal scale combination is achieved: small scales are given higher weights in low-density areas to suppress noise interference, and large scales are selected in high-density areas to preserve the global structure, thereby achieving robust density estimation for multimodal and unevenly distributed data.

[0049] 3. Through the technical means of the noise suppression weight mechanism (NSW) (step S3), the problem of outliers interfering with density estimation is resolved, and the effect of dynamically suppressing noise based on the local outlier factor (LOF) is achieved: the density contribution of high outliers is significantly weakened, and the density information of normal points is fully preserved, thereby improving the reliability of density estimation, especially effectively avoiding noise misjudgment in low-density areas.

[0050] 4. Through the two-stage adaptive K value adjustment technology based on local density (step S4), the problem of insufficient recognition accuracy of overlapping instances in different density areas of the fixed K value strategy is solved, and the effect of dynamically selecting the K value according to the density difference between the majority class and the minority class is achieved: a larger K value is used in areas with higher majority class density to capture the global overlapping structure, and a smaller K value is used in areas with lower majority class density to retain clear class boundaries, thereby improving the visibility of the minority class while maximizing the retention of effective information of the majority class.

[0051] 5. By combining the multi-level collaborative optimization framework of shape-aware kernel function (DCA-Kernel) (step S1), multi-scale density fusion (MDF) (step S2) and noise suppression weight mechanism (NSW) (step S3), the problem of data set density estimation in complex situations is solved, and the accuracy and robustness of density estimation are achieved from multiple aspects.

[0052] In summary, the present invention solves the technical bottlenecks of low accuracy and poor adaptability of overlapping instance recognition under complex data distribution in traditional methods through a multi-level collaborative optimization framework (DCA-Kernel, MDF, NSW and adaptive K value adjustment), realizes the refined processing of class imbalanced data, and significantly improves the performance of the classification model in overlapping areas and the robustness of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 : Traditional Gaussian kernel function versus shape-aware kernel function. (a) shows the traditional Gaussian kernel. There are a lot of blank areas in the circle where no data points exist, which may lead to low density estimation. (b) shows that the kernel function shape is adaptively adjusted to a shape that is more suitable for cluster distribution.

[0054] Figure 2 : Corresponding scenarios for multi-scale density fusion;

[0055] Figure 3 : outliers;

[0056] Figure 4 : Adaptive k value. In the figure, (a) indicates the case where the density of the minority class is lower than the density of the majority class. In this case, the minority class instances use k_large to detect overlapping instances. (b) indicates the case where the density of the minority class is higher than the majority class. In this case, the minority class instances use k_small to detect overlapping instances.

[0057] In each figure, asterisks represent majority class instances, and dots represent minority class instances. DETAILED DESCRIPTION

[0058] The following is a detailed description of the embodiments of the present invention. Although the present invention will be described and illustrated in conjunction with certain specific embodiments, it should be noted that the present invention is not limited to these embodiments. On the contrary, modifications or equivalent substitutions of the present invention are intended to fall within the scope of the claims of the present invention.

[0059] In addition, in order to better illustrate the present invention, numerous specific details are given in the following detailed description. It will be understood by those skilled in the art that the present invention can also be implemented without these specific details.

[0060] The present invention proposes a class-imbalanced data processing method based on multimodal density perception, aiming to solve the problems of insufficient accuracy and poor adaptability of traditional algorithms in overlapping instance recognition under complex data distribution. In view of the problems in traditional class-imbalanced data processing where the Gaussian kernel function is easily affected by noise in low-density areas and the fixed k-value strategy is difficult to adapt to complex data distribution, the present invention proposes a multi-level collaborative optimization framework that combines shape-aware kernel function (DCA-Kernel), multi-scale density fusion (MDF) and noise suppression weight mechanism (NSW). This framework significantly improves the accuracy of overlapping instance recognition and the adaptability of the algorithm, realizes the refined processing of data sets with different densities and overlaps, and significantly improves the performance of minority class recognition.

[0061] S1: Shape-aware kernel function (DCA-Kernel)

[0062] The traditional Gaussian kernel function is often used for local density estimation, but it has a serious flaw. The Gaussian kernel function uses a fixed bandwidth and assumes that the data points of a data cluster are evenly and regularly distributed in the data space. In a two-dimensional space, this means that the Gaussian kernel function attempts to use a regular circle to encompass all data points. However, in actual data distribution, a data cluster often exhibits an irregular and uneven distribution shape. For example, Figure 1 As shown, Figure 1 The a in the figure represents a traditional Gaussian kernel. The circle contains a large number of blank areas where no data points exist, which can lead to an underestimation of the density estimate. Traditional Gaussian kernel functions cannot adapt well to complex data cluster distribution shapes, making it difficult to accurately estimate the local density of data points. To address these issues, the present invention proposes a shape-aware kernel function.

[0063] For each data point, the present invention captures the distribution form of the data cluster where the point is located through the k-nearest neighbor covariance matrix, breaking through the limitations of the original Gaussian kernel function and more accurately estimating the local density of the point. For each data point, the local covariance matrix is ​​first calculated based on its k-nearest neighbor distribution to capture the shape characteristics of the cluster data distribution. Subsequently, the present invention embeds the inverse matrix of the k-nearest neighbor covariance matrix into the kernel function, converts the Euclidean distance into the Mahalanobis distance, and makes the kernel function shape adaptively adjusted to a shape that is more suitable for the cluster distribution, such as Figure 1 The ellipsoid in (b) exactly matches the cluster shape.

[0064] First, for each data point x i , calculate the covariance matrix cov of its k-nearest neighbors i , capturing the shape of the local distribution of clusters. The formula is as follows:

[0065]

[0066] Among them, μ iis the mean of the k-nearest neighbor points, N i is the knot set of all adjacent points, cov i The eigenvector of represents the main direction of data distribution, and the eigenvalue reflects the variance in each direction. If the data is stretched horizontally, cov i The eigenvector corresponding to the maximum eigenvalue of points in the horizontal direction.

[0067] Then, the inverse matrix cov of the covariance matrix is i -1 Embed the kernel function to generate shape-aware Gaussian kernel.

[0068] The formula is as follows:

[0069]

[0070] Among them, σ i is the global fixed bandwidth (e.g. calculated by Silverman's rule). i Converting the Euclidean distance to the Mahalanobis distance allows the kernel function to be adaptively adjusted (e.g., elliptical) to accurately match the data distribution. By adding the covariance matrix to the traditional Gaussian kernel function and modeling the distribution shape, the density estimate more closely matches the distribution of the dataset, avoiding misclassification of noise in low-density areas.

[0071] S2: Multi-scale Density Fusion (MDF)

[0072] DCA-Kernel improves the accuracy of density estimation by sensing the distribution shape of data clusters, but a single fixed bandwidth is difficult to solve the problem of uneven data density. For example, in high-density areas, if a small bandwidth is used, the kernel function will focus too much on local details, which may lead to over-smoothing and ignore the global structure. In low-density areas, if a large bandwidth is used, the kernel function will cover too much and mistakenly identify noise or outliers in sparse areas as valid data. Figure 2 As shown, a dataset contains communities with diverse distribution densities. A fixed bandwidth cannot simultaneously meet the differentiated needs of high-density and low-density areas, leading to biased density estimation. High-density areas may lose details, while low-density areas may introduce noise. This problem is even more pronounced in scenarios with complex data distribution (e.g., multimodal or heavily overlapping data).

[0073] In order to solve the problem of misjudgment of noise at a single scale, the present invention introduces a multi-scale density fusion strategy. On the basis of the dynamic covariance kernel function, multiple groups of fixed bandwidths (such as small, medium and large scales) are used to calculate the density estimation results respectively. Through the dynamic weight allocation mechanism, the optimal bandwidth combination is selected according to the deviation of the density of each scale from the global mean: the low-density area gives the small-scale results a higher weight to suppress the noise, and the high-density area selects the large-scale results to retain the structure. This design makes up for the shortcomings of the traditional fixed k value strategy (such as the mistaken deletion of non-overlapping instances at low density) and enhances the adaptability to complex distributions (such as multimodality and high overlap) through multi-scale cross-validation.

[0074] To achieve multi-scale density estimation, the present invention uses different bandwidths (σ1<σ2<σ3) to calculate multi-version densities based on DCA-Kernel.

[0075]

[0076] Different bandwidth σ k Represents different control strengths. For example, the small-scale σ1 focuses more on local details and suppresses noise in low-density areas; the large-scale σ3 focuses more on capturing global structures and avoiding over-smoothing in high-density areas.

[0077] Then, the method calculates the density of each scale and the global density mean μ global The deviation of the calculation weight w of each scale density k , as shown below:

[0078]

[0079] The smaller the deviation (consistent with the global distribution), the higher the weight, ensuring the selection of the optimal scale result. The weights of different scales are dynamically selected based on global statistics (such as the deviation from the global mean). This allows MDF to better adapt to changes in the overall data distribution, especially in cases where the data distribution is complex and the density varies greatly, providing more stable density estimates.

[0080]

[0081] S3: Noise Suppression Weighting (NSW)

[0082] In class-imbalanced data, outliers (such as sensor noise in industrial data) can significantly distort local density estimation, especially in low-density areas, where traditional methods can easily misjudge noise as valid instances. Figure 3To further suppress the interference of outliers on density estimation, the present invention introduces the idea of ​​outlier factors into the fusion density in the second step, forming a closed-loop optimization process of "shape modeling → multi-scale enhancement → noise suppression". This solves the noise-dominated problem faced by traditional methods, especially for high-noise data.

[0083] First, for each data point, its LOF is calculated to quantify the degree of outlier of the point. Traditional methods usually assign fixed weights to outliers and normal points (such as direct elimination or retention), and cannot dynamically adapt to scenarios with different degrees of outliers. Strong outliers with high LOF values ​​need to be completely suppressed (weights approach 0). Edge points (slightly higher LOF values) need to be partially retained to maintain the integrity of the data distribution. Therefore, this application takes into account the suppression of outliers and the protection of normal points and edge points by nonlinearly mapping the LOF value to the [0, 1] interval.

[0084]

[0085] For outliers with high LOF values, their influence is significantly suppressed. For normal points, their contribution is retained. Finally, the corrected density ρ is obtained final (x i ).

[0086] S4: Undersampling based on local density

[0087] After completing the multimodal density assessment, the data is further processed using a local density-based undersampling algorithm. This algorithm can achieve more detailed optimization of overlapping regions when dealing with class imbalanced data.

[0088] In the first stage, we use the majority class instance as the anchor to search for minority class instances within the k_large neighbors. If so, we set the anchor as the potential overlapping area.

[0089] In the second stage, the minority class instance is used as an anchor to search for potential overlapping instances within the k_small neighbors. If so, the potential overlapping instances are determined to be overlapping instances.

[0090] We set a pair of k value combinations (k_large, k_small). In the first stage, to ensure that as many duplicate instances as possible are eliminated, we first search with the k_large value. When a majority class instance is found to have a minority class neighbor nearby, the majority class instance is considered a potential overlapping instance. We compare the local densities of the two instances obtained from multimodal density estimation. Based on the two comparison results, we select a different k value (i.e., k_large or k_small) to proceed to the next step—determining overlap.

[0091] The third stage is to determine overlap. We stipulate that when the density of majority class instances is greater than that of minority class instances, the majority class instance density is relatively high, and we need to use a larger k value, k_large, to determine overlapping instances. When the density of majority class instances is less than that of minority class instances, the majority class instance density is relatively low. At this point, within this region, the minority class becomes the de facto majority class, and the majority class becomes the de facto minority class. Majority class instances do not have an overriding effect on the identification of the minority class. We can choose a smaller k value, k_small, to obtain a clearer boundary. If the majority class instance is still a neighbor of the minority class instance at this point, the Euclidean distance between them is not large, and the majority class instance is identified as an overlapping instance.

[0092] like Figure 4 The k value combination shown in the figure is (5, 3). When the majority class density is greater than the minority class, the minority class uses k_large, which is 5, to determine overlap; when the majority class density is less than the minority class, k_small, which is 3, is used to determine overlap.

[0093] Example 1

[0094] S1: Construction and optimization of shape-aware kernel function (DCA-Kernel)

[0095] The present invention perceives the distribution shape of the community through the shape-aware kernel function, and uses the k-nearest neighbor covariance matrix of the data point to convert the Euclidean distance of the traditional kernel function into the Mahalanobis distance to better match the community shape and thus better estimate the density. For each data point, its 5 nearest neighbors (k=5) are selected, and the local covariance matrix is ​​calculated to capture the data distribution shape. Consider a medical diagnosis scenario. In a continuous glucose monitoring (CGM) system, the blood glucose level of diabetic patients often presents a significant anisotropic distribution. For example, blood glucose after a meal may rise sharply along the time dimension (variance of 2.5mmol / l). 2 / L 2 ), while fasting blood sugar fluctuations were smaller (variance 0.3mmol 2 / L 2 ).

[0096] The inverse of the covariance matrix is ​​then embedded into the kernel function, and the Mahalanobis distance is used instead of the Euclidean distance to adaptively adjust the kernel function shape to an ellipsoid. The global bandwidth σ is determined by the Silverman rule (e.g., σ = 0.5) to ensure that the kernel function avoids over-smoothing or under-smoothing under complex distributions. The Silverman rule is as follows:

[0097]

[0098] Where N represents the number of samples in the data set D, and var(D) represents the variance of the data set D;

[0099] S2: Dynamic weight allocation for multi-scale density fusion (MDF)

[0100] To enhance adaptability to complex distributions, the present invention employs three fixed bandwidths (σ1 = 0.3, σ2 = 1.0, and σ3 = 2.0) for multi-scale density estimation: small scales focus on local details, while large scales preserve global structure. A dynamic weighting mechanism is used to calculate weights (β = 0.5) based on the deviation of the density at each scale from the global mean. Low-density regions are assigned higher weights to small scales (e.g., w1 = 0.6), while high-density regions are assigned larger weights (e.g., w3 = 0.7).

[0101] For example, in the high-frequency trading anomaly detection scenario, targeting the multimodal distribution characteristics of stock order book data, the present invention uses three sets of different bandwidths (σ1=0.3, σ2=1.0, σ3=2.0) for multi-scale density estimation: the small scale σ1 focuses on millisecond-level price fluctuations (such as the instantaneous widening of price spreads caused by a sudden drop in liquidity), while the large scale σ3 retains the intraday trading pattern (such as the concentration of trading volume before the release of financial reports). On this basis, the dynamic weight mechanism (β=0.5) adaptively allocates according to the deviation of each scale density from the global mean - when a local density drop is detected, the small scale σ1 is given a higher weight (w1=0.6) to accurately identify abnormal trading behaviors such as spoofing attacks; during normal trading hours, the large scale σ3 (w3=0.7) is selected to avoid mistakenly deleting valid orders due to liquidity fluctuations, thereby achieving accurate distinction between market noise and true anomalies.

[0102] S3: Outlier Filtering with Noise Suppression Weights (NSW)

[0103] To suppress outlier interference, the present invention introduces the local outlier factor concept into the final estimated density. For each data point, its LOF value (k=5) is calculated and mapped to the final density ρ through nonlinear mapping. final (x i ).

[0104] S4: Undersampling Processing and Model Validation Based on Local Density

[0105] This phase uses a dynamic two-stage search strategy and adaptive k-value adjustment to accurately identify and handle instances that overlap class boundaries, preserving significant information about the majority class while improving visibility of the minority class. Common k-value combinations include (3, 5), (5, 7), and (7, 9), and their specific use is determined through prior experimentation.

Claims

1. An adaptive K-value undersampling method based on multimodal density perception, characterized in that: The following steps are involved: S1: For each data point, the covariance matrix of its k nearest neighbors is calculated, and the inverse matrix of the covariance matrix is ​​embedded in the Gaussian kernel function to generate a shape-adaptive shape-aware kernel function, where the Euclidean distance is converted to the Mahalanobis distance so that the kernel function shape adapts to the distribution of the data cluster; S2: using the shape-aware kernel functions of multiple different bandwidths to calculate density estimates at each scale, dynamically assigning weights through an exponential function based on the deviation of the density at each scale from the global density mean, and fusing the density estimates at each scale to obtain a fused density; S3: Calculate the local outlier factor of each data point, and perform nonlinear mapping on the fusion density based on the local outlier factor to suppress noise, so as to obtain a corrected density; S4: Based on the modified density, a two-stage search strategy is performed: In the first stage, the majority class instance is used as the anchor to search for the minority class instance within the K nearest neighbors and mark the potential overlapping instances; In the second stage, the minority class instances in the potential overlapping instances are used as anchor points, and the K value is selected according to the comparison result of the majority class instance density and the minority class instance density: if the majority class instance density is greater than the minority class instance, the first preset k_large value is selected for overlap judgment; otherwise, the second preset k_small value is selected, and the overlapped instances are undersampled, and the majority class instances judged to be overlapping areas are proposed.

2. The adaptive K-value undersampling method based on multimodal density perception according to claim 1, characterized in that: The construction of the shape perception kernel function (DCA-Kernel) includes the following sub-steps: S1.1: For each data point x i , calculate the covariance matrix cov of its k-nearest neighbors i , which captures the shape of the local distribution of clusters, is given by: Among them, μ i is the mean of the k-nearest neighbor points, N i is x i The k nearest neighbor set of x j Belong to the set N i The jth nearest neighbor data point, coV i The eigenvector of represents the main direction of data distribution, and the eigenvalue reflects the variance in each direction; S1.2: The inverse matrix cov of the covariance matrix i -1 Embedded kernel function, shape-adaptive kernel function, the formula is as follows: Among them, σ i The kernel function replaces the Euclidean distance with the Mahalanobis distance to make the kernel function shape adaptively match the distribution of the data cluster. Indicates a dedicated location.

3. The adaptive K-value undersampling method based on multimodal density perception according to claim 1, characterized in that: The multi-scale density fusion (MDF) includes the following sub-steps: S2.1: Based on the shape-aware kernel function (DCA-Kernel) with multiple preset bandwidths, calculate the density estimation value at each scale respectively, and the expression is: where σ k are different bandwidths, σ1<σ2<σ3 are preset different bandwidths, corresponding to small, medium and large scales respectively; S2.2: Estimation of density value ρ at each scale scalek (x i ) and the global density mean μ global The absolute deviation is dynamically assigned weights through an exponential function, and the expression is: Where β is the weight adjustment factor; S2.3: Weighted fusion of density estimates at each scale to obtain fusion density ρ fusion (x i ), the expression is: By dynamically selecting the optimal scale combination, noise interference in low-density areas is suppressed and the global structure in high-density areas is preserved.

4. The adaptive K-value undersampling method based on multimodal density perception according to claim 1, characterized in that: The noise suppression weighting mechanism (NSW) includes the following sub-steps: S3.1: Calculate each data point x based on the preset k nearest neighbors i Local outlier factor LOF k (x j ), quantify its degree of outlier; S3.2: The local outlier factor LOF k (x j ) is mapped to the [0, 1] interval through a nonlinear function to generate noise suppression weights, which are expressed as: S3.3: Modify the fusion density according to the noise suppression weight to obtain the final density estimate: r final (x i )=w NSW (x i )·r fusion (x i ) Among them, the weight of outliers with high LOF values ​​is close to 0, and the weight of normal points is close to 1.

5. The adaptive K-value undersampling method based on multimodal density perception according to claim 1, characterized in that: The local density-based undersampling process includes the following sub-steps: S4.1: Using the majority class instance as an anchor, search for minority class instances within its first preset k_large value neighborhood. If a minority class instance exists, mark the majority class instance as a potential overlapping instance. S4.2: Perform a secondary search using the minority class instances among the potential overlapping instances as anchors: If the modified density ρ of the majority class instances final (x i ) is greater than the modified density ρ of the minority class instances final (x j ) then selecting the first preset k_large value to perform a secondary nearest neighbor search; If the modified density ρ of the majority class instances final (x i ) is less than the modified density ρ of the minority class instances final (x j ) then select the first preset k_small value to perform a secondary nearest neighbor search; If the majority class instance is still a neighbor of the minority class instance in the secondary search, it is determined to be an overlapping instance and is removed by undersampling.