WO2016177146A1 - 一种网络流量数据的分类方法及装置 - Google Patents

一种网络流量数据的分类方法及装置 Download PDF

Info

Publication number
WO2016177146A1
WO2016177146A1 PCT/CN2016/076788 CN2016076788W WO2016177146A1 WO 2016177146 A1 WO2016177146 A1 WO 2016177146A1 CN 2016076788 W CN2016076788 W CN 2016076788W WO 2016177146 A1 WO2016177146 A1 WO 2016177146A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
traffic data
classification
traffic
center
Prior art date
Application number
PCT/CN2016/076788
Other languages
English (en)
French (fr)
Inventor
黄志忠
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016177146A1 publication Critical patent/WO2016177146A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16BBIOINFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR GENETIC OR PROTEIN-RELATED DATA PROCESSING IN COMPUTATIONAL MOLECULAR BIOLOGY
    • G16B40/00ICT specially adapted for biostatistics; ICT specially adapted for bioinformatics-related machine learning or data mining, e.g. knowledge discovery or pattern finding
    • G16B40/20Supervised data analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/142Network analysis or design using statistical or mathematical methods
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16BBIOINFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR GENETIC OR PROTEIN-RELATED DATA PROCESSING IN COMPUTATIONAL MOLECULAR BIOLOGY
    • G16B40/00ICT specially adapted for biostatistics; ICT specially adapted for bioinformatics-related machine learning or data mining, e.g. knowledge discovery or pattern finding

