Real-time clustering method based on novel fuzzy C-means
By optimizing the objective function and updating the cluster center formula of the fuzzy C-means algorithm, the problem of poor performance of existing technologies in large-scale data sets and real-time response scenarios is solved, and real-time clustering of high-definition data streams with unclear boundaries is achieved. , improving the performance and security of the real-time monitoring system.
Patent Information
- Application Number
- CN202410669451.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-30
AI Technical Summary
The existing fuzzy C-means algorithm performs poorly in processing large-scale data sets or scenarios that require real-time response, which may lead to the loss of key information or delayed processing in real-time monitoring systems, affecting system performance and security.
By optimizing the objective function, a new clustering center update formula is obtained, using the importance attenuation characteristics of stream data to achieve real-time clustering of high data streams with unclear boundaries, reducing computational complexity and running time, and adapting to high traffic Data processing needs.
It improves the performance and security of the real-time monitoring system, reduces the loss of key information, significantly reduces the computational complexity and running time, and can dynamically adjust the number of clustering categories to adapt to real-time data processing needs.
Smart Images

Figure CN118568533A
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of sample classification and network security, and in particular to a real-time clustering method based on a novel fuzzy C-means. Background Art
[0002] In real life, many problems cannot be represented by deterministic data. For example, in the fields of economics, sociology, biology, meteorology, and medicine, the differences between objective things may not be clearly separable, but rather have an intermediate transition of "ambiguity" and "unclear boundaries". In response to such data objects whose boundaries are not absolutely clear, Zadeh first proposed the concept of fuzzy sets in 1965, which more delicately expresses the uncertainty problems in the decision-making process. It can mine key information from massive data and perform effective classification. Among the many fuzzy clustering algorithms, the fuzzy C-means (FCM) algorithm [1] is the most widely used and successful. As a classic soft partitioning clustering method, it has been widely used in data analysis, pattern recognition, network security and other fields.
[0003] However, as modern application scenarios have increasingly higher requirements for data processing speed and real-time performance, a significant shortcoming of the FCM algorithm has gradually been exposed: it requires multiple iterations to achieve optimal clustering effects, which leads to its poor performance in real-time clustering scenarios of traffic data. Specifically, the iterative process of the FCM algorithm involves complex data operations and multiple updates of cluster centers, all of which consume a lot of computing resources and time. In systems with high real-time requirements, such as real-time monitoring systems, this delay may cause the loss or untimely processing of key information, thereby affecting the performance and security of the entire system. With the continuous growth of the scale of 5G networks, the amount of data in the network has increased dramatically, and the potential risk of network intrusion has become increasingly significant. The importance of network security has received more and more attention. Summary of the invention
[0004] In order to solve the technical problems existing in the prior art, the present invention provides a real-time clustering method based on a novel fuzzy C-means, which can be used in a network intrusion behavior detection system. By utilizing the importance attenuation characteristics of stream data, it can process some high data streams whose boundaries are not absolutely clear, solve the problem that the prior art performs poorly in processing large-scale data sets or scenarios requiring real-time response, reduce the loss of key information or avoid untimely processing, and improve the performance and security of the real-time monitoring system.
[0005] The purpose of the present invention can be achieved by adopting the following technical solutions:
[0006] A real-time clustering method based on a novel fuzzy C-means method comprises the following steps:
[0007] S1. Optimize the objective function to obtain an optimized objective function, and calculate a new cluster center update formula based on the optimized objective function;
[0008] The objective function of the optimization is as follows:
[0009]
[0010] Among them, J is the objective function, M is the number of categories, N is the number of data, ω is the scaling factor; x j is the jth data, c i is the i-th class, u ij is the membership of the j-th data in the i-th class, and β is a coefficient between (0,1);
[0011] S2. Receive data streams, perform clustering based on the optimized objective function and the new cluster center update formula, and determine the data category based on the distance between each piece of data and the cluster center.
[0012] Specifically, the new cluster center update formula is:
[0013]
[0014] Among them, c k c i Any class in u kj for u ij Any membership parameter in , T represents the number of iterations.
[0015] Specifically, when the received data stream is non-high-traffic data from the same source, step S2 includes the following steps:
[0016] S211, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm;
[0017] S212, calculating the membership of each new data to each class through the membership formula;
[0018] S213, based on the membership of the new data to each class, updating the cluster center by a new cluster center updating formula;
[0019] S214, repeating steps S212-S213 until the optimized objective function converges, obtaining the cluster center of each new data, and determining the category of the data stream according to the distance between each data and the cluster center.
[0020] Specifically, when the received data stream is high-traffic data from the same source data, step S2 includes the following steps:
[0021] S221, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm;
[0022] S222, simultaneously processing multiple pieces of new data, calculating the membership of each piece of data in the multiple pieces of data to each class through the membership formula, and obtaining the membership vectors of the multiple pieces of data;
[0023] S223, based on the membership vectors of the multiple data, update the cluster center by the following formula;
[0024]
[0025] Among them, d represents a natural number array starting from 0, and r is the number of data;
[0026] S224. Repeat steps S222-S223 until the optimized objective function converges, obtain the cluster center of each new data, and determine the category of the data stream based on the distance between each data and the cluster center.
[0027] Specifically, when the received data streams are data of the same distribution from different sources, step S2 includes the following steps:
[0028] S231, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm;
[0029] S232, simultaneously processing multiple new data, calculating the membership of each data j in the multiple data to each class through the membership formula, and obtaining the membership vector of the multiple data;
[0030] S233, based on the membership vectors of the multiple data, update the cluster center by the following formula;
[0031]
[0032] Where r is the number of data;
[0033] S234, repeating steps S232-S233 until the optimized objective function converges, obtaining the cluster center of each new data, and determining the category of the data stream according to the distance between each data and the cluster center.
[0034] Specifically, the membership formula is:
[0035]
[0036] Among them, M is the number of categories, N is the number of data, ω is the scaling factor, and x j is the jth data, c i is the i-th class, c k ci Any class in u ij is the membership of the j-th data in the i-th class.
[0037] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0038] The present invention proposes a real-time clustering method based on a novel fuzzy C-means, which optimizes the objective function to obtain an optimized objective function, and calculates a new cluster center update formula based on the optimized objective function; receives a data stream, clusters based on the optimized objective function and the new cluster center update formula, and determines the data stream category. Not only can the clustering effect of the algorithm be maintained, but it also gives it the ability to adapt to real-time data processing needs, especially when processing high-flow data. It can be used in a network intrusion behavior detection system, and utilizes the importance attenuation characteristics of the flow data to enable it to process some high data flows whose boundaries are not absolutely clear, solve the problem that the prior art performs poorly in processing large-scale data sets or scenarios requiring real-time response, reduce the loss of key information or avoid untimely processing, and effectively determine the category of data based on the distance between each piece of data and the cluster center, which can improve the performance and security of the real-time monitoring system. The method uses a GPU to accelerate the calculation, which significantly reduces the computational complexity and running time. In addition, the method also has the characteristic of dynamically adjusting the number of cluster categories, and is no longer limited to a fixed number. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] 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 the structures shown in these drawings without paying creative work.
[0040] Figure 1 It is a main flow chart of a real-time clustering method based on a novel fuzzy C-means in an embodiment of the present invention;
[0041] Figure 2 This is a comparison effect diagram of the SSQ in the embodiment of the present invention with the data stream clustering algorithm clustream;
[0042] Figure 3 This is a graph comparing the clustering time of the embodiment of the present invention with the data stream clustering algorithm clustream;
[0043] Figure 4 This is a clustering result diagram for time period 1 in an embodiment of the present invention;
[0044] Figure 5This is a clustering result diagram for time period 2 in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The technical solution of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is obvious that the described embodiments are part of the embodiments of the present invention, not all of the embodiments, and the implementation of the present invention is not limited to this. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0046] Fuzzy C-Means (FCM) is a clustering analysis method based on fuzzy theory, which is widely used in data mining, pattern recognition, image processing and other fields. This method was proposed by JCBezdek in 1981 and is an important improvement on the traditional hard C-means clustering (i.e. K-Means algorithm).
[0047] In traditional cluster analysis, each data point is strictly classified into a certain category, and this division is called "hard division". However, in many cases in the real world, data points may not belong to a certain category completely, but belong to multiple categories with different membership degrees. The fuzzy C-means algorithm is designed to deal with this situation. It allows data points to belong to all categories with different membership degrees, thus achieving a "soft division". The fuzzy C-means algorithm is a clustering method of soft clustering. The idea of this method is to use membership degrees to represent the relationship between each data point, thereby determining the clustering cluster to which each data point belongs.
[0048] The basic idea of the fuzzy C-means algorithm is to optimize the clustering results by minimizing the objective function. This objective function is usually defined as the sum of the weighted distances from each data point to each cluster center, where the weight is the membership of the data point to each category. The membership matrix and cluster center are updated iteratively until the objective function converges or the preset number of iterations is reached.
[0049] The objective optimization function J of the fuzzy C-means algorithm is as follows:
[0050]
[0051] Where M is the number of categories, N is the number of data, and ω is the scaling factor, which is a weighted exponent for controlling the degree of fuzziness. When it approaches 1, the partition is close to hard clustering, and when it approaches infinity, the partition will produce poorly separated clusters. Generally, it is greater than 2. j is the jth data, c i is the i-th cluster center, u ij is the membership of the jth data in the i-th class, satisfying the following conditions:
[0052]
[0053] The purpose of the algorithm is to satisfy Under the condition of , the objective optimization function J reaches the minimum value.
[0054] Obviously, this is a problem that can be solved using the Lagrange multiplier method, so let the optimization function be as follows:
[0055]
[0056] To u ij Any membership parameter u in kj Taking partial derivatives we get:
[0057]
[0058] Among them, k∈[1,2,…,M], the purpose of taking k is to distinguish it from i in the following summation symbol, c k is the kth cluster center, and the membership parameter u kj is the membership of the j-th data in the k-th class.
[0059] make
[0060]
[0061] The solution is:
[0062]
[0063] The algorithm flow of the fuzzy C-means algorithm is as follows:
[0064] 1. First, randomly select M cluster centers and use the membership formula to calculate the membership parameter u of each data. kj , the membership formula is:
[0065]
[0066] 2. Then update the cluster center, the kth cluster center c k as follows:
[0067]
[0068] 3. Follow the above steps 1-2 for t+1 times, iteratively update the membership parameters and cluster centers. When the tth objective function J (t) and the t+1th objective function J (t+1) satisfy:
[0069] J (t+1)-J (t) →0
[0070] The objective function converges, the loop ends, and the clustering result is optimized by minimizing the objective function.
[0071] Embodiment 1:
[0072] like Figure 1 As shown in the figure, it is a main flow chart of a real-time clustering method based on a novel fuzzy C-means. The real-time clustering method based on a novel fuzzy C-means described in the present invention is applied to network intrusion detection, and effectively judges the category of data according to the distance between each piece of data and the cluster center, which can improve the performance and security of the real-time monitoring system. The method specifically includes the following steps:
[0073] S1. Optimizing the objective function to obtain an optimized objective function, and calculating a new cluster center update formula based on the optimized objective function;
[0074] Specifically, step S1 includes the following steps:
[0075] (1) Redefine the objective function and optimize it. For real-time data, the earlier the data, the less effect it has on the system. The objective function can be optimized to obtain the optimized objective function. The optimized objective function is as follows:
[0076]
[0077] Where M is the number of categories, N is the number of data, and ω is the scaling factor, which is a weighted exponent to control the degree of fuzziness. When ω approaches 1, the partition is close to hard clustering. When ω approaches infinity, the partition will produce poorly separated clusters. ω is generally greater than 2; x j is the jth data, c i is the i-th class, u ij is the membership of the jth data in the i-th class. β is a coefficient between (0,1), which is the force attenuation coefficient, used to control the attenuation ratio of the data force at different times in the time series. The closer j is to 1, the newer the data is. Similarly, the data also satisfies:
[0078]
[0079] (2) Determine a new cluster center update formula. Use the Lagrange multiplier method to update u ij Any membership parameter u in kj and cluster center c k Find partial derivatives:
[0080]
[0081] Let the partial derivative equal to 0 and solve, the membership formula is:
[0082]
[0083] Calculate the cluster center c k :
[0084]
[0085] make Where T represents the number of iterations, and its value is equal to N, we can get:
[0086]
[0087] because so
[0088]
[0089] Similarly, so
[0090]
[0091] Therefore, we get the new cluster center update formula:
[0092]
[0093] Among them, u kj for u ij Any membership parameter in c k c i Any class in , T represents the number of iterations.
[0094] S2, receiving data streams (data received at regular intervals), clustering based on the optimized objective function and the new cluster center update formula, and after the update, determining the category of the data stream based on the distance between each piece of data and the cluster center.
[0095] The data stream category described by the data stream of this scheme is a numerical vector. For example, two sensors, temperature and humidity, both send a piece of data, {temperature: a, humidity: b}, where (a, b) is the received data. The category of the data stream refers to the category to which (a, b) belongs. Many received data are very close to (a, b) in Euclidean distance, so they belong to the same category.
[0096] In practical applications, we often encounter data from the same source and / or different sources. Among them, the same source data is characterized by the fact that each observation element in a set of quantities to be observed has only one observation subject to collect data, such as a set of quantities to be observed: temperature and humidity, but only one temperature sensor and one humidity sensor to observe and upload data. At the same time, data that is transmitted very frequently is called high-flow data. Different source data is characterized by the fact that each observation element in a set of quantities to be observed has multiple observation subjects to collect data, such as a set of quantities to be observed: temperature and humidity, with multiple temperature sensors and multiple humidity sensors to observe and upload data. If there are multiple sets of quantities to be observed, each set of quantities to be observed has multiple elements to be observed. If each element in each set of quantities to be observed is the same, then this belongs to the same distribution. On the contrary, if they are not exactly the same, they do not belong to the same distribution.
[0097] When the received data stream is non-high-traffic data from the same source, step S2 includes the following steps:
[0098] S211, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm.
[0099] When the amount of data is insufficient, accumulate the amount of data. When the amount of data is sufficient, randomly select the cluster centers of M classes according to the fuzzy C-means algorithm. The purpose of obtaining the cluster centers of M classes is to calculate the membership of each data to each class. The purpose of calculating the membership of each data to each class is to facilitate the subsequent steps to update the cluster centers, otherwise the cluster centers cannot be updated. This step represents the first iteration, and updating the cluster centers is a continuous iterative process.
[0100] S212. Since non-high-traffic data transmission is not very frequent, one piece of received new data can be processed at a time, and the membership of each piece of new data j to each class is calculated by the membership formula:
[0101]
[0102] S213, based on the membership of each class of the new data j, the cluster center is updated by a new cluster center update formula:
[0103]
[0104] S214, repeating steps S212-S213 until the optimized objective function converges, obtaining the cluster center of each new data, and determining the category of the data stream according to the distance between each data and the cluster center.
[0105] When the received data stream is high-traffic data from the same source, step S2 includes the following steps:
[0106] S221. Receive some data and randomly select cluster centers of M classes according to the fuzzy C-means algorithm.
[0107] When the amount of data is insufficient, the data is accumulated. When the amount of data is sufficient, the cluster centers of M classes are randomly selected according to the fuzzy C-means algorithm.
[0108] S222. Due to the arrival of high-volume data, it is necessary to process multiple new data from the same source at the same time. When multiple new data are received, the membership of each data j in the multiple data to each class is calculated through the membership formula to obtain the membership vector u of the multiple data. k :
[0109]
[0110] Among them, j∈[1,2,…,r], r represents the number of new data.
[0111] S223, membership vector u based on r pieces of data k , update the cluster center by the following formula:
[0112]
[0113] Among them, d represents an array of natural numbers starting from 0, and r is the number of data.
[0114] S224. Repeat steps S222-S223 until the optimized objective function converges, obtain the cluster center of each new data, and determine the category of the data stream based on the distance between each data and the cluster center.
[0115] When the received data streams are data of the same distribution from different sources, step S2 includes the following steps:
[0116] S231. Receive some data and randomly select cluster centers of M classes according to the fuzzy C-means algorithm.
[0117] When the amount of data is insufficient, the data is accumulated. When the amount of data is sufficient, the cluster centers of M classes are randomly selected according to the fuzzy C-means algorithm.
[0118] S232, using the membership formula to find the membership of each data j in the multiple data to each class, and obtain the membership vector u of the multiple data k :
[0119]
[0120] Among them, j∈[1,2,…,r], r represents the number of new data.
[0121] S233, membership vector u based on multiple data k , update the cluster center by the following formula:
[0122]
[0123] Among them, r is the number of data.
[0124] S234, repeating steps S232-S233 until the optimized objective function converges, obtaining the cluster center of each new data, and determining the category of the data stream according to the distance between each data and the cluster center.
[0125] In this embodiment, the KDDCUP99 data set is used for experimental verification. The KDDCUP99 data set was released by the Advanced Research Projects Agency (DARPA) of the U.S. Department of Defense in 1999 and is used to simulate normal and abnormal network traffic in the local area network environment of the U.S. Air Force. The data set contains various types of network attacks, such as denial of service attacks (DOS), probe attacks (Probe), user-to-root attacks (U2R) and escalation of privilege attacks (R2L). Each record contains 41 feature attributes, including basic connection features, content features, traffic statistics features, and host network traffic features. In the experimental process, the data stream clustering algorithm cluStream is used as the control group, and the evaluation indicators selected are SSQ (the sum of the squares of the distance) and the algorithm running time.
[0126] The experimental parameters are set as follows: the flow rate is set to 200, the maximum selected historical data is 256, the decay rate of this method is set to 0.8, the maximum number of clusters is set to 20, and the number of fine-grained clusters of the data stream clustering algorithm cluStream is set to 20.
[0127] This experiment uses SSQ to evaluate the clustering quality of the two algorithms. SSQ evaluates the clustering quality of the clustering algorithm by calculating the distance from each data point to the nearest cluster center. Figure 2 As shown in the figure, the SSQ comparison effect diagram of the present invention and the data stream clustering algorithm cluStream, the horizontal axis is the unit time (each unit time is the time of one flow), and the vertical axis is SSQ. It can be seen that although the clustering quality of the present method is not better than that of the data stream clustering algorithm cluStream, the gap is not too big.
[0128] like Figure 3As shown, the clustering time comparison effect diagram of the present invention and the data stream clustering algorithm cluStream. This experiment compares the clustering time of the data stream clustering algorithm cluStream and the present method. The horizontal axis is the number of data (in K), and the vertical axis is the time spent (in s). It can be seen that in terms of the time used for clustering, the present method is obviously better than the data stream clustering algorithm cluStream.
[0129] In order to illustrate the feasibility of this method, this experiment will generate 4 clusters in time period 1 and 5 clusters in time period 2, and show the clustering effect. The decay is selected as 0.95, v is selected as 0.9, and the number of clusters is selected as the maximum number of clusters that may be generated in this experiment, 5. Figure 4 As shown, the clustering result diagram for time period 1 is as follows: Figure 5 As shown in the figure, the clustering result diagram of time period 1, black represents the cluster center, dark gray represents the points in time period 1, and light gray represents the points in time period 2. From the calculation results, it can be seen that this method performs better when processing high-traffic data. Compared with traditional real-time clustering algorithms, the computational complexity and running time are significantly reduced because GPU can be used for accelerated calculations. In addition, this method can also dynamically adjust the number of cluster categories.
[0130] The present invention proposes a real-time clustering method based on a novel fuzzy C-means, which can be used in network intrusion behavior detection systems. It utilizes the importance attenuation characteristics of streaming data to enable it to process some high data flows whose boundaries are not absolutely clear, thereby solving the problem that the prior art performs poorly in processing large-scale data sets or scenarios that require real-time response, reducing the loss of key information or avoiding untimely processing, and improving the performance and security of real-time monitoring systems. Based on the novel fuzzy C-means real-time clustering method, it not only maintains the clustering effect of the algorithm, but also gives it the ability to adapt to real-time data processing needs, especially when processing high-flow data. The method can use GPUs for accelerated computing, significantly reducing computational complexity and running time. In addition, the method also has the characteristic of dynamically adjusting the number of clustering categories, and is no longer limited to a fixed number.
[0131] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A real-time clustering method based on a novel fuzzy C-means, characterized in that: The following steps are involved: S1. Optimize the objective function to obtain an optimized objective function, and calculate a new cluster center update formula based on the optimized objective function; The objective function of the optimization is as follows: Among them, J is the objective function, M is the number of categories, N is the number of data, ω is the scaling factor; x j is the jth data, c i is the i-th class, u ij is the membership of the j-th data in the i-th class, and β is a coefficient between (0,1); S2. Receive data streams, perform clustering based on the optimized objective function and the new cluster center update formula, and determine the data category based on the distance between each piece of data and the cluster center.
2. A real-time clustering method based on a novel fuzzy C-means according to claim 1, characterized in that: The new cluster center update formula is: Among them, c k c i Any class in u kj for u ij Any membership parameter in , T represents the number of iterations.
3. A real-time clustering method based on a novel fuzzy C-means according to claim 2, characterized in that: When the received data stream is non-high-traffic data from the same source, step S2 includes the following steps: S211, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm; S212, calculating the membership of each new data to each class through the membership formula; S213, based on the membership of the new data to each class, updating the cluster center by a new cluster center updating formula; S214, repeating steps S212-S213 until the optimized objective function converges, obtaining the cluster center of each new data, and determining the category of the data stream according to the distance between each data and the cluster center.
4. A real-time clustering method based on a novel fuzzy C-means according to claim 2, characterized in that: When the received data stream is high-traffic data from the same source, step S2 includes the following steps: S221, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm; S222, simultaneously processing multiple pieces of new data, calculating the membership of each piece of data in the multiple pieces of data to each class through the membership formula, and obtaining the membership vectors of the multiple pieces of data; S223, based on the membership vectors of the multiple data, update the cluster center by the following formula; d=[0,1,2,...,r-1]; Among them, d represents a natural number array starting from 0, and r is the number of data; S224. Repeat steps S222-S223 until the optimized objective function converges, obtain the cluster center of each new data, and determine the category of the data stream based on the distance between each data and the cluster center.
5. A real-time clustering method based on a novel fuzzy C-means according to claim 2, characterized in that: When the received data streams are data of the same distribution from different sources, step S2 includes the following steps: S231, receiving a number of data, and randomly selecting cluster centers of M classes according to the fuzzy C-means algorithm; S232, simultaneously processing multiple new data, calculating the membership of each data j in the multiple data to each class through the membership formula, and obtaining the membership vector of the multiple data; S233, based on the membership vectors of the multiple data, update the cluster center by the following formula; Where r is the number of data; S234, repeating steps S232-S233 until the optimized objective function converges, obtaining the cluster center of each new data, and determining the category of the data stream according to the distance between each data and the cluster center.
6. A real-time clustering method based on a novel fuzzy C-means according to any one of claims 3 to 5, characterized in that: The membership formula is: Among them, M is the number of categories, N is the number of data, ω is the scaling factor, and x j is the jth data, c i is the i-th class, c k c i Any class in u ij is the membership of the j-th data in the i-th class.
Citation Information
Cited By
Medical examination index reduction method based on mixed fuzzy conditional entropy
CN121054283A