Definitions

  • the present invention relates to the field of data management for data communication, and in particular to a method and device for classifying network traffic data.
  • the network traffic classification methods adopted in the prior art mainly include methods based on port number mapping, payload-based analysis, and machine-based learning.
  • methods based on port number mapping with the continuous development of Internet technology, many emerging network services (such as P2P, online games, etc.) use dynamic negotiated port numbers for communication, so that the method based on port number mapping cannot This method is subject to many limitations due to the accuracy of network traffic analysis and statistics.
  • IANA The Internet Assigned Numbers Authority
  • the server port number can be dynamically allocated; 3) different services can be packaged into familiar applications; 4) various services with different QoS (Quality of Service) can use the same port number.
  • QoS Quality of Service
  • the main problems include: 1) The method can only identify those traffic that can obtain certain keywords, but cannot classify other unknown traffic; 2) This technology needs higher Processing and storage capabilities; 3) payload analysis can violate confidentiality and security. Therefore, its development will also receive some resistance.
  • the above method has a situation in which the traffic data cannot be comprehensively classified in the classification management of network traffic.
  • the embodiment of the invention provides a method and a device for classifying network traffic data, which solves the problem that the prior art cannot classify all traffic data in a non-discriminatory manner.
  • an embodiment of the present invention provides a method for classifying network traffic data, including:
  • each traffic data in each type is sampled multiple times, and the number of successful sampling times and the number of sampling failures are obtained, and the sampling times of the traffic data in the same class are the same;
  • the traffic data is re-classified according to a preset classification rule according to the weight of each traffic data in its class; the N and K are both positive integers.
  • the uncertainty probability of each data traffic in its class includes:
  • the expectations of each data flow in its class include:
  • the A1 and A2 are respectively a set of successful sampling of each traffic data and a set of sampling failures; the p1 and p2 are respectively a probability of success of each traffic data sampling and a probability of failure; the n i is a subset A1 The number of sample sets, p i is the number of sample sets of the subset A2; the p is the total number of successful sampling of each data flow in the N traffic data samples; the n is the N traffic data samples The total number of times each data traffic sample fails; the mi is the traffic data in the traffic data sample, the i represents the label of the data traffic element in each class, and t is the traffic data sample in each class number.
  • each data traffic is simplified after the uncertainty probability and expectation of its class: the uncertainty probability of each data flow in its class for: The expectation of each data flow in its class is:
  • calculating the weight of each traffic data in its class according to the expected and uncertainty probability includes:
  • the weight of each flow data is obtained according to the information gain:
  • the i is a label of a certain traffic data
  • the j is a label of traffic data in the same class
  • the k is the number of traffic data in each class.
  • re-classifying the traffic data according to a preset classification rule according to the weight of each traffic data in its class includes:
  • the corresponding traffic data with the closest weight value is grouped into the same group; or the difference between the weight values is from two to two pairs
  • the traffic data should be grouped into the same group.
  • dividing the N data traffic samples into K categories according to the data volume size of each traffic data sample includes:
  • each classification data and the corresponding shortest distance classification center are taken as the same group, and K classification groups are obtained.
  • selecting K classification centers according to a preset rule includes the following steps:
  • Dist i1 is the distance of the data volume size of each traffic data to the first classification center
  • dist i2 is the distance of the data volume size of each traffic data to the second classification center
  • the N data traffic samples are divided into K categories according to the data volume size of each traffic data sample, and after the K classification groups are obtained, the method further includes:
  • Step 2 Calculate the mean of the classification center of the initial classification as the new classification center: 0 ⁇ j ⁇ k, where ni is the number of data points in the cluster ⁇ i, and ⁇ i is the ith classification;
  • Step 3 Recalculate the distance of each traffic data to the new classification center, and group each data and the nearest classification center into one group;
  • Step 4 Calculate the error squared criterion function as follows: Where x k (j) represents the kth data element in the jth class ⁇ j;
  • an embodiment of the present invention further provides a device for classifying network traffic data, including:
  • a data acquisition module configured to acquire N traffic data samples from the network data stream, and obtain a data volume size of each traffic data sample and an identifier of each traffic data sample;
  • a first classification module configured to divide the N data traffic samples into K classes according to a data volume size of each traffic data sample
  • the data sampling module is configured to separately sample each traffic data in each type according to the identifier of each traffic data sample, and obtain the number of successful sampling times and the number of sampling failures, and sampling the traffic data in the same class. The same number of times;
  • a parameter calculation module configured to obtain a probability and a probability of uncertainty of each flow data in a corresponding class according to the number of successful samplings and the number of sampling failures;
  • the weight module is configured to calculate a weight of each traffic data in its class according to the expected and uncertainty probability
  • the second classification module is configured to re-classify the traffic data according to a preset classification rule according to the weight of each traffic data in its class; the N and K are both positive integers.
  • the parameter calculation module is configured to have an expectation and an uncertainty probability of each flow data in its corresponding class according to the following formula: each data flow is uncertain in its class Sexual probabilities include:
  • the expectations of each data flow in its class include:
  • the A1 and A2 are respectively a set of successful sampling of each traffic data and a set of sampling failures; the p1 and p2 are respectively a probability of success of each traffic data sampling and a probability of failure; the n i is a subset A1 The number of sample sets, p i is the number of sample sets of the subset A2; the p is the total number of successful sampling of each data flow in the N traffic data samples; the n is the N traffic data samples The total number of times each data traffic sample fails; the mi is the traffic data in the traffic data sample, the i represents the label of the data traffic element in each class, and t is the traffic data sample in each class number.
  • each data traffic is simplified after the uncertainty probability and expectation of its class: the uncertainty of each data traffic in its class
  • the probability of sex is:
  • the expectation of each data flow in its class is:
  • the weight of each flow data is obtained according to the information gain:
  • the i is a label of a certain traffic data
  • the j is a label of traffic data in the same class
  • the k is the number of traffic data in each class.
  • the second classification module is configured to group the corresponding traffic data with the closest weight values into the same group; or to divide the difference between the weight values from large to small.
  • the corresponding traffic data is grouped into the same group.
  • the first classification module includes:
  • the classification center determining sub-module is configured to select K classification centers in the set of data volume sizes of the traffic data samples according to a preset rule
  • the distance calculation submodule is configured to separately calculate a distance between each flow data and a data volume size of each classification center;
  • the classification sub-module is set to take the data volume size of each classification data and the corresponding shortest distance classification center as the same group, and obtain K classification groups.
  • the classification center determining submodule is specifically configured as:
  • Dist i1 is the distance of the data volume size of each traffic data to the first classification center
  • dist i2 is the distance of the data volume size of each traffic data to the second classification center
  • the first classification center module is specifically configured to:
  • Step 2 Calculate the mean of the classification center of the initial classification as the new classification center: 0 ⁇ j ⁇ k, where ni is the number of data points in the cluster ⁇ i, and ⁇ i is the ith classification;
  • Step 3 Recalculate the distance of each traffic data to the new classification center, and group each data and the nearest classification center into one group;
  • Step 4 Calculate the error squared criterion function as follows: Where x k (j) represents the kth data element in the jth class ⁇ j;
  • a computer storage medium is further provided, and the computer storage medium may store an execution instruction for performing the classification method of the network traffic data in the foregoing embodiment.
  • the method and device for classifying network traffic data provided by the embodiment of the present invention firstly classify the traffic data samples obtained from the network data stream according to the size of the data volume, and then perform the traffic data of the preliminary classification. After subsampling, the traffic data is reclassified according to the weight of the occurrence of the traffic data in its class.
  • the scheme does not need to consider the type of the application or the associated word corresponding to the application, and only needs to obtain the data volume of the traffic data and the weights appearing in the second sampling process.
  • the traffic data can be sampled to make the traffic classification process simpler, more efficient, and more accurate.
  • an effective classification rule is obtained from the unordered and irregular instance set; Inductive learning, classification based on weights, enables accurate classification of unknown types of traffic samples.
  • FIG. 1 is a schematic flowchart of a method for classifying network traffic data according to Embodiment 1 of the present invention
  • FIG. 2 to FIG. 7 are schematic diagrams showing changes in the process of classifying traffic data using a binary tree according to Embodiment 1 of the present invention.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • the method for classifying network traffic data includes:
  • S101 Obtain N traffic data samples from the network data stream, and obtain a data volume size of each traffic data sample and an identifier of each traffic data sample; the data volume size of each traffic data sample is the traffic data itself.
  • the storage space occupied by the traffic data sample is an identifier that distinguishes the traffic data from the other traffic data, and may include: a preset identifier of the traffic data or the traffic data itself;
  • the N traffic data samples are classified into the K class according to the data volume size of each traffic data sample.
  • the method may include: classifying the data volume of the traffic data into the same class; or calculating the data volume of the traffic data. From the difference Sorting up to the order of the smallest difference; or classifying the data size of the traffic data according to the values of K and N;
  • S103 Perform, according to the identifier of each traffic data sample, multiple times for each traffic data in each type, and obtain the number of successful sampling times and the number of sampling failures, and the sampling times of the traffic data in the same class are the same;
  • the identifier of each traffic data sample is itself, the sampling traffic data is compared with the corresponding traffic data. If the same, the sampling is successful. If not, the sampling fails; the traffic data in different classes The number of sampling times may be the same or different;
  • S104 Obtain a probability of expectation and uncertainty of each traffic data in its corresponding class according to the number of successful sampling and the number of sampling failures;
  • S105 Calculate, according to the expected and uncertainty probability, a weight of each traffic data in its class
  • S106 Reclassify the traffic data according to a preset classification rule according to the weight of each traffic data in its class; the N and K are both positive integers.
  • the i is a label of a certain traffic data
  • the j is a label of traffic data in the same class
  • the k is the number of traffic data in each class.
  • Step S106 reclassifying the traffic data according to a preset classification rule according to the weight of each traffic data in the class: including: mapping the corresponding traffic data with the closest weight values into the same group, specifically, setting a preset The weights are close to each other, and the corresponding weight comparison values in each group are set, the weight values of the respective flow data are compared with the weight comparison values in each group, and the compared values are classified into corresponding values within the preset weights.
  • the weight comparison value is within the group; or the traffic data corresponding to the difference between the weight values from the largest to the smallest is grouped into the same group. Specifically, each traffic data is subtracted two by two, and the difference is from large to Small corresponding traffic data is grouped into the same group.
  • the set F ⁇ T1, T2, T3, ... ⁇ , wherein each binary tree Ti has only one root node with a weight of ⁇ i , and the left and right subtrees are all empty; the weights of the two root nodes are selected in the F set
  • Step S102 according to the data volume size of each traffic data sample, dividing the N data traffic samples into K categories includes: selecting K classification centers in a set of data volume sizes of traffic data samples according to a preset rule; respectively calculating each traffic The distance between the data and the data volume size of each classification center; the data size of each classification data and the corresponding shortest distance classification center are taken as the same group, and K classification groups are obtained.
  • the specific steps include:
  • Step 1 Determine the K value and initialize the classification center, and select K initial classification centers
  • k initial classification centers are determined by a heuristic method of maximum and minimum distance:
  • Step 2 Calculate the distance of each data to the K classification centers, and group each data and the nearest classification center into a group to form K initial classifications;
  • I is the iterative calculation order number
  • ⁇ j represents the jth classification
  • its classification center is Center j (I).
  • the collected data is divided into ⁇ 1, ⁇ 2, ..., ⁇ k classes, for a total of k classes.
  • Step 3 Calculate the center of gravity (or mean) of the initial classification center, as a new classification center, recalculate the distance of each data to the classification center (or mean), and divide each data and the nearest classification center into a group;
  • ni is the number of data points in the cluster ⁇ i
  • ⁇ i is the i-th classification in the above steps 1, 2.
  • the error squared criterion function is as follows:
  • x k (j) represents k data elements in the j-th class ⁇ j in the above.
  • Centerj(I) is a new classification center, and each element in the ⁇ j classification is subtracted from the classification center Centerj(I), and the sum of squared errors is obtained. Repeat steps 2 and 3 until there is no significant change in the classification center or mean.
  • Sorting them according to the size of the weight includes the following steps:
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the embodiment provides a network traffic data classification device, and the classification device includes: a data acquisition module, configured to acquire N traffic data samples from the network data flow, and obtain a data volume size and each for each traffic data sample.
  • An identifier of the traffic data sample is configured to divide the N data traffic samples into K classes according to the data volume size of each traffic data sample; and the data sampling module is configured to be according to each of the traffic data samples.
  • the identifier separately samples each traffic data in each category, and obtains the number of successful sampling times and the number of sampling failures.
  • the sampling times of the traffic data in the same class are the same; the parameter calculation module is set to succeed according to the sampling.
  • the number of times and the number of sampling failures obtain the expected and uncertainty probabilities of each traffic data in its corresponding class;
  • the weighting module is configured to calculate the weight of each traffic data in its class according to the expected and uncertainty probabilities;
  • the second classification module is configured to follow the preset classification rule according to the weight of each traffic data in its class Said flow data for re-classification; the N and K are positive integers.
  • the A1 and A2 are respectively a set of successful sampling of each traffic data and a set of sampling failures; the p1 and p2 are respectively a probability of success of each traffic data sampling and a probability of failure; the n i is a subset A1 The number of sample sets, p i is the number of sample sets of the subset A2; the p is the total number of successful sampling of each data flow in the N traffic data samples; the n is the N traffic data samples The total number of times each data traffic sample fails; the mi is the traffic data in the traffic data sample, the i represents the label of the data traffic element in each class, and t is the traffic data sample in each class number;
  • each data flow is simplified after the uncertainty probability and expectation of its class: the uncertainty probability of each data flow in its class is: The expectation of each data flow in its class is:
  • the second classification module is configured to group the corresponding traffic data with the closest weight values into the same group; or divide the traffic data corresponding to the difference between the weight values from the largest to the smallest into the same group.
  • the first classification module includes: a classification center determining sub-module, configured to select K classification centers in a set of data volume sizes of traffic data samples according to a preset rule; and the distance calculation sub-module is configured to separately calculate each traffic data and The distance of the data volume size of each classification center; the classification sub-module is set to take the data volume size of each classification data and the corresponding shortest distance classification center as the same group, and obtain K classification groups.
  • the present invention initially classifies the traffic data samples obtained from the network data stream according to the size of the data volume, and then performs the multiple sampling of the traffic data after the preliminary classification, according to the traffic data in the class in which it is located.
  • the weight size that appears is reclassified.
  • the scheme does not need to consider the type of the application or the associated word corresponding to the application, and only needs to obtain the data volume of the traffic data and the weights appearing in the second sampling process.
  • the traffic data can be sampled to make the traffic classification process simpler, more efficient, and more accurate.
  • an effective classification rule is obtained from the unordered and irregular instance set; Inductive learning, classification based on weights, enables accurate classification of unknown types of traffic samples.
  • the method and device for classifying network traffic data provided by the embodiments of the present invention are first obtained by acquiring data from a network data stream.
  • the traffic data samples are initially classified according to the amount of data, and then, after the preliminary classification of the traffic data is sampled multiple times, the flow data is reclassified according to the weight of the traffic in the class in which it is located.
  • the scheme does not need to consider the type of the application or the associated word corresponding to the application, and only needs to obtain the data volume of the traffic data and the weights appearing in the second sampling process.
  • the traffic data can be sampled to make the traffic classification process simpler, more efficient, and more accurate.
  • an effective classification rule is obtained from the unordered and irregular instance set; Inductive learning, classification based on weights, enables accurate classification of unknown types of traffic samples.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Medical Informatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Biophysics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Theoretical Computer Science (AREA)
  • Spectroscopy & Molecular Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Biotechnology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Bioethics (AREA)
  • Software Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Databases & Information Systems (AREA)
  • Epidemiology (AREA)
  • Evolutionary Computation (AREA)
  • Public Health (AREA)
  • Algebra (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Probability & Statistics with Applications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种网络流量数据的分类方法及装置,从网络数据流中获取N个流量数据样本,并获取每个流量数据的数据量大小及每个流量数据的标识;根据每个流量数据的数据量大小将N个流量数据分成K类;根据每个流量数据的标识分别对各类中的每个流量数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;根据采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;根据期望及不确定性概率计算每个流量数据在其所在类中的权重;根据各流量数据在其所在类中的权重按照预设分类规则对流量数据进行再分类。解决现有技术无法对所有流量数据无规则地进行分类的问题。

Description

一种网络流量数据的分类方法及装置 技术领域
本发明涉及数据通信的数据管理领域,具体涉及一种网络流量数据的分类方法及装置。
背景技术
目前,在现有技术中采用的网络流量分类方法主要包括基于端口号映射、基于有效载荷分析、基于机器学习等方法。例如,在基于端口号映射的流量分类中,随着互联网技术的不断发展,许多新兴的网络服务(如P2P、在线游戏等)采用动态协商的端口号进行通信,使得基于端口号映射的方法不能保证完全准确的网络流量分析和统计,因而该方法因此受到很多限制。主要表现在:1)端口号和应用之间不是总是关联的,IANA(The Internet Assigned Numbers Authority,互联网数字分配机构)没有为所有的应用都定义端口号,尤其是一些新的应用;2)服务器的端口号可以动态分配;3)不同的服务可以包装成熟悉的应用;4)具有不同的QoS(Quality of Service,服务质量)的各种服务可以使用相同的端口号。在基于有效载荷分析的流量分类,主要存在的问题包括:1)该方法只能识别出那些可以获得某些关键词的流量,却无法分类其它未知的流量;2)这种技术需要较高的处理和存储能力;3)有效载荷分析会侵犯秘密和安全性。因此其发展也会受到一些阻力。而在基于机器学习的流量分类中,目前机器学习的方法在网络流量分类中的应用还处于发展阶段,基本都是基于有监督学习的流量分类方法或者基于无监督的流量分类方法进行处理,但是这两种方法都存在先天的不足:1)有监督学习方法无法发现新的应用模式;2)无监督分类方法必须对划分结果形成分类器,才能对未知流量判断其应用类型。
综上所述,上述方法在网络流量的分类管理中都存在不能全面地对流量数据进行分类的情况。
发明内容
本发明实施例提供了一种网络流量数据的分类方法及装置,解决现有技术中无法对所有流量数据一视同仁地进行分类的问题。
为解决上述技术问题,本发明实施例提供一种网络流量数据的分类方法,包括:
从网络数据流中获取N个流量数据样本,并获取每个流量数据样本的数据量大小及每个流量数据样本的标识;
根据每个流量数据样本的数据量大小将所述N个流量数据样本分成K类;
根据所述每个流量数据样本的标识分别对各类中的每个流量数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;
根据所述采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;
根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重;
根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类;所述N和K都为正整数。
在本发明实施例的一种实施方式中,每个数据流量在其所在类的不确定性概率包括:
INFO(A1,A2)=–p1 ㏒ 2(p1)–p2 ㏒ 2(p2);
每个数据流量在其所在类的期望包括:
Figure PCTCN2016076788-appb-000001
所述A1和A2分别为每个流量数据采样成功的集合及采样失败的集合;所述p1和p2分别为每个流量数据采样成功的概率及失败的概率;所述ni为子集A1的样本集合个数,pi为子集A2的样本集合个数;所述p为所述N个流量数据样本中各个数据流量采样成功的总次数;所述n为所述N个流量数据样本中各个数据流量采样失败的总次数;所述mi为所述流量数据样本中的流量数据,所述i表示每个类中数据流量元素的标号,t为每个类中的流量数据样本的个数。
在本发明的一种实施方式中,根据麦克劳林公式对每个数据流量在其所在类的不确定性概率及期望进行简化处理后得到:每个数据流量在其所在类的不确定性概率为:
Figure PCTCN2016076788-appb-000002
每个数据流量在其所在类的期望为:
Figure PCTCN2016076788-appb-000003
在本发明实施例的一种实施方式中,根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重包括:
根据所述期望及不确定性概率得到每个流量数据在其所在类的信息增益为:Gain(mi)=INFO(A1,A2)-E(mi);
根据所述信息增益得到每个流量数据的权重为:
Figure PCTCN2016076788-appb-000004
所述i为某一个流量数据的标号,所述j为同一类中流量数据的标号,所述k为每类中流量数据的个数。
在本发明实施例的一种实施方式中,根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类包括:
将权重值最相近的对应的流量数据归为同一组;或将权重值之间的差值由大到小两两对 应的流量数据归为同一组。
在本发明实施例的一种实施方式中,根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类包括:
根据预设规则在流量数据样本的数据量大小的集合中选取K个分类中心;
分别计算各个流量数据与各个分类中心的数据量大小的距离;
将每个流量数据与其对应的最短距离的分类中心的数据量大小作为同一组,得到K个分类组。
在本发明实施例的一种实施方式中,根据预设规则选取K个分类中心包括以下步骤:
(1)在待分类的流量数据样本的数据量大小集合{x1,x2,…,xN}中,任意选取一个流量数据x1作为第一个分类中心Center1;
(2)计算样本集合中各个样本的数据量大小到所述第一分类中心的距离:||xi-Center1||,其中i=1,2,…,N;
(3)若||xj-Center1||=max{||xi-Center1||,i=1,2,...,N},j=1,2,…,N,那么xj作为第2个分类中心Center2=xj;
(4)逐个计算各个样本数据量大小{x1,x2,…,xN}与{Center1,Center2}之间的距离:
Figure PCTCN2016076788-appb-000005
disti1为各个流量数据到第一分类中心的数据量大小的距离,disti2为各个流量数据到第二分类中心的数据量大小的距离;
(5)选取各个分类中心的最小距离,并在各个最小距离中选取最大距离作为第三分类中心Center3:若min(dj1,dj2,...,djr)=max{min(di1,di2,...,dir)i=1,2,...,N}j=1,2,...,N,那么Center3=xj;
(6)假设已经找到r个(r<K)个分类中心{Center1,Center2,…,Centerr},现在确定第r+1个分类中心,即第r+1个分类中心为:
min(distj1,distj2,...,distjr)=max{min(disti1,disti2,...,distir)i=1,2,...,N}j=1,2,...,N
则:Centerr+1=xj;重复上述步骤四,直到r+1=k为止;
已选取k个初始分类中心Center1(1),Center2(1),Centerk(1),括号内的序号为寻找分类中心迭代计算的次序号。
在本发明实施例的一种实施方式中,根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类中在得到K个分类组后还包括:
步骤一:
若d(xi,Centerj(I))=min{||xi-Centerj(I)||i=1,2,...,N}j=1,2,...,N;则xi∈ωj(I),ωj表示第j个分类,其分类中心为Centerj(I);假设对所采集的数据分成ω1、ω2、…,ωk个类,共计K个类;
步骤二:计算初始分类的分类中心的均值作为新的分类中心:
Figure PCTCN2016076788-appb-000006
0≤j≤k,其中ni是簇ωi中数据点的个数,ωi为第i个分类;
步骤三:重新计算每个流量数据到新的分类中心的数据量大小的距离,将每个数据和最近的分类中心归为一组;
步骤四:计算误差平方和准则函数如下:
Figure PCTCN2016076788-appb-000007
其中xk (j)表示第j个分类ωj中的第k个数据元素;
重复进行步骤一至步骤三,直到分类中心的均值没有预设变化为止:若|Jc(I+1)<Jc(I)|<ξ成立,则算法结束,否则令I=I+1,返回执行步骤一开始。
为解决上述技术问题,本发明实施例还提供一种网络流量数据的分类装置,包括:
数据获取模块,设置为从网络数据流中获取N个流量数据样本,并获取每个流量数据样本的数据量大小及每个流量数据样本的标识;
第一分类模块,设置为根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类;
数据采样模块,设置为根据所述每个流量数据样本的标识分别对各类中的每个流量数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;
参数计算模块,设置为根据所述采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;
权重模块设置为根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重;
第二分类模块,设置为根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类;所述N和K都为正整数。
在本发明实施例的一种实施方式中,所述参数计算模块设置为根据以下公式每个流量数据在其对应类中的期望及不确定性概率:每个数据流量在其所在类的不确定性概率包括:
INFO(A1,A2)=–p1 ㏒ 2(p1)–p2 ㏒ 2(p2);
每个数据流量在其所在类的期望包括:
Figure PCTCN2016076788-appb-000008
所述A1和A2分别为每个流量数据采样成功的集合及采样失败的集合;所述p1和p2分别为每个流量数据采样成功的概率及失败的概率;所述ni为子集A1的样本集合个数,pi为子集A2的样本集合个数;所述p为所述N个流量数据样本中各个数据流量采样成功的总次数;所述n为所述N个流量数据样本中各个数据流量采样失败的总次数;所述mi为所述流量数据样本中的流量数据,所述i表示每个类中数据流量元素的标号,t为每个类中的流量数据样本的个数。
在本发明实施例的一种实施方式中,根据麦克劳林公式对每个数据流量在其所在类的不确定性概率及期望进行简化处理后得到:每个数据流量在其所在类的不确定性概率为:
Figure PCTCN2016076788-appb-000009
每个数据流量在其所在类的期望为:
Figure PCTCN2016076788-appb-000010
在本发明实施例的一种实施方式中,所述权重计算模块具体设置为根据所述期望及不确定性概率得到每个流量数据在其所在类的信息增益为:Gain(mi)=INFO(A1,A2)-E(mi);
根据所述信息增益得到每个流量数据的权重为:
Figure PCTCN2016076788-appb-000011
所述i为某一个流量数据的标号,所述j为同一类中流量数据的标号,所述k为每类中流量数据的个数。
在本发明实施例的一种实施方式中,所述第二分类模块设置为将权重值最相近的对应的流量数据归为同一组;或将权重值之间的差值由大到小两两对应的流量数据归为同一组。
在本发明实施例的一种实施方式中,所述第一分类模块包括:
分类中心确定子模块,设置为根据预设规则在流量数据样本的数据量大小的集合中选取K个分类中心;
距离计算子模块,设置为分别计算各个流量数据与各个分类中心的数据量大小的距离;
分类子模块,设置为将每个流量数据与其对应的最短距离的分类中心的数据量大小作为同一组,得到K个分类组。
在本发明实施例的一种实施方式中,所述分类中心确定子模块具体设置为:
(1)在待分类的流量数据样本的数据量大小集合{x1,x2,…,xN}中,任意选取一个流量数据x1作为第一个分类中心Center1;
(2)计算样本集合中各个样本的数据量大小到所述第一分类中心的距离:||xi-Center1||,其中i=1,2,…,N;
(3)若||xj-Center1||=max{||xi-Center1||,i=1,2,...,N},j=1,2,…,N,那么xj作为第2个分类中心Center2=xj;
(4)逐个计算各个样本数据量大小{x1,x2,…,xN}与{Center1,Center2}之间的距离:
Figure PCTCN2016076788-appb-000012
disti1为各个流量数据到第一分类中心的数据量大小的距离,disti2为各个流量数据到第二分类中心的数据量大小的距离;
(5)选取各个分类中心的最小距离,并在各个最小距离中选取最大距离作为第三分类中心Center3:若min(dj1,dj2,...,djr)=max{min(di1,di2,...,dir)i=1,2,...,N}j=1,2,...,N,那么Center3=xj;
(6)假设已经找到r个(r<K)个分类中心{Center1,Center2,…,Centerr},现在确定第r+1个分类中心,即第r+1个分类中心为:
min(distj1,distj2,...,distjr)=max{min(disti1,disti2,...,distir)i=1,2,...,N}j=1,2,...,N
则:Centerr+1=xj;重复上述步骤四,直到r+1=k为止;
已选取k个初始分类中心Center1(1),Center2(1),Centerk(1),括号内的序号为寻找分类中心迭代计算的次序号。
在本发明实施例的一种实施方式中,所述第一分类中心模块具体设置为:
步骤一:
若d(xi,Centerj(I))=min{||xi-Centerj(I)||i=1,2,...,N}j=1,2,...,N;则xi∈ωj(I),ωj表示第j个分类,其分类中心为Centerj(I);假设对所采集的数据分成ω1、ω2、…,ωk个类,共计K个类;
步骤二:计算初始分类的分类中心的均值作为新的分类中心:
Figure PCTCN2016076788-appb-000013
0≤j≤k,其中ni是簇ωi中数据点的个数,ωi为第i个分类;
步骤三:重新计算每个流量数据到新的分类中心的数据量大小的距离,将每个数据和最近的分类中心归为一组;
步骤四:计算误差平方和准则函数如下:
Figure PCTCN2016076788-appb-000014
其中xk (j)表示第j 个分类ωj中的第k个数据元素;
重复进行步骤一至步骤三,直到分类中心的均值没有预设变化为止:若|Jc(I+1)<Jc(I)|<ξ成立,则算法结束,否则令I=I+1,返回执行步骤一开始。
在本发明实施例中,还提供了一种计算机存储介质,该计算机存储介质可以存储有执行指令,该执行指令用于执行上述实施例中的网络流量数据的分类方法。
本发明实施例的有益效果是:
本发明实施例提供的网络流量数据的分类方法及装置,首先通过将从网络数据流中获取的流量数据样本根据数据量的大小进行初步分类,然后,再对进行初步分类后的流量数据进行多次采样后,根据流量数据在其所在的类中的出现的权重大小进行再分类。本方案在对网络流量数据进行分类时,不需要考虑其应用的类型或者该应用对应的关联字等,其只需通过获取流量数据的数据量大小及在第二次采样过程中出现的权重就可对流量数据进行采样,使得流量分类过程更加简单、高效和准确;并且通过对流量的实时抽样,实现了一个从无序、无规则的实例集合中归纳出有效的分类规则;以实例为基础进行归纳学习,根据权重进行分类,实现了对未知类型的流量样本进行精确分类。
附图说明
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1为本发明实施例一提供的网络流量数据的分类方法流程示意图;
图2至图7为本发明实施例一提供的使用二叉树来对流量数据进行分类过程的变化示意图。
具体实施方式
下面通过具体实施方式结合附图对本发明作进一步详细说明。
实施例一:
请参见图1所示,本实施例提供的网络流量数据的分类方法包括:
S101:从网络数据流中获取N个流量数据样本,并获取每个流量数据样本的数据量大小及每个流量数据样本的标识;所述每个流量数据样本的数据量大小为该流量数据本身所占的存储空间;所述每个流量数据样本的标识为流量数据区别于其他流量数据的标识,可以包括:该流量数据的的预设标识位或者就是该流量数据本身等;
S102:根据每个流量数据样本的数据量大小将所述N个流量数据样本分成K类;具体可以包括:将流量数据的数据量大小相近的分为同一类;或者将流量数据的数据量大小从相差 最大到相差最小的排列顺序进行分类;或者根据K及N的取值来对流量数据的数据量大小进行对应的分类;
S103:根据所述每个流量数据样本的标识分别对各类中的每个流量数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;如,当每个流量数据样本的标识为其本身时,通过对采样的流量数据与对应的流量数据进行比较,若相同,则采样成功,若不相同,则采样失败;不同类中的流量数据的采样次数可以相同,也可以不同;
S104:根据所述采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;
S105:根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重;
S106:根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类;所述N和K都为正整数。
优选地,针对步骤S104中,每个数据流量在其所在类的不确定性概率包括:INFO(A1,A2)=–p1 ㏒ 2(p1)–p2 ㏒ 2(p2)(1);每个数据流量在其所在类的期望包括:
Figure PCTCN2016076788-appb-000015
所述A1和A2分别为每个流量数据采样成功的集合及采样失败的集合;所述p1和p2分别为每个流量数据采样成功的概率及失败的概率;所述ni为子集A1的样本集合个数,pi为子集A2的样本集合个数;所述p为所述N个流量数据样本中各个数据流量采样成功的总次数;所述n为所述N个流量数据样本中各个数据流量采样失败的总次数;所述mi为所述流量数据样本中的流量数据,所述i表示每个类中数据流量元素的标号,t为每个类中的流量数据样本的个数。
进一步地,对上述公式进行处理,其中由公式(1)可得:
Figure PCTCN2016076788-appb-000016
由公式(2)(3)则有:
Figure PCTCN2016076788-appb-000017
为了简化计算对数的复杂度,提高计算的效率,本文将各流量数据的期望信息做如下处理,由麦克劳林公式:
Figure PCTCN2016076788-appb-000018
其中
Figure PCTCN2016076788-appb-000019
当x→0时,有:
Figure PCTCN2016076788-appb-000020
又因为
Figure PCTCN2016076788-appb-000021
则通过公式(6)可得:
Figure PCTCN2016076788-appb-000022
Figure PCTCN2016076788-appb-000023
因此,将公式(7)(8)代入公式(4)可得每个数据流量在其所在类的期望为:
Figure PCTCN2016076788-appb-000024
同理将公式(7)(8)代入公式(3)可得每个数据流量在其所在类的不确定性概率为:
Figure PCTCN2016076788-appb-000025
针对S105根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重包括:根据所述期望及不确定性概率得到每个流量数据在其所在类的信息增益为:Gain(mi)=INFO(A1,A2)-E(mi)(11);根据所述信息增益得到每个流量数据的权重为:
Figure PCTCN2016076788-appb-000026
所述i为某一个流量数据的标号,所述j为同一类中流量数据的标号,所述k为每类中流量数据的个数。
步骤S106根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类包括:将权重值最相近的对应的流量数据归为同一组,具体地,设置一个预设权重相近值,并设置各组中对应的权重比较值,将各个流量数据的权重值与各组中的权重比较值进行比较,将比较得到的值在预设权重相近值内的归为对应的权重比较值的组内;或将权重值之间的差值由大到小两两对应的流量数据归为同一组,具体地,将每个流量数据两两相减,将差值由大到小对应的流量数据归为同一组。另外,还可以通过二叉树的方式来表示对流量数据根据权重值的分类,根据上述公式(12)中求得的多个个权重β=(β12,...)构成n棵二叉树的集合F={T1,T2,T3,...},其中每棵二叉树Ti中只有一个权重为βi的根节点,其左右子树均空;在F集合中选取两棵根节点的权重最小的树作为左右子树构造一棵新的二叉树,且置新的二叉树的根节点的权重为其左右子树上根节点的权重之和;在F集合中删除这两棵树,同时将新得到的二叉树加入到F集合之中;重复上述步骤,直到F只含有一棵树为止。
步骤S102根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类包括:根据预设规则在流量数据样本的数据量大小的集合中选取K个分类中心;分别计算各个流量 数据与各个分类中心的数据量大小的距离;将每个流量数据与其对应的最短距离的分类中心的数据量大小作为同一组,得到K个分类组。其具体步骤包括:
步骤1:确定K值以及初始化分类中心,选取K个初始分类中心;
在此给定流量数据的大小为N的数据样本集合X={x1,x2,…,xN},令I=1,选取k个初始分类中心Centerj(I),j=1,2,…,k。
在以下步骤中,以最大最小距离的启发式方法确定k个初始分类中心:
(1)在待分类的样本集{x1,x2,…,xN}中,任意选取一个样本数据作为第一个分类中心Center1,选取Center1=x1;
(2)选取距离最远的样本作为第2个分类中心,计算样本集合中各个样本集的距离:||xi-Center1||,其中i=1,2,…,N
若||xj-Center1||=max{||xi-Center1||,i=1,2,...,N},j=1,2,…,N,那么xj作为第2个分类中心Center2=xj;
(3)逐个计算各个样本数据{x1,x2,…,xN}与{Center1,Center2}之间的距离。
Figure PCTCN2016076788-appb-000027
选取其中最小距离:
min(disti1,disti2)i=1,2,…,N;
在所有样本与{Center1,Center2}距离的最小值中选取最大距离作为第3分类中心Center3。
若min(distj1,distj2)=max{min(disti1,disti2)i=1,2,...,N}j=1,2,...,N,那么Center3=xj;
(4)假设已经找到r个(r<k)个分类中心{Center1,Center2,…,Centerr},现在确定第r+1个分类中心,即:
min(distj1,distj2,...,distjr)=max{min(disti1,disti2,...,distir)i=1,2,...,N}j=1,2,...,N
则:Centerr+1=xj;
重复上述步骤(4),直到r+1=k为止。
已选取k个初始分类中心Center1(1),Center2(1),Centerk(1),括号内的序号为寻找分类 中心迭代计算的次序号。
步骤2:计算每个数据到K个分类中心的距离,将每个数据和最近的分类中心分到一组,形成K个初始分类;
即以Centerj(I)(其中j=1,2,3,…,k)为参照点对X={x1,x2,…,xN}进行划分,计算每个样本数据对象与分类中心的距离。
若:dist(xi,Centerj(I))=min{||xi-Centerj(I)||i=1,2,...,N}j=1,2,...,N
则:xi∈ωj(I),即将xi划分到簇ωj(I)。
其中I为迭代计算次序号,ωj表示第j个分类,其分类中心为Centerj(I)。
假设对所采集的数据分成ω1、ω2、…,ωk个类,共计k个类。
步骤3:计算初始分类中心的重心(或均值),做为新的分类中心,重新计算每个数据到分类中心(或均值)的距离,将每个数据和最近的分类中心分为一组;
即:令I=I+1,根据公式
Figure PCTCN2016076788-appb-000028
计算新的分类中心、误差平方和准则函数值,即:
新的分类中心:
Figure PCTCN2016076788-appb-000029
其中ni是簇ωi中数据点的个数,ωi为上述step1、2中的第i个分类。
误差平方和准则函数如下:
Figure PCTCN2016076788-appb-000030
其中xk (j)表示上述中的第j个分类ωj中的k个数据元素。
如,假设ωj分类中包含15个元素。Centerj(I)为新的分类中心,则ωj分类中的每个元素分别与分类中心Centerj(I)相减,求其误差平方和。重复进行步骤2和步骤3,直到分类中心或均值没有明显变化为止。
即若|Jc(I+1)<Jc(I)|<ξ成立,则算法结束,否则令I=I+1,返回执行步骤2。
例如:
假设通过第一次分类后,其ω1={x1,x2,x3,x4,x5},其中假设一共采集了10次流量数据, 则ω1中的每个x都存在10个数据。其中根据是否选取了某个候选实例d=<d1,d2>,d1和d2分别表示采样成功及采样失败;那么根据是否选中,在ω1中假设x1中选中的次数为4次,没有选中的次数为6次,那么根据公式:
INFO(A1,A2)=–p1 ㏒ 2(p1)–p2 ㏒ 2(p2)
则:
Figure PCTCN2016076788-appb-000031
根据公式
Figure PCTCN2016076788-appb-000032
同理,针对ω1中的每一个xi,可以计算出相应的信息熵(不确定性概率)。其数学期望如下:
Figure PCTCN2016076788-appb-000033
则根据上述计算得到每个流量数据的信息增益公式:
Gain(mi)=INFO"(A1,A2)-E"(mi);
每个流量数据的权重βi
Figure PCTCN2016076788-appb-000034
由此形成一个权重集合:ω=(ω12,...,ωn)
假设针对ω1={x1,x2,x3,x4,x5}求得的权重分别为:
β=(β12,...,βn)=(0.1,0.3,0.2,0.15,0.25);
根据权重的大小具体将其进行分类(以二叉树作为分类载体)包括以下步骤:
1)根据求得的n个权重β=(β12,...,βn)构成n棵二叉树的集合F={T1,T2,T3,...,Tn},其中每棵二叉树Ti中只有一个权重为βi的根节点,其左右子树均空;
2)在F集合中选取两棵根节点的权重最小的树作为左右子树构造一棵新的二叉树,且置新的二叉树的根节点的权重为其左右子树上根节点的权重之和;
3)在F集合中删除这两棵树,同时将新得到的二叉树加入到F集合之中;
4)重复步骤2)和3),直到F只含有一棵树为止。
请参见图2-图7所示,1、根据求得的5个权重β=(β12,...,βn)=(0.1,0.3,0.2,0.15,0.25)构成5棵二叉树的集合F={T1,T2,T3,T4,T5},其中每棵二叉树Ti中只有一个权重为βi的根节点,其左右子树均空,如图2所示。
2、在F集合中选取两棵根节点的权重最小的树作为左右子树构造一棵新的二叉树,且置新的二叉树的根节点的权重为其左右子树上根节点的权重之和,如图3所示;3、在F集合中删除这两棵树,同时将新得到的二叉树加入到F集合之中,如图4所示;4、重复步骤2、3,直到F只含有一棵树为止,如图5和图6所示;
根据ω1={x1,x2,x3,x4}计算得到的权重集合,从而形成如下一棵流量分类决策树:从而形成五个分类结果,如图7所示。
同理,可以针对ω2、…,ωk进行类似的处理。
实施例二:
本实施例提供了网络流量数据的分类装置,所述分类装置包括:数据获取模块,设置为从网络数据流中获取N个流量数据样本,并获取每个流量数据样本的数据量大小及每个流量数据样本的标识;第一分类模块,设置为根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类;数据采样模块,设置为根据所述每个流量数据样本的标识分别对各类中的每个流量数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;参数计算模块,设置为根据所述采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;权重模块设置为根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重;第二分类模块,设置为根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类;所述N和K都为正整数。
优选地,所述参数计算模块设置为根据以下公式每个流量数据在其对应类中的期望及不确定性概率:每个数据流量在其所在类的不确定性概率包括:INFO(A1,A2)=–p1 ㏒ 2(p1)–p2 ㏒ 2(p2);每个数据流量在其所在类的期望包括:
Figure PCTCN2016076788-appb-000035
所述A1和A2分别为每个流量数据采样成功的集合及采样失败的集合;所述p1和p2分别为每个流量数据采样成功的概率及失败的概率;所述ni为子集A1的样本集合个数,pi为子集A2的样本集合个数;所述p为所述N个流量数据样本中各个数据流量采样成功的总次数;所述n为所述N个流量数据样本中各个数据流量采样失败的总次数;所述mi为所述流量数据样本中的流量数据,所述i表示每个类中数据流量元素的标 号,t为每个类中的流量数据样本的个数;
进一步地,根据麦克劳林公式对每个数据流量在其所在类的不确定性概率及期望进行简化处理后得到:每个数据流量在其所在类的不确定性概率为:
Figure PCTCN2016076788-appb-000036
每个数据流量在其所在类的期望为:
Figure PCTCN2016076788-appb-000037
其具体的简化步骤在上述方法实施例中已经进行说明,在此将不再累述。
所述权重计算模块具体设置为根据所述期望及不确定性概率得到每个流量数据在其所在类的信息增益为:Gain(mi)=INFO(A1,A2)-E(mi);根据所述信息增益得到每个流量数据的权重为:
Figure PCTCN2016076788-appb-000038
所述i为某一个流量数据的标号,所述j为同一类中流量数据的标号,所述k为每类中流量数据的个数。
所述第二分类模块设置为将权重值最相近的对应的流量数据归为同一组;或将权重值之间的差值由大到小两两对应的流量数据归为同一组。
所述第一分类模块包括:分类中心确定子模块,设置为根据预设规则在流量数据样本的数据量大小的集合中选取K个分类中心;距离计算子模块,设置为分别计算各个流量数据与各个分类中心的数据量大小的距离;分类子模块,设置为将每个流量数据与其对应的最短距离的分类中心的数据量大小作为同一组,得到K个分类组。
本发明通过将从网络数据流中获取的流量数据样本根据数据量的大小进行初步分类,然后,再对进行初步分类后的流量数据进行多次采样后,根据流量数据在其所在的类中的出现的权重大小进行再分类。本方案在对网络流量数据进行分类时,不需要考虑其应用的类型或者该应用对应的关联字等,其只需通过获取流量数据的数据量大小及在第二次采样过程中出现的权重就可对流量数据进行采样,使得流量分类过程更加简单、高效和准确;并且通过对流量的实时抽样,实现了一个从无序、无规则的实例集合中归纳出有效的分类规则;以实例为基础进行归纳学习,根据权重进行分类,实现了对未知类型的流量样本进行精确分类。
以上内容是结合具体的实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。
工业实用性
本发明实施例提供的网络流量数据的分类方法及装置,首先通过将从网络数据流中获取 的流量数据样本根据数据量的大小进行初步分类,然后,再对进行初步分类后的流量数据进行多次采样后,根据流量数据在其所在的类中的出现的权重大小进行再分类。本方案在对网络流量数据进行分类时,不需要考虑其应用的类型或者该应用对应的关联字等,其只需通过获取流量数据的数据量大小及在第二次采样过程中出现的权重就可对流量数据进行采样,使得流量分类过程更加简单、高效和准确;并且通过对流量的实时抽样,实现了一个从无序、无规则的实例集合中归纳出有效的分类规则;以实例为基础进行归纳学习,根据权重进行分类,实现了对未知类型的流量样本进行精确分类。

Claims (16)

  1. 一种网络流量数据的分类方法,包括:
    从网络数据流中获取N个流量数据样本,并获取每个流量数据样本的数据量大小及每个流量数据样本的标识;
    根据每个流量数据样本的数据量大小将所述N个流量数据样本分成K类;
    根据所述每个流量数据样本的标识分别对各类中的每个流量数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;
    根据所述采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;
    根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重;
    根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类;所述N和K都为正整数。
  2. 如权利要求1所述的网络流量数据的分类方法,其中,每个数据流量在其所在类的不确定性概率包括:
    INFO(A1,A2)=–p1㏒2(p1)–p2㏒2(p2);
    每个数据流量在其所在类的期望包括:
    Figure PCTCN2016076788-appb-100001
    所述A1和A2分别为每个流量数据采样成功的集合及采样失败的集合;所述p1和p2分别为每个流量数据采样成功的概率及失败的概率;所述ni为子集A1的样本集合个数,pi为子集A2的样本集合个数;所述p为所述N个流量数据样本中各个数据流量采样成功的总次数;所述n为所述N个流量数据样本中各个数据流量采样失败的总次数;所述mi为所述流量数据样本中的流量数据,所述i表示每个类中数据流量元素的标号,t为每个类中的流量数据样本的个数。
  3. 如权利要求2所述的网络流量数据的分类方法,其中,根据麦克劳林公式对每个数据流量在其所在类的不确定性概率及期望进行简化处理后得到:
    每个数据流量在其所在类的不确定性概率为:
    Figure PCTCN2016076788-appb-100002
    每个数据流量在其所在类的期望为:
    Figure PCTCN2016076788-appb-100003
  4. 如权利要求3所述的网络流量数据的分类方法,其中,根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重包括:
    根据所述期望及不确定性概率得到每个流量数据在其所在类的信息增益为:Gain(mi)=INFO(A1,A2)-E(mi);
    根据所述信息增益得到每个流量数据的权重为:
    Figure PCTCN2016076788-appb-100004
    所述i为某一个流量数据的标号,所述j为同一类中流量数据的标号,所述k为每类中流量数据的个数。
  5. 如权利要求1-4任一项所述的网络流量数据的分类方法,其中,根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类包括:
    将权重值最相近的对应的流量数据归为同一组;或将权重值之间的差值由大到小两两对应的流量数据归为同一组。
  6. 如权利要求1-4任一项所述的网络流量数据的分类方法,其中,根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类包括:
    根据预设规则在流量数据样本的数据量大小的集合中选取K个分类中心;
    分别计算各个流量数据与各个分类中心的数据量大小的距离;
    将每个流量数据与其对应的最短距离的分类中心的数据量大小作为同一组,得到K个分类组。
  7. 如权利要求6所述的网络流量数据的分类方法,其中,根据预设规则选取K个分类中心包括以下步骤:
    (1)在待分类的流量数据样本的数据量大小集合{x1,x2,…,xN}中,任意选取一个流量数据x1作为第一个分类中心Center1;
    (2)计算样本集合中各个样本的数据量大小到所述第一分类中心的距离:||xi-Center1||,其中i=1,2,…,N;
    (3)若||xj-Center1||=max{||xi-Center1||,i=1,2,...,N},j=1,2,…,N,那么xj作为第2个分类中心Center2=xj;
    (4)逐个计算各个样本数据量大小{x1,x2,…,xN}与{Center1,Center2}之间的距离:
    Figure PCTCN2016076788-appb-100005
    disti1为各个流量数据到第一分类中心的数据量大小的距离,disti2为各个流量数据到第二分类中心的数据量大小的距离;
    (5)选取各个分类中心的最小距离,并在各个最小距离中选取最大距离作为第三分类中心Center3:
    若min(dj1,dj2,...,djr)=max{min(di1,di2,...,dir)i=1,2,...,N}j=1,2,...,N,那么Center3=xj;
    (6)假设已经找到r个(r<K)个分类中心{Center1,Center2,…,Centerr},现在确定第r+1个分类中心,即第r+1个分类中心为:
    min(distj1,distj2,...,distjr)=max{min(disti1,disti2,...,distir)i=1,2,...,N}j=1,2,...,N则:Centerr+1=xj;重复上述步骤四,直到r+1=k为止;
    已选取k个初始分类中心Center1(1),Center2(1),Centerk(1),括号内的序号为寻找分类中心迭代计算的次序号。
  8. 如权利要求7所述的网络流量数据的分类方法,其中,根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类中在得到K个分类组后还包括:
    步骤一:
    若d(xi,Centerj(I))=min{||xi-Centerj(I)||i=1,2,...,N}j=1,2,...,N;则xi∈ωj(I),ωj表示第j个分类,其分类中心为Centerj(I);假设对所采集的数据分成ω1、ω2、…,ωk个类,共计K个类;
    步骤二:计算初始分类的分类中心的均值作为新的分类中心:
    Figure PCTCN2016076788-appb-100006
    0≤j≤k,其中ni是簇ωi中数据点的个数,ωi为第i个分类;
    步骤三:重新计算每个流量数据到新的分类中心的数据量大小的距离,将每个数据和最近的分类中心归为一组;
    步骤四:计算误差平方和准则函数如下:
    Figure PCTCN2016076788-appb-100007
    其中xk (j)表示第j个分类ωj中的第k个数据元素;
    重复进行步骤一至步骤三,直到分类中心的均值没有预设变化为止:若|Jc(I+1)<Jc(I)|<ξ成立,则算法结束,否则令I=I+1,返回执行步骤一开始。
  9. 一种网络流量数据的分类装置,包括:
    数据获取模块,设置为从网络数据流中获取N个流量数据样本,并获取每个流量数据样本的数据量大小及每个流量数据样本的标识;
    第一分类模块,设置为根据每个流量数据样本的数据量大小将所述N个数据流量样本分成K类;
    数据采样模块,设置为根据所述每个流量数据样本的标识分别对各类中的每个流量 数据进行多次采样,得到采样成功的次数及采样失败的次数,同一类中的流量数据的采样次数相同;
    参数计算模块,设置为根据所述采样成功的次数及采样失败的次数得到每个流量数据在其对应类中的期望及不确定性概率;
    权重模块设置为根据所述期望及不确定性概率计算每个流量数据在其所在类中的权重;
    第二分类模块,设置为根据各流量数据在其所在类中的权重按照预设分类规则对所述流量数据进行再分类;所述N和K都为正整数。
  10. 如权利要求9所述的网络流量数据的分类装置,其中,所述参数计算模块设置为根据以下公式每个流量数据在其对应类中的期望及不确定性概率:每个数据流量在其所在类的不确定性概率包括:
    INFO(A1,A2)=–p1㏒2(p1)–p2㏒2(p2);
    每个数据流量在其所在类的期望包括:
    Figure PCTCN2016076788-appb-100008
    所述A1和A2分别为每个流量数据采样成功的集合及采样失败的集合;所述p1和p2分别为每个流量数据采样成功的概率及失败的概率;所述ni为子集A1的样本集合个数,pi为子集A2的样本集合个数;所述p为所述N个流量数据样本中各个数据流量采样成功的总次数;所述n为所述N个流量数据样本中各个数据流量采样失败的总次数;所述mi为所述流量数据样本中的流量数据,所述i表示每个类中数据流量元素的标号,t为每个类中的流量数据样本的个数。
  11. 如权利要求10所述的网络流量数据的分类装置,其中,根据麦克劳林公式对每个数据流量在其所在类的不确定性概率及期望进行简化处理后得到:
    每个数据流量在其所在类的不确定性概率为:
    Figure PCTCN2016076788-appb-100009
    每个数据流量在其所在类的期望为:
    Figure PCTCN2016076788-appb-100010
  12. 如权利要求11所述的网络流量数据的分类装置,其中,
    所述权重计算模块具体设置为根据所述期望及不确定性概率得到每个流量数据在其所在类的信息增益为:Gain(mi)=INFO(A1,A2)-E(mi);
    根据所述信息增益得到每个流量数据的权重为:
    Figure PCTCN2016076788-appb-100011
    所述i为某一个流量数据的标号,所述j为同一类中流量数据的标号,所述k为每类中流量数据的个数。
  13. 如权利要求9-12任一项所述的网络流量数据的分类装置,其中,所述第二分类模块设置为将权重值最相近的对应的流量数据归为同一组;或将权重值之间的差值由大到小两两对应的流量数据归为同一组。
  14. 如权利要求9-12任一项所述的网络流量数据的分类装置,其中,所述第一分类模块包括:
    分类中心确定子模块,设置为根据预设规则在流量数据样本的数据量大小的集合中选取K个分类中心;
    距离计算子模块,设置为分别计算各个流量数据与各个分类中心的数据量大小的距离;
    分类子模块,设置为将每个流量数据与其对应的最短距离的分类中心的数据量大小作为同一组,得到K个分类组。
  15. 如权利要求14所述的网络流量数据的分类装置,其中,所述分类中心确定子模块具体设置为:
    (1)在待分类的流量数据样本的数据量大小集合{x1,x2,…,xN}中,任意选取一个流量数据x1作为第一个分类中心Center1;
    (2)计算样本集合中各个样本的数据量大小到所述第一分类中心的距离:||xi-Center1||,其中i=1,2,…,N;
    (3)若||xj-Center1||=max{||xi-Center1||,i=1,2,...,N},j=1,2,…,N,那么xj作为第2个分类中心Center2=xj;
    (4)逐个计算各个样本数据量大小{x1,x2,…,xN}与{Center1,Center2}之间的距离:
    Figure PCTCN2016076788-appb-100012
    disti1为各个流量数据到第一分类中心的数据量大小的距离,disti2为各个流量数据到第二分类中心的数据量大小的距离;
    (5)选取各个分类中心的最小距离,并在各个最小距离中选取最大距离作为第三分类中心Center3:
    若min(dj1,dj2,...,djr)=max{min(di1,di2,...,dir)i=1,2,...,N}j=1,2,...,N,那么Center3=xj;
    (6)假设已经找到r个(r<K)个分类中心{Center1,Center2,…,Centerr},现在确定第r+1个分类中心,即第r+1个分类中心为:
    min(distj1,distj2,...,distjr)=max{min(disti1,disti2,...,distir)i=1,2,...,N}j=1,2,...,N则:Centerr+1=xj;重复上述步骤四,直到r+1=k为止;
    已选取k个初始分类中心Center1(1),Center2(1),Centerk(1),括号内的序号为寻找分类中心迭代计算的次序号。
  16. 如权利要求15所述的网络流量数据的分类装置,其中,所述第一分类中心模块具体设置为:
    步骤一:
    若d(xi,Centerj(I))=min{||xi-Centerj(I)||i=1,2,...,N}j=1,2,...,N;则xi∈ωj(I),ωj表示第j个分类,其分类中心为Centerj(I);假设对所采集的数据分成ω1、ω2、…,ωk个类,共计K个类;
    步骤二:计算初始分类的分类中心的均值作为新的分类中心:
    Figure PCTCN2016076788-appb-100013
    0≤j≤k,其中ni是簇ωi中数据点的个数,ωi为第i个分类;
    步骤三:重新计算每个流量数据到新的分类中心的数据量大小的距离,将每个数据和最近的分类中心归为一组;
    步骤四:计算误差平方和准则函数如下:
    Figure PCTCN2016076788-appb-100014
    其中xk (j)表示第j个分类ωj中的第k个数据元素;
    重复进行步骤一至步骤三,直到分类中心的均值没有预设变化为止:若|Jc(I+1)<Jc(I)|<ξ成立,则算法结束,否则令I=I+1,返回执行步骤一开始。
PCT/CN2016/076788 2015-08-24 2016-03-18 一种网络流量数据的分类方法及装置 WO2016177146A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510524688.8 2015-08-24
CN201510524688.8A CN106487535B (zh) 2015-08-24 2015-08-24 一种网络流量数据的分类方法及装置

Publications (1)

Publication Number Publication Date
WO2016177146A1 true WO2016177146A1 (zh) 2016-11-10

Family

ID=57217489

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/076788 WO2016177146A1 (zh) 2015-08-24 2016-03-18 一种网络流量数据的分类方法及装置

Country Status (2)

Country Link
CN (1) CN106487535B (zh)
WO (1) WO2016177146A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965524A (zh) * 2021-09-29 2022-01-21 河海大学 一种网络流量分类方法以及基于该方法的流量控制系统

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108650194B (zh) * 2018-05-14 2022-03-25 南开大学 基于K_means和KNN融合算法的网络流量分类方法
CN109309630B (zh) * 2018-09-25 2021-09-21 深圳先进技术研究院 一种网络流量分类方法、系统及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060010093A1 (en) * 2004-06-30 2006-01-12 Ibm Corporation System and method for continuous diagnosis of data streams
CN102402690A (zh) * 2011-09-28 2012-04-04 南京师范大学 基于直觉模糊集成的数据分类方法与系统
CN103716204A (zh) * 2013-12-20 2014-04-09 中国科学院信息工程研究所 一种基于维纳过程的异常入侵检测集成学习方法及装置
CN104102700A (zh) * 2014-07-04 2014-10-15 华南理工大学 一种面向因特网不平衡应用流的分类方法
CN104462301A (zh) * 2014-11-28 2015-03-25 北京奇虎科技有限公司 一种网络数据的处理方法和装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102347860B (zh) * 2011-10-18 2014-12-24 北京星网锐捷网络技术有限公司 网络应用质量的度量方法和装置
CN103001825B (zh) * 2012-11-15 2016-03-02 中国科学院计算机网络信息中心 Dns流量异常的检测方法和系统
CN104766098A (zh) * 2015-04-30 2015-07-08 哈尔滨工业大学 一种分类器的构建方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060010093A1 (en) * 2004-06-30 2006-01-12 Ibm Corporation System and method for continuous diagnosis of data streams
CN102402690A (zh) * 2011-09-28 2012-04-04 南京师范大学 基于直觉模糊集成的数据分类方法与系统
CN103716204A (zh) * 2013-12-20 2014-04-09 中国科学院信息工程研究所 一种基于维纳过程的异常入侵检测集成学习方法及装置
CN104102700A (zh) * 2014-07-04 2014-10-15 华南理工大学 一种面向因特网不平衡应用流的分类方法
CN104462301A (zh) * 2014-11-28 2015-03-25 北京奇虎科技有限公司 一种网络数据的处理方法和装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965524A (zh) * 2021-09-29 2022-01-21 河海大学 一种网络流量分类方法以及基于该方法的流量控制系统

Also Published As

Publication number Publication date
CN106487535A (zh) 2017-03-08
CN106487535B (zh) 2020-04-28

Similar Documents

Publication Publication Date Title
Zhang et al. Autonomous unknown-application filtering and labeling for dl-based traffic classifier update
WO2017152883A1 (zh) 一种协同流的识别方法、系统以及使用该方法的服务器
US8719267B2 (en) Spectral neighborhood blocking for entity resolution
CN107483451B (zh) 基于串并行结构网络安全数据处理方法及系统、社交网络
WO2016177146A1 (zh) 一种网络流量数据的分类方法及装置
CN114172688B (zh) 基于gcn-dl的加密流量网络威胁关键节点自动提取方法
Kaur et al. Dynamic resource allocation for big data streams based on data characteristics (5 V s)
WO2021190398A1 (zh) 设备型号的识别方法、装置及系统
CN112560878A (zh) 服务分类方法及装置、互联网系统
WO2014118978A1 (ja) 学習方法、情報処理装置および学習プログラム
CN115600128A (zh) 一种半监督加密流量分类方法、装置及存储介质
WO2021184367A1 (zh) 基于度分布生成模型的社交网络图生成方法
Soleymanpour et al. An efficient deep learning method for encrypted traffic classification on the web
CN110311870B (zh) 一种基于密度数据描述的ssl vpn流量识别方法
Liu et al. P2P traffic identification and optimization using fuzzy c-means clustering
EP4028952A1 (en) Node disambiguation
Ma et al. GraphNEI: A GNN-based network entity identification method for IP geolocation
CN112468324B (zh) 基于图卷积神经网络的加密流量分类方法及装置
Fellus et al. Decentralized k-means using randomized gossip protocols for clustering large datasets
CN114866301B (zh) 基于直推图的加密流量识别与分类方法及系统
CN115348198B (zh) 基于特征检索的未知加密协议识别分类方法、设备及介质
CN114978593B (zh) 基于图匹配的不同网络环境的加密流量分类方法及系统
CN111314109A (zh) 一种基于弱密钥的大规模物联网设备固件识别方法
CN106778872B (zh) 基于密度的连通图的聚类方法与装置
CN117546160A (zh) 使用机器学习模型的自动化数据层次结构提取和预测

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16789140

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16789140

Country of ref document: EP

Kind code of ref document: A1