WO2020258772A1 - 样本聚类方法、装置、设备及存储介质 - Google Patents

样本聚类方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2020258772A1
WO2020258772A1 PCT/CN2019/126716 CN2019126716W WO2020258772A1 WO 2020258772 A1 WO2020258772 A1 WO 2020258772A1 CN 2019126716 W CN2019126716 W CN 2019126716W WO 2020258772 A1 WO2020258772 A1 WO 2020258772A1
Authority
WO
WIPO (PCT)
Prior art keywords
sample
samples
distance
bin
clustering
Prior art date
Legal status (The legal status 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 status listed.)
Ceased
Application number
PCT/CN2019/126716
Other languages
English (en)
French (fr)
Inventor
熊凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
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 Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Publication of WO2020258772A1 publication Critical patent/WO2020258772A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering

Definitions

  • the present disclosure relates to the technical field of data processing, for example, to a sample clustering method, device, device, and storage medium.
  • the inventor found that the related technology has the following defects: when clustering sample sets based on the DBSCAN algorithm, for sample sets with uneven density, if the scan radius is small, then for samples with sparse density In other words, it is easy to be considered as noise points and eliminated. If the scanning radius is large, it is easy to group distant samples into one category. In this case, the accuracy of sample clustering cannot be guaranteed.
  • the present disclosure provides a sample clustering method, device, equipment, and storage medium to solve the technical problem that the DBSCAN algorithm in the related art cannot reasonably cluster sample sets with uneven density.
  • embodiments of the present disclosure provide a sample clustering method, including:
  • the samples in the sample set are clustered according to the connected samples, the distance average value, and the S value, where the distance average value is a scan radius, and the S value is the minimum number of samples included in the cluster.
  • the clustering the samples in the sample set according to the connection samples, the distance mean value, and the S value includes:
  • the clustering of the samples in the sample set based on the S value and the connected samples obtained after filtering includes:
  • the current sample and the connected samples obtained based on the current sample visit are clustered into clusters.
  • the determining all connected samples of each sample based on the K-nearest neighbor sample set corresponding to each sample includes:
  • the element group in a symmetric position, the element group including the first element in the i-th row and j-th column and the second element in the j-th row and i-th column;
  • acquiring the first sample distance within a set distance range includes:
  • the counting the frequency of each bin in the frequency distribution histogram to determine the set distance range includes:
  • the first sample distance corresponding to the bin with the largest frequency and the first sample distance corresponding to the bin located behind are used as the distance threshold of the set distance range.
  • the calculating the distance average value based on the first sample distance within the set distance range includes:
  • the quotient of the total distance of the sample and the number of samples is taken as the mean value of the distance.
  • the embodiments of the present disclosure also provide a sample clustering device, including:
  • a distance acquiring module configured to acquire a first sample distance within a set distance range among all the first sample distances
  • An average value calculation module configured to calculate a distance average value based on the first sample distance within the set distance range
  • the connection determination module is configured to determine all the connected samples of each sample based on the K-nearest neighbor sample set corresponding to each of the samples, where K>S, the connected samples of the sample and the sample are mutually neighboring samples and There is a connection;
  • the sample clustering module is configured to cluster the samples in the sample set according to the connected samples, the distance average value, and the S value, where the distance average value is the scan radius, and the S value is the minimum number of samples included in the cluster .
  • One or more processors are One or more processors;
  • Memory used to store one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the sample clustering method as described in the first aspect.
  • embodiments of the present disclosure also provide a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the sample clustering method as described in the first aspect is implemented.
  • the above-mentioned sample clustering method, device, equipment and storage medium calculate the first sample distance between each sample in the sample set and its S-th nearest neighbor sample, and obtain the average distance based on the first sample distance.
  • the K(K>S) neighboring sample set of the sample is determined, and the connected sample corresponding to each sample is determined.
  • the connected sample and the sample are mutually neighboring samples and have a connection relationship.
  • the scanning radius (distance average) to cluster the samples with the connection relationship, which solves the technical problem that the DBSCAN algorithm in the related technology cannot reasonably cluster the sample set with uneven density. It is determined by the first sample distance Reasonable scanning radius.
  • clustering samples that are neighbors to each other based on the scanning radius ensures the rationality of clustering.
  • the neighboring samples of each other can avoid sparsely distributed samples and Densely distributed samples are clustered into clusters.
  • the average distance is determined by the frequency distribution histogram, without user input, reducing the workload of manual parameter adjustment.
  • FIG. 1 is a schematic diagram of a sample set distribution provided by Embodiment 1 of the present disclosure
  • FIG. 2 is a flowchart of a sample clustering method provided in Embodiment 1 of the present disclosure
  • Embodiment 3 is a schematic diagram of another sample set distribution provided by Embodiment 1 of the present disclosure.
  • FIG. 5 is a K-nearest neighbor graph provided by Embodiment 2 of the disclosure.
  • Embodiment 6 is a histogram of frequency distribution provided by Embodiment 2 of the present disclosure.
  • FIG. 7 is a schematic diagram of an adjacency matrix provided by Embodiment 2 of the present disclosure.
  • FIG. 8 is a schematic diagram of another adjacency matrix provided by Embodiment 2 of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a sample clustering device provided in Embodiment 3 of the disclosure.
  • FIG. 10 is a schematic structural diagram of a sample clustering device provided in Embodiment 4 of the disclosure.
  • DBSCAN Density-Based Spatial Clustering of Applications with Noise
  • eps the area within the scanning radius E of the object is recorded as the E neighborhood of the object. If the number of sample points in the E neighborhood of the object is greater than or equal to minPts, then the object is recorded as a core object.
  • minPts minPts
  • sample P 1 For the sample P 1 , the sample P 2 , ..., the sample P n , if the sample P i is directly accessible from the sample Pi -1 in density, then the sample P n is accessible from the sample P 1 in density. If the density of sample O to sample P is reachable, and the density of sample O to sample Q is reachable, then sample P and sample Q are connected in density.
  • DBSCAN the purpose is to find the largest collection of densely connected objects.
  • FIG. 1 is a schematic diagram of a sample set distribution provided by Embodiment 1 of the disclosure.
  • the samples in the left half are denser, and the samples in the right half are denser. Some samples are sparse.
  • eps is set to a small value, for example, eps is set to the radius corresponding to circle 11 in Figure 1.
  • the right half of the sample since no other samples can be scanned, it will be Think of it as a noise point and filter it out. This will cause a large number of samples in the right half to be filtered out, which will affect the accuracy of clustering.
  • eps is set to a larger value, for example, eps is set to the radius corresponding to circle 12 in Figure 1, then the samples in the left half and right half will be grouped into one category during scanning, or the left half Part of a large number of samples are clustered into one category, which affects the clustering accuracy.
  • the embodiments of the present disclosure provide a method for clustering sample sets to solve the problem that sample sets with uneven density cannot be clustered reasonably.
  • the sample clustering method provided in the embodiment can be executed by a sample clustering device, which can be implemented by software and/or hardware, and the sample clustering device can be composed of two or more physical entities. It can be a physical entity.
  • the sample clustering device may be a computer, a mobile phone, a tablet, or an interactive smart tablet and other smart devices with data operation and analysis capabilities.
  • the sample clustering method includes:
  • Step 110 Count the first sample distance corresponding to each sample in the sample set, where the first sample distance is the distance between the sample and the S-th nearest neighbor sample of the sample.
  • the sample set includes multiple samples, and each sample has the same data type.
  • the data type of the sample can be set according to the actual situation, which is not limited in the embodiment.
  • clustering samples in a sample set is taken as an example to describe the sample clustering method.
  • the sample collection method is not limited, and it may be data collected by the sample clustering device itself, data input by the user, or data obtained after processing specific data.
  • each sample in the sample set represents a data feature.
  • each sample in the sample set represents the location data of the same user in different time periods every day within a set period.
  • the samples in the sample set are scattered at different locations in the feature space.
  • the position of the sample is related to the features represented by the sample itself. The more similar the features, the closer the distance between samples.
  • a feature placement rule is preset, and the sample position is determined according to the rule.
  • the specific content of the feature placement rule can be set according to the actual situation. For example, for location data, divide the latitude and longitude in the feature space, and then determine the location of each sample in the feature space based on the latitude and longitude contained in the location data of each sample.
  • the sample clustering device can calculate the distance between any two samples in the sample set.
  • the embodiment of the distance calculation method is not limited.
  • the distance between the samples is determined by the Euclidean distance, the Minkowski distance, the Manhattan distance, etc. Generally, the closer the distance between two samples, the more similar the two samples.
  • the S-th nearest neighbor sample of the sample refers to the sample S-th closest to the sample.
  • the sample clustering device can calculate the distance between the sample and other samples, and according to each distance, determine the S-th closest sample to the sample, and record it as the S-th nearest neighbor sample.
  • S is a positive integer, and its specific value can be set according to actual conditions.
  • the S value represents the minimum number of samples included in the cluster. That is, after clustering the sample set, multiple clusters are obtained, and each cluster contains at least S samples.
  • the number of S-th nearest neighbor samples is 1. In some cases, the number of S-th nearest neighbor samples may be multiple. In this case, one S-th nearest neighbor sample can be selected.
  • a corresponding K nearest neighbor graph is drawn for each sample, where K is a positive integer and greater than S.
  • K is a positive integer and greater than S.
  • the specific value of K can be set according to actual conditions.
  • the vertex is the sample, and the graph contains the K nearest neighbor samples closest to the sample.
  • the sample is connected to the K nearest neighbor samples, and any The weight of a connection is the distance between two samples of the connection. For example, when K is equal to 8, get the 8 samples closest to the sample and connect them separately. At this time, the samples at both ends of the connection can be considered connected, and the weight of the connection is two samples the distance between.
  • the S-th nearest neighbor sample of the sample and the corresponding distance can be obtained according to the K nearest neighbor graph.
  • the distance between the sample and the S-th nearest neighbor sample is recorded as the first sample distance.
  • Step 120 Among all the first sample distances, obtain the first sample distance within the set distance range.
  • the set distance range is obtained after counting the distance of the first sample, and is used as reference data when calculating the scanning radius.
  • the first sample distance is usually larger in an area with sparse samples, and the first sample distance is usually smaller in an area with dense samples.
  • the first sample distance within the set distance range is representative data among all the first sample distances.
  • the number of samples corresponding to each first sample distance is counted.
  • the number of samples is 50, which means that there are 50 samples whose first samples have the same distance.
  • the set distance range is determined according to the number of samples.
  • a frequency distribution histogram is constructed based on the number of samples, where the specific number of bins of the frequency distribution histogram can be determined in combination with the total number of samples in the sample set.
  • the horizontal axis in the frequency distribution histogram represents the first sample distance
  • the vertical axis represents the number of samples at the first sample distance. Obtain the bin with the largest frequency in the frequency distribution histogram, where the bin with the largest frequency has the largest number of samples.
  • the last bin refers to the bin located behind the bin with the highest frequency from the horizontal axis.
  • the rear bin of two adjacent bins is selected, and the distance between the rear bin and the two first sample distances corresponding to the bin with the highest frequency is determined as the two distance thresholds of the set distance range.
  • obtain the last bin of the set digits after the maximum frequency bin and determine the two first sample distances corresponding to the last bin of the set digits and the bin with the maximum frequency as the two distances of the set distance range Threshold.
  • the set distance range is manually determined based on the number of samples.
  • the two first sample distances corresponding to the rear bin with the largest difference and the bin with the largest frequency are used as the two distance thresholds of the set distance range for description.
  • the first sample corresponding to the bin with the largest frequency has a small distance, so it is used as the smaller distance threshold of the set distance range to ensure that a sufficient number of samples with similar characteristics are scanned during clustering.
  • the rear bin with the largest difference corresponds to a larger first sample distance, so it is used as the larger distance threshold of the set distance range.
  • the rear bin with the largest difference indicates the largest reduction in the number of samples corresponding to the bin, which means that starting from the first sample distance corresponding to the bin, the number of samples is getting smaller and smaller, and accordingly, the sample and its S-th neighbor Therefore, the first sample distance corresponding to the bin is used as the larger threshold of the set distance range.
  • the samples with larger differences can be ignored to ensure the accuracy of clustering. .
  • all samples within the set distance range and the corresponding first sample distance are counted. After that, all the first sample distances within the set distance range are added, and the added result is recorded as the total sample distance. At the same time, count the total number of samples within the set distance range, divide the total sample distance by the total number of samples, and then record the obtained quotient as the mean distance. At this time, the average value of the distance represents the scanning radius.
  • a connected sample refers to a sample that has a connection relationship with the current sample.
  • two samples with a connection relationship can be recorded as neighboring samples of each other, and the neighboring samples of each other can be understood as the K neighbors corresponding to the two samples.
  • Each sample set contains another sample.
  • the K nearest neighbor sample set of the current sample is obtained, and then the K nearest neighbor sample set of each neighbor sample in the K nearest neighbor sample set is obtained. Determine whether the current sample is included in the K-nearest neighbor sample set of each neighbor sample. If the current sample is included in the K-nearest neighbor sample set of a certain neighbor sample, determine the neighbor sample and the current sample as each other’s neighbor samples, and save The connection relationship between the neighboring sample and the current sample.
  • FIG. 3 is a schematic diagram of another sample set provided in Embodiment 1 of the present disclosure.
  • K is 5.
  • its K-nearest neighbor sample set includes 5 samples connected with sample A as a solid line, of which two samples overlap with the line of sample A.
  • sample B its K-nearest neighbor sample set includes 4 samples connected with sample B as a solid line and sample A.
  • the K-nearest neighbor sample set of sample B contains sample A
  • the K-nearest neighbor sample set of sample A does not include sample B. Therefore, sample B and sample A are not neighbor samples of each other, and the samples of sample A and sample B are not saved at this time. Connection relationship. After traversing all the samples in the above-mentioned manner, a connected sample having a connection relationship with each sample can be obtained.
  • Step 150 Cluster the samples in the sample set according to the connected samples, the average distance and the S value, the distance average is the scanning radius, and the S value is the minimum number of samples included in the cluster.
  • the minimum number of samples included in the cluster is minPts.
  • DBSCAN clustering is performed on the samples in the sample set using the mean distance as the scanning radius and the S value as the minPts.
  • a certain sample is selected as the current sample, and then the average distance is used as the scanning radius to scan the surrounding area of the current sample.
  • the scanning process only the connected samples of the current sample are acquired, and then, if the number of connected samples is greater than S, the current sample and the scanned connected samples are clustered into clusters.
  • the first sample distance between each sample in the sample set and its S-th nearest neighbor sample is counted, and the distance average is obtained based on the first sample distance.
  • K (K>S) nearest neighbor sample set of each sample Determine the connected sample corresponding to each sample, the connected sample and the sample are close neighbor samples and have a connection relationship, and then, based on the minimum number of samples included in the cluster (S value) and scan radius (distance mean)
  • S value minimum number of samples included in the cluster
  • scan radius distance mean
  • FIG. 4 is a flowchart of a sample clustering method provided in Embodiment 2 of the disclosure. This embodiment is embodied on the basis of the above-mentioned embodiment. Referring to FIG. 4, the sample clustering method provided by this embodiment includes:
  • Step 201 Construct a K nearest neighbor graph of each sample in the sample set, and the weight of each edge in the K nearest neighbor graph is the distance between the corresponding samples.
  • FIG. 5 is a K-nearest neighbor graph provided in the second embodiment of the disclosure. Refer to Figure 5, which is the K-nearest neighbor graph of sample C in Figure 3, where K is 6.
  • the K samples closest to sample C and the distance are obtained, and then samples C and K are drawn
  • the connection of the sample, and the distance is used as the weight of the connection.
  • the weights of the lines shown in FIG. 5 are only used to describe the K-nearest neighbor graph, and are not a limitation on distance or distance calculation. In practical applications, the weight may not be shown in the K nearest neighbor graph.
  • the connection relationship between the samples in the sample set can be obtained, that is, the neighbor relationship.
  • the advantage of constructing the K-nearest neighbor graph is to facilitate subsequent determination of the first sample distance, connection samples, etc., even in subsequent calculations.
  • Step 202 Count the first sample distance corresponding to each sample in the sample set, where the first sample distance is the distance between the sample and the third neighbor sample of the sample.
  • Step 203 Construct a frequency distribution histogram based on all the first sample distances.
  • the number of occurrences of each first sample distance is counted, and the number is used as the frequency corresponding to the first sample distance, and then a frequency distribution histogram is constructed based on each frequency.
  • the two first sample distances are 0.585 and 0.593 respectively, and their specific values are relatively close.
  • the first sample distance is grouped in advance, and then the number of occurrences of the first sample distance in each group is counted, and the number of occurrences is taken as the frequency corresponding to the group.
  • the frequency corresponding to this group is 1100.
  • the embodiment of the grouping rule is not limited.
  • the abscissa represents the distance (in this example, the first sample distance)
  • the ordinate represents the number of samples (ie, the frequency).
  • each distance group can be recorded as a bin.
  • the number of bins is related to the total number of samples in the sample set. For example, if the total number of samples in the sample set is below 5000, at this time, the number of bins can be set to 10.
  • FIG. 6 is a frequency distribution histogram provided in the second embodiment of the disclosure.
  • the abscissa of the frequency distribution histogram is the distance
  • the ordinate is the number of samples, that is, the frequency
  • the bin is 10.
  • Figure 6 shows the distance range and frequency corresponding to each bin, and the bins are arranged in order from 1 to 10.
  • the advantage of setting the frequency distribution histogram is that it clearly shows the frequency distribution in each distance range, and it is easy to display the frequency difference between each distance range.
  • the frequency gap between the bin with the largest frequency and its neighboring bin can also be calculated, and the frequency gap and the frequency gap between each neighboring bin can be used as the calculation in this step. result.
  • the larger the frequency difference is it indicates that the frequency difference between the rear bin and the front bin in adjacent bins is greater, and it is determined that the number of samples corresponding to the rear bin in the adjacent bins is significantly reduced.
  • the adjacent rear bin with the largest frequency drop is selected. At this time, in the adjacent rear bin, the number of samples corresponding to the bin located at the rear is significantly reduced, and the number of samples located behind the bin is significantly reduced. The number of samples corresponding to the bin is small, and its representativeness is low. When calculating the distance mean, it contributes little to the accuracy. Therefore, it can be ignored in the calculation.
  • the embodiment it is set to select the bin located at the rear of the neighboring bins with the largest frequency drop as the calculation result of this step. For example, referring to Figure 6, calculate the frequency gap between the 6th bin and the 7th bin, the frequency gap between the 7th bin and the 8th bin, and the 8th bin and the 9th bin. The frequency gap between the 9th bin and the 10th bin. After calculating the frequency gap, it is determined that the frequency gap between the 6th bin and the 7th bin is the largest. At this time, the 7th bin located behind is selected.
  • Step 2044 Use the first sample distance corresponding to the bin with the largest frequency and the first sample distance corresponding to the bin located behind as the distance threshold of the set distance range.
  • each bin corresponds to a distance range
  • the minimum value of each distance range may be selected as the distance threshold.
  • the minimum value of the distance range corresponding to the bin with the highest frequency is used as the smaller distance threshold in the set distance range
  • the minimum value of the distance range corresponding to the rear bin is used as the larger distance threshold in the set distance range.
  • the maximum value of each distance range is also possible to select the maximum value of each distance range as the distance threshold. For example, the maximum value of the distance range corresponding to the bin with the highest frequency is used as the small distance threshold value in the set distance range, and the maximum value of the distance range corresponding to the rear bin is used as the large distance threshold value in the set distance range.
  • the minimum value of the distance range corresponding to the bin with the largest frequency as the smaller distance threshold in the set distance range and use the maximum value of the distance range corresponding to the rear bin as the larger distance threshold in the set distance range.
  • the minimum value in the distance range corresponding to the fifth bin is taken as the small distance threshold in the set distance range
  • the maximum value in the distance range corresponding to the seventh bin is taken as the set distance range.
  • the large distance threshold It is also possible to determine the centering distance value of each distance range and use the centering distance value as the distance threshold.
  • steps 2041 to 2044 are only one way to determine the set distance range. In practical applications, other methods can be used to determine the set distance range in combination with the frequency distribution histogram.
  • Step 205 Obtain the first sample distance within the set distance range.
  • each first sample distance within the set distance range is added, and the result is recorded as the total sample distance.
  • the total sample distance is obtained based on the frequency distribution histogram.
  • the frequency of the corresponding bin can be multiplied by the center distance value of the corresponding distance range, and then the obtained results are added to obtain the total sample distance.
  • the distance range corresponding to the fifth bin is obtained, and then the center distance value of the distance range is selected. Multiply the center distance value corresponding to the fifth bin by the frequency to obtain the first result. After that, follow the same calculation method to obtain the second result corresponding to the sixth bin and the third result corresponding to the seventh bin. The three results are added to get the total distance of the sample.
  • Step 208 Use the quotient of the total sample distance and the number of samples as the mean distance.
  • the average distance of the first sample distance within the set distance range can be obtained.
  • the average distance is recorded as the average distance, and the average distance is set as the scan radius.
  • this embodiment can adaptively obtain the scan radius by collecting the actual conditions of the sample set, and uses the statistical principle to determine the scan radius, which ensures the reasonableness of the scan radius.
  • Step 209 Obtain a set of K nearest neighbor samples corresponding to each sample.
  • K neighboring samples of each sample are obtained, and the K-nearest neighbor sample set is formed. That is, all samples in the K-nearest neighbor graph except the vertex constitute the set of K-nearest neighbor samples of the vertex.
  • Step 210 Construct an adjacency matrix based on all K-nearest neighbor sample sets, and each element in the adjacency matrix represents the neighbor relationship between corresponding two samples.
  • the adjacency matrix uses a one-dimensional array to store all samples in the sample set; a two-dimensional array stores the data of the relationship between the sample sets.
  • the adjacency matrix can be divided into directed graph adjacency matrix and undirected graph adjacency matrix.
  • an undirected graph adjacency matrix is taken as an example.
  • each sample is arranged in order, and after the arrangement, each sample corresponds to a number.
  • the permutation rule embodiments are not limited.
  • the arranged samples are used as the horizontal axis and the vertical axis of the matrix, and then the intersection element of the horizontal axis and the vertical axis is used to indicate whether the corresponding two samples are in a neighbor relationship.
  • a sample is included in the K-nearest neighbor sample set of another sample, the sample has a neighbor relationship with the other sample. At this time, the sample is taken as the ordinate and the other sample is the abscissa.
  • the intersection element of is recorded as a non-zero element.
  • the specific values of non-zero elements can be set according to actual conditions. In the embodiment, the non-zero element is 1 as an example. In practical applications, non-zero elements can also be corresponding distance values or other values.
  • the sample has a non-neighbor relationship with another sample.
  • FIG. 7 is a schematic diagram of an adjacency matrix provided in Embodiment 2 of the present disclosure. Referring to Figure 7, there are currently 8 samples. At this time, the 8 samples are numbered 1-8 in order. After that, 8 samples are arranged on the horizontal axis and the vertical axis, that is, the 8 sample numbers are used as the horizontal coordinate and the vertical coordinate, and then a two-dimensional matrix is constructed according to the neighbor relationship between the samples.
  • the element in the i-th row and the i-th column indicates the connection relationship between the sample and itself. In the embodiment, this element is recorded as 1. It is understandable that the numbers 1-8 in the horizontal direction and the numbers 1-8 in the vertical direction in Fig. 7 are sample numbers and are not counted in the number of rows and columns.
  • the sample set contains many samples.
  • an adjacency matrix can be constructed based on each sample, and the corresponding sample and the samples in the corresponding K nearest neighbor sample set are used as the horizontal axis of the adjacency matrix And the vertical axis, through the adjacency matrix, the neighbor relationship between the sample and the K neighbor samples can be determined. Or, build an adjacency matrix based on the sample set. At this time, the neighbor relationship between each sample in the sample set can be determined through the adjacency matrix.
  • Step 211 Count the non-zero elements in the adjacency matrix to determine all connected samples of each sample.
  • the K-nearest neighbor sample set of a certain sample includes another sample, and the K-nearest neighbor sample set of the other sample does not include the sample, then the two samples are determined to be non-nearest neighbor samples. can be omitted. Therefore, it is necessary to find all the neighboring samples of each other, and determine the connected samples of each sample based on the neighboring samples of each other.
  • the non-zero elements in the adjacency matrix are used to determine that they are neighbor samples. For example, the numbers of the two samples are 5 and 6, and they are recorded as sample 5 and sample 6.
  • the element in row 5 and column 6 indicates whether sample 6 is included in the K-nearest neighbor sample set of sample 5
  • the element in row 6 and column 5 indicates whether sample 5 is included in the K-nearest neighbor sample set of sample 6 . If both elements are non-zero elements, it means that sample 5 and sample 6 are mutually contained, that is, sample 5 and sample 6 are neighboring samples to each other, and the connection relationship between sample 5 and sample 6 is saved. At this time, sample 5 is recorded It is the connected sample of sample 6. Similarly, the sample 6 is recorded as the connected sample of sample 5. According to the above method, by counting each non-zero element, the connected sample of each sample can be obtained.
  • Step 2111 in the adjacency matrix, obtain an element group in a symmetrical position, the element group including the first element in the i-th row and j-th column and the second element in the j-th row and i-th column.
  • two elements in a symmetrical position in the adjacency matrix are denoted as element groups.
  • the symmetrical position refers to two positions with opposite abscissa and ordinate.
  • the i-th row and the j-th column and the j-th row and the i-th column are symmetric positions.
  • the elements corresponding to the two symmetric positions are recorded as an element group.
  • the element in the i-th row and the j-th column is marked as the first element, which indicates whether the j-th sample is included in the set of K nearest neighbor samples corresponding to the i-th sample.
  • the element in the j-th row and the i-th column is marked as the second element, which indicates whether the i-th sample is included in the set of K nearest neighbor samples corresponding to the j-th sample.
  • Step 2112 if the first element and the second element contain at least one zero element, set both the first element and the second element as zero elements.
  • the first element and the second element contain at least one zero element, and if the first element and the second element contain at least one zero element, both the first element and the second element are set to zero Element, otherwise, keep the first element and the second element unchanged, and execute step 2123.
  • the first element and the second element containing at least one zero element indicate that the K-nearest neighbor sample set of at least one of the corresponding two samples does not include another sample, that is, the two samples are non-neighbor samples of each other.
  • both the first element and the second element are modified to zero elements, that is, the neighbor relationship between the two elements is cancelled.
  • the first element in the first row and the eighth column is 1, and the second element in the eighth row and the first column is 0, and the first element and the second element belong to a symmetrical element group, so , Modify the first element in the first row and the eighth column to 0, that is, cancel the neighbor relationship between sample 1 and sample 8.
  • Step 2113 After traversing all element groups of the adjacency matrix, update the adjacency matrix.
  • FIG. 8 is a schematic diagram of another adjacency matrix provided in the second embodiment of the disclosure.
  • Step 2114 Count the non-zero elements in the updated adjacency matrix, and determine the two samples corresponding to the non-zero elements as neighboring samples with each other and have a connection relationship.
  • two samples corresponding to any non-zero element in the updated adjacency matrix are neighboring samples to each other. Therefore, based on the non-zero elements in the updated adjacency matrix, all edges can be determined to be neighboring samples of each other.
  • the updated adjacency matrix is a symmetrical adjacency matrix
  • when obtaining non-zero elements only one non-zero element in the symmetric position can be obtained, and two non-zero elements can be determined according to the non-zero element.
  • the samples are neighboring samples of each other. After confirming that they are neighboring samples, the lines between the neighboring samples can be kept in the sample set.
  • Step 2115 Obtain all connected samples of each sample based on the samples that are close neighbors to each other.
  • all the neighboring samples that include a certain sample are obtained, and the other sample among all the obtained neighboring samples is used as all connected samples of the sample.
  • Step 212 Filter all connected samples based on the average distance to filter out connected samples whose second sample distance is greater than the average distance.
  • the second sample distance is the distance between the sample and the connected sample of the sample.
  • the distance between the sample and its corresponding connected sample is recorded as the second sample distance, that is, the distance between the adjacent samples is recorded as the second sample distance.
  • the distance of the second sample is greater than the mean distance, it means that although the corresponding two samples are neighboring samples of each other, their specific characteristics are quite different, and clustering together will affect the accuracy of the clustering results. Sex. Therefore, in the embodiment, the connection relationship between the two samples is eliminated, that is, the two samples are determined as non-nearest neighbor samples. At this point, you can delete the line between the two samples in the sample set. At the same time, the corresponding elements in the adjacency matrix are adjusted to zero elements.
  • the connected samples corresponding to each sample can be filtered according to the above method, and only the connected samples that are less than the mean distance are retained.
  • this step can also be understood as scanning the connection relationship of each sample in the sample set based on the scanning radius to obtain an accurate connection relationship.
  • Step 213 Cluster the samples in the sample set based on the S value and the connected samples obtained after filtering.
  • this step includes step 2131 to step 2139:
  • Step 2131 sequentially count the total number of connected samples of each sample.
  • the total number of connections for each sample is determined according to the connections between the samples in the sample set, and then the total number of connected samples is obtained.
  • the total number of connected samples corresponding to each sample is the total number of connected samples retained after filtering based on the mean distance. It is understandable that in practical applications, it is also possible to record only the connection relationship between adjacent samples, instead of reflecting in the sample set. At this time, the connected samples of each sample can be determined according to the recorded connection relationship, and then the total number of connected samples can be obtained.
  • Step 2132 Use samples with a total number of connected samples greater than the S value as core samples.
  • the total number of connected samples of each sample is compared with the S value, and if the total number of connected samples is greater than the S value, the corresponding sample is recorded as a core sample.
  • the core sample can be understood as the sample that can be used as the starting point in the clustering process.
  • each sample and its connected samples are usually clustered into a cluster because of the high feature similarity. If the total number of a sample is less than the S value, it means that the number of samples in the clusters obtained by subsequent clustering is less than The smallest possible clustering includes the number of samples. Therefore, during clustering, this sample will not be selected as the starting point, that is, this sample will not be selected as the core sample.
  • Step 2133 Among all the obtained core samples, any core sample is selected as the current sample.
  • a core sample is selected as the starting point of this clustering, and it is recorded as the current sample.
  • the current sample is determined in a random manner.
  • the current sample selection rule can also be set, and the current sample can be selected through the rule.
  • the core sample is marked as visited.
  • Step 2134 Access all connected samples of the current sample.
  • connection samples that have a connection relationship with the current sample are obtained, and all the obtained connection samples are marked as visited.
  • Step 2135 Use each connected sample obtained by the visit as a vertex, and visit all connected samples corresponding to the vertex.
  • each currently obtained connection sample is regarded as a vertex, and then, according to the currently retained connection relationship, all the connection samples that have a connection relationship with each vertex are continuously obtained.
  • each vertex can also be regarded as a child starting point in a cluster.
  • Step 2136 Confirm whether to access a new connection sample. If a new connection sample is obtained by the visit, step 2135 is returned to, and if the new connection sample is not accessible, step 2137 is performed.
  • connection sample when continuing to obtain all connection samples that have a connection relationship with each vertex according to the currently retained connection relationship, it is determined whether to obtain a new connection sample, that is, whether to obtain a connection sample that is not marked as visited. If a new connection sample is obtained, it means that there are still new samples with similar characteristics. At this time, you can return to step 2135, which is to use the newly obtained connection sample as a vertex, and continue to visit all connected samples of the vertex until you cannot get Until the new connection sample. If no new connection sample is obtained, it means that a sample with all similar features based on the core sample has been found. At this point, it can be considered that this clustering is over, and 2137 is executed.
  • Step 2137 Confirm whether there are core samples that have not been accessed. If yes, go to step 2138; otherwise, go to 2139.
  • step 2138 it is determined whether there are currently core samples that have not been visited, that is, whether there are currently core samples that have not been marked as visited. If there is a core sample that has not been visited, the core sample is updated to the current sample, and a new clustering process is started, that is, step 2138 is executed. If it is confirmed that the core samples have been visited, it means that all the starting points that can be clustered have been visited, and the starting point of clustering cannot be found. Therefore, step 2139 is performed.
  • Step 2138 Update any core sample that has not been visited as the current sample. Go back to step 2134.
  • the current sample is selected in a random manner. If the number of core samples that have not been visited is 1, then this core sample is taken as the current sample. After that, return to step 2134, that is, start a new clustering.
  • the K neighboring sample set of sample A includes sample B.
  • sample A and sample The connection relationship between B will be kicked out, that is, the dotted line between sample A and sample B will be deleted.
  • the sample A and the sample B will not be clustered, thereby ensuring the rationality of the clustering.
  • the technical means of filtering the samples with connection relationship and clustering the sample set based on the filtered connection relationship and the S value solves the technical problem that the DBSCAN algorithm in related technologies cannot reasonably cluster the sample set with uneven density.
  • the symmetric adjacency matrix and the method of filtering the connected samples based on the mean distance it is possible to prevent samples of different densities from clustering into a cluster when the distribution density of the samples is uneven, which affects the accuracy of clustering.
  • the frequency distribution histogram is used to determine the distance mean value without user input, which reduces the workload of manual parameter adjustment, and the distance mean value is determined statistically to ensure the reasonableness of the distance mean value and thus the accuracy of clustering.
  • FIG. 9 is a schematic structural diagram of a sample clustering device provided in Embodiment 3 of the disclosure.
  • the sample clustering device includes: a distance statistics module 301, a distance acquisition module 302, an average value calculation module 303, a connection determination module 304 and a sample clustering module 305.
  • the first sample distance between each sample in the sample set and its S-th nearest neighbor sample is counted, and the distance average is obtained based on the first sample distance.
  • K (K>S) nearest neighbor sample set of each sample Determine the connected sample corresponding to each sample, the connected sample and the sample are close neighbor samples and have a connection relationship, and then, based on the minimum number of samples included in the cluster (S value) and scan radius (distance mean)
  • S value minimum number of samples included in the cluster
  • scan radius distance mean
  • the clustering sub-module includes: a total number statistical unit for counting the total number of connected samples of each sample in turn; a core sample determining unit for determining the total number of connected samples greater than the S value
  • the sample is used as the core sample;
  • the current sample selection unit is used to select any core sample as the current sample among all the obtained core samples;
  • the first access unit is used to access all connected samples of the current sample;
  • the second access unit For each connection sample obtained from the visit as a vertex, and to access all the connected samples corresponding to the vertex;
  • the third access unit is used to repeatedly use each connected sample obtained by the visit as a vertex, and to access the The operation of all connected samples corresponding to the vertices until no new connected samples can be accessed;
  • the sample update unit is used to update any core sample that has not been visited to the current sample, and return to execute all access to the current sample The operation of connecting samples until all core samples are visited;
  • the cluster clustering unit is used to cluster the current sample and the connected samples obtained
  • the distance acquisition module 302 includes: a histogram construction sub-module, configured to construct a frequency distribution histogram based on all the first sample distances; a frequency statistics sub-module, configured to count the frequency distribution The frequency of each bin in the histogram is used to determine the set distance range; the first distance obtaining submodule is used to obtain the first sample distance within the set distance range.
  • the frequency statistics sub-module includes: a maximum bin obtaining unit for obtaining the bin with the maximum frequency in the frequency distribution histogram; a drop calculation unit for calculating the frequency drop between adjacent bins , The last bin is the bin located behind the bin with the largest frequency in the frequency distribution histogram; the bin confirmation unit is used to confirm the adjacent bin with the largest frequency drop, and the bin at the largest adjacent bin Select a bin located at the rear in the middle; a threshold determination unit configured to use the first sample distance corresponding to the bin with the highest frequency and the first sample distance corresponding to the bin located at the rear as the distance threshold of the set distance range.
  • the mean value calculation module 303 includes: a sample number acquisition sub-module for acquiring the number of samples whose first sample distance is within the set distance range; a total distance sub-module for comparing Each first sample distance within the set distance range is added to obtain a total sample distance; a quotient calculation sub-module is configured to use the quotient of the total sample distance and the number of samples as the average distance.
  • the sample clustering device provided by the embodiment of the present disclosure is included in the sample clustering device, and can be used to execute the sample clustering method provided in any of the foregoing embodiments, and has corresponding functions and beneficial effects.
  • the input device 42 can be used to receive inputted numeric or character information, and generate key signal inputs related to user settings and function control of the sample clustering device.
  • the output device 43 may include a display device such as a display screen.
  • Embodiments of the present disclosure also provide a storage medium containing computer-executable instructions, which are used to execute a sample clustering method when executed by a computer processor, the method including:
  • the samples in the sample set are clustered according to the connected samples, the distance average value, and the S value, where the distance average value is a scan radius, and the S value is the minimum number of samples included in the cluster.
  • a storage medium containing computer-executable instructions provided by an embodiment of the present disclosure is not limited to the method operations described above, and can also execute the sample clustering method provided by any embodiment of the present disclosure. Related operations.
  • the present disclosure can be implemented by software and necessary general-purpose hardware, of course, it can also be implemented by hardware, but in many cases the former is a more suitable implementation .
  • the technical solution of the present disclosure can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a computer floppy disk, Read-Only Memory (ROM), Random Access Memory (RAM), Flash memory (FLASH), hard disk or optical disk, etc., including several instructions to make a computer device (which can be a personal computer, A server, or a network device, etc.) execute the method described in each embodiment of the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Image Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本公开提供了一种样本聚类方法、装置、设备及存储介质,涉及数据处理领域,其包括:统计样本集中每个样本对应的第一样本距离,第一样本距离为样本与样本的第S近邻样本之间的距离;在全部第一样本距离中,获取设定距离范围内的第一样本距离;基于设定距离范围内的第一样本距离计算距离均值;基于每个样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,样本与样本的连接样本为互为近邻样本且存在连接关系;根据连接样本、距离均值和S值对样本集中的样本进行聚类,距离均值为扫描半径,S值为聚类最小包含样本数。采用上述方法可以解决相关技术中DBSCAN算法对于密度不均的样本集无法合理聚类的技术问题。

Description

样本聚类方法、装置、设备及存储介质
本申请要求在2019年6月24日提交中国专利局、申请号为201910551643.8的中国专利申请的优先权,以上申请的全部内容通过引用结合在本申请中。
技术领域
本公开涉及数据处理技术领域,例如涉及一种样本聚类方法、装置、设备及存储介质。
背景技术
聚类分析指将物理或抽象对象的集合分组为由类似的对象组成的多个类的分析过程。如今,聚类分析被广泛用于各类领域中,并且随着聚类分析的广泛应用,各类聚类算法应运而生。例如,K-MEANS算法、K-MEDOIDS算法、BIRCH算法、CURE算法、DBSCAN算法、OPTICS算法等。其中,DBSCAN算法是一个比较有代表性的基于密度的聚类算法,其需要人工输入两个参数:一个为扫描半径,记为eps;另一个为最小包含点数,记为minPts,并通过两个参数在样本集中找到密度相连对象的最大集合。发明人在实现本公开的过程中,发现相关技术存在如下缺陷:基于DBSCAN算法对样本集进行聚类时,对于密度不均的样本集而言,若扫描半径较小,则对于密度稀疏的样本而言,容易被认为是噪声点而剔除,若扫描半径较大,则易将距离较远的样本聚为一类,此时,无法保证样本聚类的准确性。
综上,如何在DBSCAN算法下,对于密度不均的样本集进行合理聚类,成为了亟待解决的问题。
发明内容
本公开提供了一种样本聚类方法、装置、设备及存储介质,以解决相关技术中DBSCAN算法对于密度不均的样本集无法合理聚类的技术问题。
第一方面,本公开实施例提供了一种样本聚类方法,包括:
统计样本集中每个样本对应的第一样本距离,所述第一样本距离为所述样本与所述样本的第S近邻样本之间的距离;
在全部所述第一样本距离中,获取设定距离范围内的第一样本距离;
基于所述设定距离范围内的第一样本距离计算距离均值;
基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,所述样本与所述样本的连接样本为互为近邻样本且存在连接关系;
根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类,所述距离均值为扫描半径,所述S值为聚类最小包含样本数。
在一实施方式中,所述根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类包括:
基于所述距离均值对全部所述连接样本进行过滤,以滤除第二样本距离大于所述距离均值的连接样本,所述第二样本距离为样本与所述样本的连接样本之间的距离;
基于S值和过滤后得到的连接样本对所述样本集中的样本进行聚类。
在一实施方式中,所述基于S值和过滤后得到的连接样本对所述样本集中的样本进行聚类包括:
依次统计每个样本的连接样本总数量;
将所述连接样本总数量大于S值的样本作为核心样本;
在得到的全部核心样本中,选择任一核心样本作为当前样本;
访问所述当前样本的全部连接样本;
将访问得到的每个连接样本分别作为顶点,并访问所述顶点对应的全部连接样本;
重复将访问得到的每个连接样本分别作为顶点,并访问所述顶点对应的全部连接样本的操作,直到访问不到新的连接样本为止;
将未被访问过的任一核心样本更新为当前样本,并返回执行访问所述当前样本的全部连接样本的操作,直到全部核心样本均被访问为止;
将所述当前样本及基于当前样本访问得到的连接样本聚类为簇。
在一实施方式中,所述基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本包括:
获取每个样本对应的K近邻样本集合;
根据全部所述K近邻样本集合,构建邻接矩阵,所述邻接矩阵中每个元素代表对应两个样本间的近邻关系;
统计所述邻接矩阵中非零元素,以确定每个样本的全部连接样本。
在一实施方式中,所述统计所述邻接矩阵中非零元素,以确定每个样本的全部连接样本包括:
在所述邻接矩阵中,获取处于对称位置的元素组,所述元素组包括第i行第j列的第一元素和第j行第i列的第二元素;
若所述第一元素和所述第二元素中包含至少一个零元素,则将所述第一元素和第二元素均设置为零元素;
遍历所述邻接矩阵的全部元素组后,更新所述邻接矩阵;
统计更新后的邻接矩阵中非零元素,并将所述非零元素对应的两个样本确定为互为近邻样本且具有连接关系;
基于所述互为近邻样本,得到每个样本的全部连接样本。
在一实施方式中,所述在全部所述第一样本距离中,获取设定距离范围内的第一样本距离包括:
基于全部所述第一样本距离,构建频数分布直方图;
统计所述频数分布直方图中各bin的频数,以确定设定距离范围;
获取设定距离范围内的第一样本距离。
在一实施方式中,所述统计所述频数分布直方图中各bin的频数,以确定设定距离范围包括:
获取所述频数分布直方图中频数最大bin;
计算相邻后位bin之间的频数落差,所述后位bin为所述频数分布直方图中位于频数最大bin后方的bin;
确认频数落差最大的相邻后位bin,并在所述最大的相邻后位bin中选择位于后方的bin;
将所述频数最大bin对应的第一样本距离和所述位于后方的bin对应的第一样本距离作为设定距离范围的距离阈值。
在一实施方式中,所述基于所述设定距离范围内的第一样本距离计算距离均值包括:
获取所述第一样本距离处于所述设定距离范围内的样本数量;
对所述设定距离范围内每个第一样本距离进行相加,以得到样本总距离;
将所述样本总距离与所述样本数量的商值作为距离均值。
在一实施方式中,所述统计样本集中每个样本对应的第一样本距离之前,还包括:
构建样本集中每个样本的K近邻图,所述K近邻图中每条边的权值为对应样本间的距离。
第二方面,本公开实施例还提供了一种样本聚类装置,包括:
距离统计模块,用于统计样本集中每个样本对应的第一样本距离,所述第一样本距离为所述样本与所述样本的第S近邻样本之间的距离;
距离获取模块,用于在全部所述第一样本距离中,获取设定距离范围内的第一样本距离;
均值计算模块,用于基于所述设定距离范围内的第一样本距离计算距离均值;
连接确定模块,用于基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,所述样本与所述样本的连接样本为互为近邻样本且存在连接关系;
样本聚类模块,用于根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类,所述距离均值为扫描半径,所述S值为聚类最小包含样本数。
第三方面,本公开实施例还提供了一种样本聚类设备,包括:
一个或多个处理器;
存储器,用于存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如第一方面所述的样本聚类方法。
第四方面,本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面所述的样本聚类方法。
上述样本聚类方法、装置、设备及存储介质,通过统计样本集中每个样本与其第S近邻样本之间的第一样本距离,并基于第一样本距离得到距离均值,同时,基于每个样本的K(K>S)近邻样本集合,确定每个样本对应的连接样本,该连接样本与样本之间为互为近邻样本且具有连接关系,之后,基于聚类最小包含样本数(S值)以及扫描半径(距离均值)对具有连接关系的样本进行聚类的技术手段,解决了相关技术中DBSCAN算法对于密度不均的样本集无法合理聚类的技术问题,通过第一样本距离确定合理的扫描半径,之后,基于扫描半径对互为近邻样本进行聚类,保证了聚类合理性,当样本集中的样本分布密度不均时,通过互为近邻样本可以避免将稀疏分布的样本与密集分布的样本聚类成簇。同时,通过频数分布直方图确定距离均值,无需用户输入,减小了手动调参的工作量。
附图说明
图1为本公开实施例一提供的一种样本集分布示意图;
图2为本公开实施例一提供的一种样本聚类方法的流程图;
图3为本公开实施例一提供的另一种样本集分布示意图;
图4为本公开实施例二提供的一种样本聚类方法的流程图;
图5为本公开实施例二提供的一种K近邻图;
图6为本公开实施例二提供的一种频数分布直方图;
图7为本公开实施例二提供的一种邻接矩阵示意图;
图8为本公开实施例二提供的另一种邻接矩阵示意图;
图9为本公开实施例三提供的一种样本聚类装置的结构示意图;
图10为本公开实施例四提供的一种样本聚类设备的结构示意图。
具体实施方式
下面结合附图和实施例对本公开作详细说明。可以理解的是,此处所描述的实施例用于解释本公开,而非对本公开的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本公开相关的部分而非全部结构。
DBSCAN(Density-Based Spatial Clustering of Applications with Noise)是一个比较有代表性的基于密度的聚类算法。通常,DBSCAN需要人工输入两个参数:eps和minPts。针对样本集中的某个对象(即某个样本)而言,若eps的值为E,则将该对象的扫描半径E内的区域记为该对象的E邻域。若该对象的E邻域内的样本点数大于或等于minPts,则将该对象记为核心对象。对于样本P和样本Q,若样本Q在样本P的E邻域内,且样本P为核心对象,那么,样本Q从样本P直接密度可达。对于样本P 1、样本P 2、……、样本P n,若样本P i从样本P i-1直接密度可达,那么样本P n从样本P 1密度可达。设定样本O到样本P密度可达,样本O到样本Q密度可达,那么样本P和样本Q密度相连。对于DBSCAN而言,其目的是找到密度相连对象的最大集合。
对于密度不均的样本集,如图1所示的样本集,其中,图1为本公开实施例一提供的一种样本集分布示意图,参考图1,左半部分的样本较为密集,右半部分的样本较为稀疏。此时,若将eps设置较小的值,例如,将eps设置为图1中圆圈11对应的半径,此时,对于右半部分的样本而言,由于扫描不到其他样本,因此,会被认为是噪声点并滤除。这样会导致右半部分的样本大量被滤除,影响聚类准确性。若将eps设置较大的值,例如,将eps设置为图1中圆圈12对应的半径,那么,在扫描时会将左半部分和右半部分的样本聚为一类,或者,使得左半部分的大量样本聚为一类,进而影响聚类准确性。
综上,本公开实施例提供一种样本集聚类方法,以解决对于密度不均的样本集无法合理聚类的问题。
实施例一
图2为本公开实施例一提供的一种样本聚类方法的流程图。实施例中提供的样本聚类方法可以由样本聚类设备执行,该样本聚类设备可以通过软件和/或硬件的方式实现,该样本聚类设备可以是两个或多个物理实体构成,也可以是一个物理实体构成。例如,样本聚类设备可以是电脑、手机、平板或交互智能平板等具有数据运算、分析能力的智能设备。
在一实施方式中,参考图2,该样本聚类方法包括:
步骤110、统计样本集中每个样本对应的第一样本距离,第一样本距离为样本与样本的第S近邻样本之间的距离。
示例性的,样本集中包括多个样本,每个样本的数据类型相同。其中,样本的数据类型可以根据实际情况设定,实施例对此不作限定。例如,实施例中以对样本集中的样本进行聚类为例描述样本聚类方法。在一实施方式中,样本集的获取方式实施例不作限定,其可以是样本聚类设备自行采集的数据,也可以是用户输入的数据,还可以是对特定数据进行处理后得到的数据。通常,样本集中每个样本代表一个数据特征。例如,样本集中每个样本表示同一用户在设定周期内每天不同时间段内的位置数据。
典型的,以图1为例,样本集中的样本散落在特征空间不同的位置。通常,样本位置与样本自身代表的特征有关,特征越相似,样本间的距离越近。例如,预先设定特征放置规则,进而根据该规则确定样本位置。其中,特征放置规则的具体内容可以根据实际情况设定。例如,针对位置数据而言,在特征空间内划分经纬度,之后,基于各样本的位置数据包含的经 纬度确定各样本在特征空间的位置。
在一实施方式中,获取样本集后,样本聚类设备可以计算样本集中任意两个样本之间的距离。其中,距离的计算方式实施例不作限定,例如,采用欧式距离、闵可夫斯基距离、曼哈顿距离等方式确定样本间的距离。通常,两个样本间距离越近,表明两个样本越相似。
示例性的,样本的第S近邻样本是指距离该样本第S近的样本。针对任一样本,样本聚类设备可以计算该样本与其他样本的距离,并根据各距离,确定距离该样本第S近的样本,并记为第S近邻样本。其中,S为正整数,其具体数值可以结合实际情况设定。在一实施方式中,S值表示聚类最小包含样本数。即对样本集聚类后得到多个簇,每个簇最少包含S个样本。一般而言,第S近邻样本的数量为1,有些情况下,第S近邻样本的数量可能是多个,此时,可以任选一个第S近邻样本。
在一实施方式中,在确定第S近邻样本前,对每个样本绘制对应的K近邻图,其中,K为正整数且大于S,通常,K的具体数值可以根据实际情况设定。在一实施方式中,对于某个样本的K近邻图而言,顶点为该样本,且图中包含距离该样本最近的K个近邻样本,同时,将样本与K个近邻样本分别相连,且任一连线的权值为该连线的两个样本之间的距离。举例而言,K等于8时,获取距离样本最近的8个样本,并将其分别连线,此时,连线两端的样本可以认为有连接关系,且其连线的权值为两个样本之间的距离。确定K近邻图后,便可以根据K近邻图得到样本的第S近邻样本,以及相应的距离。
在一实施方式中,将样本与第S近邻样本间的距离记为第一样本距离。
步骤120、在全部第一样本距离中,获取设定距离范围内的第一样本距离。
在一实施方式中,设定距离范围是统计第一样本距离后得到的,用于计算扫描半径时的参考数据。通常,对于样本密度不均的样本集而言,样本稀疏的区域内,第一样本距离通常较大,样本密集的区域内,第一样本距离通常较小。此时,为了保证扫描半径的准确性,需要参考设定距离范围,仅获取设定距离范围内的第一样本距离得到扫描半径。一般而言,设定距离范围内的第一样本距离是全部第一样本距离中具有代表性的数据。
示例性的,统计每个第一样本距离对应的样本数量。其中,样本数量为50,表示存在50个样本的第一样本距离相同。在一实施方式中,根据样本数量确定设定距离范围。例如,基于样本数量构建频数分布直方图,其中,频数分布直方图的bin的具体数量可以结合样本集的样本总数量确定。在一实施方式中,频数分布直方图中横轴代表第一样本距离,纵轴代表第一样本距离的样本数量。获取频数分布直方图中频数最大bin,其中,频数最大bin对应的样本数量最多。之后,在频数最大bin的后位bin中,计算任意相邻两个bin之间的样本数量差值,选择差值最大的相邻两个bin。其中,后位bin是指从横轴而言位于频数最大bin后方的bin。在一实施方式中,选择相邻两个bin中位于后方的bin,并将该后方的bin和频数最大bin对应的两个第一样本距离确定为设定距离范围的两个距离阈值。或者是,获取频数最大bin后设定位数的后位bin,并将设定位数的后位bin和频数最大bin对应的两个第一样本距离确定为设定距离范围的两个距离阈值。再如,统计每个第一样本距离对应的样本数量后,由人工基于样本数量确定设定距离范围。实施例中,以将差值最大的后方bin和频数最大bin对应的两个第一样本距离作为设定距离范围的两个距离阈值为例进行描述。其中,频数最大bin对应的第一样本距离较小,因此,将其作为设定距离范围的较小距离阈值,以在聚类时,保证扫描到足够数量特征相似的样本。差值最大的后方bin对应的第一样本距离较大,因此,将其作为设定距离范围的较大距离阈值。通常,差值最大的后方bin表明该bin对应的样本数量减少幅度最大,即说明从该bin对应的第一样本距离开始,样本数量越来越少,相应的, 样本和其第S近邻样本间特征差异越来越大,因此,将该bin对应的第一样本距离作为设定距离范围的较大阈值,可以在计算扫描半径时,忽略差异较大的样本,进而保证聚类准确度。
步骤130、基于设定距离范围内的第一样本距离计算距离均值。
在一实施方式中,统计在设定距离范围内的全部样本及相应的第一样本距离。之后,将设定距离范围内的全部第一样本距离相加,并将相加结果记为样本总距离。同时,统计设定距离范围内的样本总数量,并将样本总距离除以样本总数量,进而将得到的商记为距离均值。此时,该距离均值表示扫描半径。
步骤140、基于每个样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,样本与样本的连接样本为互为近邻样本且存在连接关系。
在一实施方式中,计算每个样本与其他各样本之间的距离后,获取与该样本距离最近的K个样本,组成该样本对应的K近邻样本集合,其中,K近邻样本集合中的每个样本可以记为近邻样本,即样本与近邻样本间存在近邻关系。如果预先构建样本的K近邻图,则本步骤可以直接获取K近邻图中的样本作为K近邻样本集合。
在一实施方式中,连接样本是指与当前样本具有连接关系的样本,通常,具有连接关系的两个样本可以记为互为近邻样本,互为近邻样本可以理解为两个样本对应的K近邻样本集合中均包含另一个样本。在一实施方式中,获取当前样本的K近邻样本集合,之后,再获取K近邻样本集合中每个近邻样本的K近邻样本集合。确定当前样本是否包含在每个近邻样本的K近邻样本集合中,若当前样本包含在某个近邻样本的K近邻样本集合中,则将该近邻样本和当前样本确定为互为近邻样本,并保存近邻样本和当前样本间连接关系,此时,将该近邻样本记为当前样本的连接样本。其中,保存连接关系的方式可以是在样本集中,绘制两个样本之间的连线。在一实施方式中,按照上述步骤便可以确定每个样本对应的全部连接样本。相应的,对于K近邻样本集合中的非连接样本,可以不保存其连接关系。
此外,还可以通过邻接矩阵的方式确定连接样本。在一实施方式中,基于K近邻样本集合构建邻接矩阵,其中,邻接矩阵中每个元素用于表示对应的两个样本是否为近邻关系。若是近邻关系,则对应的元素为非零元素,若不是近邻关系,则对应的元素为零元素。在一实施方式中,确定邻接矩阵中任一组位置对称的元素是否均为非零元素,若是,则说明两个样本对应的K近邻样本集合中均包含另一个样本,即两个样本为互为近邻样本且具有连接关系。遍历邻接矩阵的全部对称元素后,便可以确定每个样本的连接样本。
举例而言,图3为本公开实施例一提供的另一种样本集示意图。参考图3,K为5,对于样本A,其K近邻样本集合包含与样本A为实线连接的5个样本,其中,有两个样本与样本A的连线部分重合。对于样本B,其K近邻样本集合包含与样本B为实线连接的4个样本以及样本A。虽然样本B的K近邻样本集合中包含样本A,但是样本A的K近邻样本集合中不包含样本B,因此,样本B和样本A不是互为近邻样本,此时不保存样本A和样本B的连接关系。按照上述方式遍历全部样本后,便可以得到与每个样本具有连接关系的连接样本。
需要说明的是,实施例不限定步骤140与步骤110-步骤130的执行顺序,实际应用中,也可以先执行步骤140,再执行步骤110-步骤130,或者是步骤140与步骤110-步骤130同步执行。
步骤150、根据连接样本、距离均值和S值对样本集中的样本进行聚类,距离均值为扫描半径,S值为聚类最小包含样本数。
其中,聚类最小包含样本数为minPts。示例性的,将距离均值作为扫描半径,将S值作为minPts对样本集中的样本进行DBSCAN聚类。在一实施方式中,选择某个样本作为当前 样本,之后,以距离均值作为扫描半径对当前样本的周围区域进行扫描。此时,在扫描过程中,仅获取当前样本的连接样本,之后,若连接样本的数量大于S,则将当前样本和扫描得到的连接样本聚类为簇。
或者是,确定每个样本的连接样本总数量,若连接样本总数量大于S,则将该样本作为核心样本。遍历样本集中的全部样本后,找到全部的核心样本。之后,任选一核心样本作为当前样本,并获取当前样本的全部连接样本。在一实施方式中,将获取到的连接样本作为顶点,继续获取每个连接样本的全部连接样本,之后,再将获取到的连接样本作为顶点,并继续获取其对应的全部连接样本,重复此操作,直到遍历不到新的连接样本为止,此时,将得到的全部连接样本和当前样本聚类为簇。之后,获取未被处理的核心样本,并继续按照上述步骤得到连接样本,进而形成新的簇。当确定每个核心样本均被处理后,确定聚类结束。可以理解的是,在聚类过程中,若获取的某个连接样本为核心样本,则在后续过程中,不会再对该核心样本进行任何处理。
此时,针对于图3的样本集而言,在聚类的过程,样本A和样本B不会聚类成簇,样本A会与其特征相似且密度较密集的其他样本进行聚类,样本B会与其特征相似且密度较稀疏的其他样本进行聚类,保证了聚类合理性。
上述,通过统计样本集中每个样本与其第S近邻样本之间的第一样本距离,并基于第一样本距离得到距离均值,同时,基于每个样本的K(K>S)近邻样本集合,确定每个样本对应的连接样本,该连接样本与样本之间为互为近邻样本且具有连接关系,之后,基于聚类最小包含样本数(S值)以及扫描半径(距离均值)对具有连接关系的样本进行聚类的技术手段,解决了相关技术中DBSCAN算法对于密度不均的样本集无法合理聚类的技术问题,通过第一样本距离确定合理的扫描半径,之后,基于扫描半径对互为近邻样本进行聚类,保证了聚类合理性,当样本集中的样本分布密度不均时,通过互为近邻样本可以避免将稀疏分布的样本与密集分布的样本聚类成簇,进而保证聚类准确性。
实施例二
图4为本公开实施例二提供的一种样本聚类方法的流程图。本实施例是在上述实施例的基础上进行具体化。参考图4,本实施例提供的样本聚类方法包括:
步骤201、构建样本集中每个样本的K近邻图,K近邻图中每条边的权值为对应样本间的距离。
在一实施方式中,计算每个样本与其他各样本之间的距离后,绘制某个样本的K近邻图时,将该样本作为顶点,并根据样本之间的距离获取距该样本最近的K个样本以及对应的距离。之后,分别绘制顶点与K个样本的连线,并将顶点与对应样本的距离作为该连线的权值。举例而言,图5为本公开实施例二提供的一种K近邻图。参考图5,其为图3中样本C的K近邻图,其中,K为6,根据样本C与其他样本的距离获取距离样本C最近的K个样本以及距离,之后,绘制样本C与K个样本的连线,并将距离作为连线的权值。需要说明的是,图5中示出的连线的权值仅用于描述K近邻图,并非对距离或距离计算的限定。实际应用中,权值可以不示于K近邻图中。一般而言,基于K近邻图,可以得到样本集中各样本之间的连线关系,即近邻关系。
需要说明的是,构建K近邻图的好处是便于后续确定第一样本距离、连接样本等,即便于后续计算。
步骤202、统计样本集中每个样本对应的第一样本距离,第一样本距离为样本与样本的第S近邻样本之间的距离。
由于S<K,因此,可以在每个样本的K近邻图中,获取距离其最近的第S近邻样本,并根据样本和第S近邻样本的连线的权值确定第一样本距离。
步骤203、基于全部第一样本距离,构建频数分布直方图。
在一实施方式中,统计每个第一样本距离的出现次数,并将该次数作为对应第一样本距离的频数,之后,基于各频数构建频数分布直方图。实际应用中,考虑到存在数值很接近的第一样本距离,例如,两个第一样本距离分别为0.585和0.593,其具体的数值比较接近,此时,若每个第一样本距离对应一个频数,会增加统计复杂度及频数分布直方图复杂度,因此。实施例中,预先对第一样本距离进行分组,之后,统计在每个分组内第一样本距离的出现次数,并将出现次数作为该分组对应的频数。例如,距离0.55-0.65的分组内有1100个第一样本距离,因此,该分组对应的频数为1100。需要说明的是,分组规则实施例不作限定。在一实施方式中,在建立频数分布直方图时,用横坐标表示距离(本示例中为第一样本距离),纵坐标表示样本数(即频数)。此时,每个距离分组可以记为一个bin。通常,bin的数量跟样本集的样本总数量相关。例如,样本集的样本总数量在5000以下,此时,bin的数量可以设为10,样本总数量超过5000后,设定每增加500个样本,bin的数量增加1。在一实施方式中,考虑到有些分组内频数很少,在后续计算时,其参考意义较低,因此,可以结合实际情况,忽略该距离分组的频数。
例如,图6为本公开实施例二提供的一种频数分布直方图。参考图6,该频数分布直方图的横坐标为距离,纵坐标为样本数,即频数,且bin为10。由图6可知每个bin对应的距离范围以及频数,并且,bin从1至10顺序排列。
设置频数分布直方图的好处是,清楚显示各距离范围内频数分布情况,以及易于显示各距离范围之间频数的差别。
步骤204、统计频数分布直方图中各bin的频数,以确定设定距离范围。
实施例中,设定基于各bin的频数确定设定距离范围。此时,该步骤包括步骤2041-步骤2044:
步骤2041、获取频数分布直方图中频数最大bin。
在一实施方式中,统计各距离范围对应的频数,之后,获取最大的频数对应的bin,并记为频数最大bin。例如,参考图6,基于纵坐标确定频数最大bin为5。
步骤2042、计算相邻后位bin之间的频数落差,后位bin为频数分布直方图中位于频数最大bin后方的bin。
示例性的,根据bin的排列顺序,将位于某个bin后方的任一bin记为该bin的后位bin。实施例中,获取频数最大bin的全部后位bin。以图6为例,频数最大bin的后位bin为第6个bin至第10个bin。
在一实施方式中,相邻bin是指顺序相邻的两个bin,例如,图6中,第1个bin和第2个bin为相邻bin,第2个bin和第3个bin为相邻bin,依次类推。实施例中,获取后位bin中的相邻bin,并计算相邻bin中两个bin的频数差值,其中,频数差值为正数且记为频数落差。在计算频数差值时,可以是对相邻的两个bin对应的频数做减法,若结果为正数,则直接将该结果作为频数落差,若结果为负数,则将该结果的绝对值作为频数落差。
实施例中,统计频数落差时,还可以计算频数最大bin与其相邻后位bin之间的频数落差,并将该频数落差与各相邻后位bin之间的频数落差一同作为本步骤的计算结果。
步骤2043、确认频数落差最大的相邻后位bin,并在最大的相邻后位bin中选择位于后方的bin。
通常,频数落差越大,表明相邻bin中位于后方的bin与位于前方的bin之间的频数相差越多,进而确定相邻bin中位于后方的bin对应的样本数量明显减少。实施例中,统计各频数落差后,选择频数落差最大的相邻后位bin,此时,在该相邻后位bin中,位于后方的bin对应的样本数量明显减少,且位于该bin后方的bin对应的样本数量很少,其代表性较低,在计算距离均值时,对准确性贡献较小,因此,可以在计算时可以忽略不计。据此,实施例中设定选择频数落差最大的相邻后位bin中位于后方的bin作为本步骤的计算结果。举例而言,参考图6,分别计算第6个bin与第7个bin之间的频数落差、第7个bin与第8个bin之间的频数落差、第8个bin与第9个bin之间的频数落差以及第9个bin与第10个bin之间的频数落差。计算各频数落差后,确定,第6个bin与第7个bin之间频数落差的频数落差最大,此时,选择位于后方的第7个bin。
步骤2044、将频数最大bin对应的第一样本距离和位于后方的bin对应的第一样本距离作为设定距离范围的距离阈值。
在一实施方式中,由于每个bin对应一个距离范围,因此,确定设定距离范围时,可以是选择每个距离范围的最小值作为距离阈值。例如,频数最大bin对应的距离范围的最小值作为设定距离范围中小的距离阈值,将后方的bin对应的距离范围的最小值作为设定距离范围中大的距离阈值。也可以是选择每个距离范围的最大值作为距离阈值。例如,频数最大bin对应的距离范围的最大值作为设定距离范围中小的距离阈值,将后方的bin对应的距离范围的最大值作为设定距离范围中大的距离阈值。还可以是结合实际情况,选择频数最大bin对应的距离范围的最小值作为设定距离范围中小的距离阈值,将后方的bin对应的距离范围的最大值作为设定距离范围中大的距离阈值。例如,参考图6,将第5个bin对应的距离范围中的最小值作为设定距离范围中的小的距离阈值,将第7个bin对应的距离范围中的最大值作为设定距离范围中的大的距离阈值。也可以是确定每个距离范围的居中距离值,并将居中距离值作为距离阈值。
通常,将频数最大bin对应的第一样本距离和位于后方的bin对应的第一样本距离作为设定距离范围的距离阈值的好处是,后续计算距离均值后,可以保证通过该距离均值聚类到较多样本,且滤除距离较远的样本,即保证了距离均值的合理性。
可以理解的是,步骤2041-步骤2044仅为确定设定距离范围的一种方式。实际应用中,还可以结合频数分布直方图采用其他方式确定设定距离范围。
步骤205、获取设定距离范围内的第一样本距离。
步骤206、获取第一样本距离处于设定距离范围内的样本数量。
在一实施方式中,由于一个样本对应一个第一样本距离。因此,可以统计在设定距离范围内的第一样本距离的总个数,并将总个数作为样本数量。也可以结合频数分布直方图确定样本数量,此时,将频数最大bin以及位于后方的bin之间的各bin对应的频数相加,以得到样本数量。例如,参考图6,将第5个bin、第6个bin以及第7个bin对应的频数相加,便可以得到样本数量。
步骤207、对设定距离范围内每个第一样本距离进行相加,以得到样本总距离。
在一实施方式中,将设定距离范围内的每个第一样本距离相加,并将结果记为样本总距离。或者是,基于频数分布直方图得到样本总距离,此时,可以将对应bin的频数乘以对应距离范围的居中距离值,之后,在再将得到的结果相加,进而得到样本总距离。例如,参考图6,获取第5个bin对应距离范围,之后,选择距离范围的居中距离值。将第5个bin对应的居中距离值和频数相乘得到第一结果,之后,按照同样的计算方式得到第6个bin对应的 第二结果以及第7个bin对应的第三结果,之后,将三个结果相加,以得到样本总距离。
步骤208、将样本总距离与样本数量的商值作为距离均值。
在一实施方式中,用样本总距离除以样本数量,便可以得到设定距离范围内第一样本距离的平均距离。实施例中,将平均距离记为距离均值,并将距离均值设置为扫描半径。相比于DBSCAN算法中人为指定扫描半径,本实施例可以集合样本集的实际情况自适应得到扫描半径,且利用了统计学原理确定扫描半径,保证了扫描半径的合理性。
步骤209、获取每个样本对应的K近邻样本集合。
在一实施方式中,基于每个样本的K近邻图,获取每个样本的K个近邻样本,并组成K近邻样本集合。即将K近邻图中除顶点外的全部样本组成顶点的K近邻样本集合。
步骤210、根据全部K近邻样本集合,构建邻接矩阵,邻接矩阵中每个元素代表对应两个样本间的近邻关系。
其中,邻接矩阵是用一个一维数组存放样本集所有样本;用一个二维数组存放样本集间关系的数据。邻接矩阵可以分为有向图邻接矩阵和无向图邻接矩阵。实施例中,以无向图邻接矩阵为例。在一实施方式中,将每个样本按顺序排列,排列后,每个样本对应一个编号。其中,排列规则实施例不做限定。在一实施方式中,将排列后的样本分别作为矩阵的横轴和纵轴,之后,用横轴和纵轴的交点元素表明对应两个样本之间是否为近邻关系。在一实施方式中,若某个样本包含在另一个样本的K近邻样本集合中,则该样本与另一个样本为近邻关系,此时,将以该样本为纵坐标,另一个样本为横坐标的交点元素记为非零元素。其中,非零元素的具体值可以根据实际情况设定。实施例中,以非零元素为1为例。实际应用中,非零元素还可以为对应的距离值,或其他数值。相应的,若某个样本不包含在另一个样本的K近邻样本集合中,则该样本与另一个样本为非近邻关系,此时,将以该样本为纵坐标,另一个样本为横坐标的交点元素记为零元素,即记为0。举例而言,图7为本公开实施例二提供的一种邻接矩阵示意图。参考图7,当前共有8个样本,此时,将8个样本按顺序赋予1-8编号。之后,在横轴和纵轴上排列的8个样本,即将8个样本编号作为横坐标和纵坐标,之后,根据样本间的近邻关系构建二维矩阵。此时,二维矩阵中第i行第j列的元素表明第j个样本是否为第i个样本的近邻样本。例如,第2行第3列的元素为1,则表明编号为2的样本对应的K近邻样本集合中包含编号为3的样本。再如,第7行第1列的元素为0,则表明编号为7的样本对应的K近邻样本集合中不包含编号为1的样本。通常,确定K近邻样本集合后,便可以根据K近邻样本集合为邻接矩阵内的元素进行赋值。通常,第i行第i列的元素表明样本与自身的连接关系,实施例中,将该元素记为1。可以理解的是,图7中横向的1-8编号和纵向的1-8编号为样本编号,不计在行数和列数中。
在一实施方式中,实际应用中,样本集包含很多的样本,此时,可以基于每个样本构建一个邻接矩阵,并将相应样本及对应的K近邻样本集合中的样本作为邻接矩阵的横轴和纵轴,通过该邻接矩阵可以确定样本与K个近邻样本间的近邻关系。或者是,基于样本集构建一个邻接矩阵。此时,通过该邻接矩阵可以确定样本集中各样本间的近邻关系。
步骤211、统计邻接矩阵中非零元素,以确定每个样本的全部连接样本。
在一实施方式中,若某个样本的K近邻样本集合包含另一样本,而另一样本的K近邻样本集合不包含该样本,则确定两个样本为非互为近邻样本,在聚类时可以忽略。因此,需要找到全部的互为近邻样本,并基于互为近邻样本确定各样本的连接样本。实施例中,通过邻接矩阵中的非零元素确定互为近邻样本。例如,两个样本的编号分别为5和6,并记为样本5和样本6。此时,邻接矩阵中,第5行第6列的元素表明样本5的K近邻样本集合中是否包 含样本6,第6行第5列的元素表明样本6的K近邻样本集合中是否包含样本5。若两个元素均为非零元素,则说明样本5和样本6相互包含,即样本5和样本6为互为近邻样本,且保存样本5和样本6的连接关系,此时,将样本5记为样本6的连接样本,同样,将样本6记为样本5的连接样本。按照上述方式,统计每个非零元素,便可以得到每个样本的连接样本。
实施例中,在统计非零元素时,设定该步骤包括步骤2111-步骤2115:
步骤2111、在邻接矩阵中,获取处于对称位置的元素组,元素组包括第i行第j列的第一元素和第j行第i列的第二元素。
在一实施方式中,将邻接矩阵中处于对称位置的两个元素记为元素组。其中,对称位置是指横纵坐标相反的两个位置。例如,第i行第j列和第j行第i列为对称位置,此时,将两个对称位置对应的元素记为一个元素组。在一实施方式中,将第i行第j列的元素记为第一元素,其表明第i个样本对应的K近邻样本集合中是否包含第j个样本。将第j行第i列的元素记为第二元素,其表明第j个样本对应的K近邻样本集合中是否包含第i个样本。通过获取对称位置的元素组,便可以得到对应两个样本间的近邻关系。
步骤2112、若第一元素和第二元素中包含至少一个零元素,则将第一元素和第二元素均设置为零元素。
在一实施方式中,确定第一元素和第二元素中是否包含至少一个零元素,若第一元素和第二元素中包含至少一个零元素,则将第一元素和第二元素均设置为零元素,否则,保持第一元素和第二元素不变,并执行步骤2123。其中,第一元素和第二元素中包含至少一个零元素表明对应的两个样本中至少有一个样本的K近邻样本集合中不包含另一个样本,即两个样本为非互为近邻样本。此时,将第一元素和第二元素均修改为零元素,即取消两个元素间的近邻关系。举例而言,参考图7,第1行第8列的第一元素为1,第8行第1列的第二元素为0,且第一元素和第二元素属于对称位置的元素组,因此,将第1行第8列的第一元素修改为0,即取消样本1和样本8的近邻关系。
步骤2113、遍历邻接矩阵的全部元素组后,更新邻接矩阵。
在一实施方式中,遍历处于对称位置的全部元素组后,更新邻接矩阵。以图7中所示的邻接矩阵为例,此时,遍历图7中的全部元素组后,更新该邻接矩阵,并得到图8所示的邻接矩阵。其中,图8为本公开实施例二提供的另一种邻接矩阵示意图。
步骤2114、统计更新后的邻接矩阵中非零元素,并将非零元素对应的两个样本确定为互为近邻样本且具有连接关系。
在一实施方式中,更新后的邻接矩阵中任一非零元素对应的两个样本为互为近邻样本。因此,基于更新后的邻接矩阵中的非零元素,边可以确定全部互为近邻样本。在一实施方式中,考虑到更新后的邻接矩阵为对称化的邻接矩阵,因此,在获取非零元素时,可以仅获取对称位置中的一个非零元素,并根据该非零元素确定两个样本为互为近邻样本。确定互为邻近样本后,可以在样本集中保留互为近邻样本间的连线。
步骤2115、基于互为近邻样本,得到每个样本的全部连接样本。
在一实施方式中,获取包含某个样本的全部互为近邻样本,并将获取的全部互为近邻样本中的另一样本作为该样本的全部连接样本。
步骤212、基于距离均值对全部连接样本进行过滤,以滤除第二样本距离大于距离均值的连接样本,第二样本距离为样本与样本的连接样本之间的距离。
在一实施方式中,实施例中将样本与其对应的连接样本之间的距离记为第二样本距离, 即将互为近邻样本间的距离记为第二样本距离。在一实施方式中,若第二样本距离大于距离均值,则说明对应的两个样本虽然为互为近邻样本,但是其具体的特征差异较大,若聚类在一起会影响聚类结果的准确性。因此,实施例中设定剔除两个样本的连接关系,即将两个样本确定为非互为近邻样本。此时,可以在样本集中删除两个样本间的连线。同时,将邻接矩阵中对应的元素调整为零元素。可以理解的是,按照上述方式便可以过滤每个样本对应的连接样本,且仅保留小于距离均值的连接样本。此时,该步骤也可以理解为基于扫描半径对样本集中各样本的连接关系进行扫描,以得到准确的连接关系。
步骤213、基于S值和过滤后得到的连接样本对样本集中的样本进行聚类。
在一实施方式中,该步骤包括步骤2131-步骤2139:
步骤2131、依次统计每个样本的连接样本总数量。
在一实施方式中,根据样本集中各样本间的连线,确定每个样本的连线总数量,进而得到连接样本总数量。一般而言,每个样本对应的连接样本总数量为基于距离均值过滤后保留的连接样本的总数量。可以理解的是,实际应用中,也可以仅记录互为相邻样本间的连接关系,而不在样本集中体现。此时,可以根据记录的连接关系确定每个样本的连接样本,进而得到连接样本总数量。
步骤2132、将连接样本总数量大于S值的样本作为核心样本。
在一实施方式中,将每个样本的连接样本总数量与S值进行比较,若连接样本总数量大于S值,则将对应样本记为核心样本。按照上述方式,遍历每个样本后,便可以得到样本集中的全部核心样本。其中,核心样本可以理解为聚类过程中,可以作为起始点的样本。通常,每个样本及其连接样本因为特征相似度较高,通常会被聚类为一簇,若某个样本的总数量小于S值,则说明后续聚类得到的簇中存在样本数量低于聚类最小包含样本数的可能,因此,在聚类时,不会选择该样本作为起始点,即不会选择该样本作为核心样本。
步骤2133、在得到的全部核心样本中,选择任一核心样本作为当前样本。
在一实施方式中,任选一个核心样本作为本次聚类的起始点,并记为当前样本。需要说明的是,实施例中,以随机方式确定当前样本。实际应用中,还可以设定当前样本选择规则,并通过该规则选择当前样本。通常,确定当前样本后,将该核心样本标记为被访问过。
步骤2134、访问当前样本的全部连接样本。
在一实施方式中,根据当前保留的连接关系,获取与当前样本具有连接关系的全部连接样本,并将获取的全部连接样本标记为被访问过。
步骤2135、将访问得到的每个连接样本分别作为顶点,并访问顶点对应的全部连接样本。
在一实施方式中,将当前得到的每个连接样本分别作为一个顶点,之后,根据当前保留的连接关系,继续获取与每个顶点具有连接关系的全部连接样本。此时,每个顶点也可以认为一次聚类中的子起始点。
步骤2136、确认是否访问得到新的连接样本。若访问得到新的连接样本,则返回执行步骤2135,若访问不到新的连接样本,则执行步骤2137。
在一实施方式中,根据当前保留的连接关系,继续获取与每个顶点具有连接关系的全部连接样本时,确定是否得到新的连接样本,即是否得到没有标记为被访问过的连接样本。若得到新的连接样本,则说明当前还有新的特征相似的样本,此时,可以返回执行步骤2135,即将新得到的连接样本作为顶点,继续访问该顶点的全部连接样本,直到得不到新的连接样本为止。若得不到新的连接样本,则说明当前已经找到基于核心样本的全部特征相似的样本。此时,可以认为本次聚类结束,并执行2137。
需要说明的是,在本次聚类过程中,若某个核心样本被认为是连接样本,则将该核心样本标记为被访问过的样本。
步骤2137、确认是否还存在未被访问的核心样本。若存在,则执行步骤2138,否则,执行2139。
在一实施方式中,确定当前是否还有未被访问的核心样本,即确定当前是否还有未被标记为被访问过的核心样本。若存在未被访问的核心样本,则将该核心样本更新为当前样本,并开始新一次的聚类过程,即执行步骤2138。若确认核心样本均被访问过,则说明当前已经访问了全部可被聚类的起始点,无法再找到聚类起始点,因此,执行步骤2139。
步骤2138、将未被访问过的任一核心样本更新为当前样本。返回执行步骤2134。
在一实施方式中,若未被访问过的核心样本数量大于1,则采用随机的方式选定当前样本。若未被访问过的核心样本数量为1,则将该核心样本作为当前样本。之后,返回执行步骤2134,即开始一次新的聚类。
步骤2139、将当前样本及基于当前样本访问得到的连接样本聚类为簇。
在一实施方式中,一次聚类过程可以认为是一个访问过程,此时,设定将每次聚类得到的全部连接样本和当前样本聚类为一簇。通常,对于样本集而言,存在几次聚类过程便可以得到相应数量的簇。例如,将始终未被访问过的样本记为噪声点。
举例而言,针对于图3的样本集而言,样本B的K(K=5)近邻样本集合中包含样本A,样本A的K近邻样本集合中包含样本B,此时,样本A和样本B间的连接关系会被踢出,即删除样本A和样本B间虚线。在后续聚类过程中,无论访问样本A的连接样本还是访问样本B的连接样本,均不会将样本A和样本B聚类成簇,进而保证了聚类合理性。
上述,通过构建每个样本的K近邻图,基于K近邻图获取第一样本距离,其中,第一样本距离为样本与第S(S<K)近邻样本之间的距离,之后,基于第一样本距离构建频数分布直方图,并根据频数分布直方图确定距离均值,同时,基于K近邻图构建邻接矩阵,并对称邻接矩阵,以确定具有连接关系的样本,之后,通过距离均值对具有连接关系的样本进行过滤,并基于过滤后的连接关系以及S值对样本集进行聚类的技术手段,解决了相关技术中DBSCAN算法对于密度不均的样本集无法合理聚类的技术问题,通过对称邻接矩阵及基于距离均值过滤具有连接关系的样本的方式,可以在样本的分布密度不均时,避免不同密度的样本聚成一个簇,影响聚类准确性。同时,通过频数分布直方图确定距离均值,无需用户输入,减小了手动调参的工作量,并且通过统计的方式确定距离均值,保证了距离均值的合理性,进而保证聚类准确性。
实施例三
图9为本公开实施例三提供的一种样本聚类装置的结构示意图。参考图9,该样本聚类装置包括:距离统计模块301、距离获取模块302、均值计算模块303、连接确定模块304以及样本聚类模块305。
其中,距离统计模块301,用于统计样本集中每个样本对应的第一样本距离,所述第一样本距离为所述样本与所述样本的第S近邻样本之间的距离;距离获取模块302,用于在全部所述第一样本距离中,获取设定距离范围内的第一样本距离;均值计算模块303,用于基于所述设定距离范围内的第一样本距离计算距离均值;连接确定模块304,用于基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,所述样本与所述样本的连接样本为互为近邻样本且存在连接关系;样本聚类模块305,用于根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类,所述距离均值为扫描半径,所 述S值为聚类最小包含样本数。
上述,通过统计样本集中每个样本与其第S近邻样本之间的第一样本距离,并基于第一样本距离得到距离均值,同时,基于每个样本的K(K>S)近邻样本集合,确定每个样本对应的连接样本,该连接样本与样本之间为互为近邻样本且具有连接关系,之后,基于聚类最小包含样本数(S值)以及扫描半径(距离均值)对具有连接关系的样本进行聚类的技术手段,解决了相关技术中DBSCAN算法对于密度不均的样本集无法合理聚类的技术问题,通过第一样本距离确定合理的扫描半径,之后,基于扫描半径对互为近邻样本进行聚类,保证了聚类合理性,当样本集中的样本分布密度不均时,通过互为近邻样本可以避免将稀疏分布的样本与密集分布的样本聚类成簇,进而保证聚类准确性。
在上述实施例的基础上,样本聚类模块305包括:样本过滤子模块,用于基于所述距离均值对全部所述连接样本进行过滤,以滤除第二样本距离大于所述距离均值的连接样本,所述第二样本距离为样本与所述样本的连接样本之间的距离;聚类子模块,用于基于S值和过滤后得到的连接样本对所述样本集中的样本进行聚类。
在上述实施例的基础上,聚类子模块包括:总数量统计单元,用于依次统计每个样本的连接样本总数量;核心样本确定单元,用于将所述连接样本总数量大于S值的样本作为核心样本;当前样本选择单元,用于在得到的全部核心样本中,选择任一核心样本作为当前样本;第一访问单元,用于访问所述当前样本的全部连接样本;第二访问单元,用于将访问得到的每个连接样本分别作为顶点,并访问所述顶点对应的全部连接样本;第三访问单元,用于重复将访问得到的每个连接样本分别作为顶点,并访问所述顶点对应的全部连接样本的操作,直到访问不到新的连接样本为止;样本更新单元,用于将未被访问过的任一核心样本更新为当前样本,并返回执行访问所述当前样本的全部连接样本的操作,直到全部核心样本均被访问为止;簇聚类单元,用于将所述当前样本及基于当前样本访问得到的连接样本聚类为簇。
在上述实施例的基础上,连接确定模块304包括:集合获取子模块,用于获取每个样本对应的K近邻样本集合;邻接矩阵构建子模块,用于根据全部所述K近邻样本集合,构建邻接矩阵,所述邻接矩阵中每个元素代表对应两个样本间的近邻关系;非零元素统计子模块,用于统计所述邻接矩阵中非零元素,以确定每个样本的全部连接样本。
在上述实施例的基础上,非零元素统计子模块包括:元素组获取单元,用于在所述邻接矩阵中,获取处于对称位置的元素组,所述元素组包括第i行第j列的第一元素和第j行第i列的第二元素;置零单元,用于若所述第一元素和所述第二元素中包含至少一个零元素,则将所述第一元素和第二元素均设置为零元素;矩阵更新单元,用于遍历所述邻接矩阵的全部元素组后,更新所述邻接矩阵;近邻关系确定单元,用于统计更新后的邻接矩阵中非零元素,并将所述非零元素对应的两个样本确定为互为近邻样本且具有连接关系;连接样本确定单元,用于基于所述互为近邻样本,得到每个样本的全部连接样本。
在上述实施例的基础上,距离获取模块302包括:直方图构建子模块,用于基于全部所述第一样本距离,构建频数分布直方图;频数统计子模块,用于统计所述频数分布直方图中各bin的频数,以确定设定距离范围;第一距离获取子模块,用于获取设定距离范围内的第一样本距离。
在上述实施例的基础上,频数统计子模块包括:最大bin获取单元,用于获取所述频数分布直方图中频数最大bin;落差计算单元,用于计算相邻后位bin之间的频数落差,所述后位bin为所述频数分布直方图中位于频数最大bin后方的bin;bin确认单元,用于确认频数落差最大的相邻后位bin,并在所述最大的相邻后位bin中选择位于后方的bin;阈值确定单 元,用于将所述频数最大bin对应的第一样本距离和所述位于后方的bin对应的第一样本距离作为设定距离范围的距离阈值。
在上述实施例的基础上,均值计算模块303包括:样本数量获取子模块,用于获取所述第一样本距离处于所述设定距离范围内的样本数量;总距离子模块,用于对所述设定距离范围内每个第一样本距离进行相加,以得到样本总距离;商值计算子模块,用于将所述样本总距离与所述样本数量的商值作为距离均值。
在上述实施例的基础上,还包括:K近邻图构建模块,用于统计样本集中每个样本对应的第一样本距离之前,构建样本集中每个样本的K近邻图,所述K近邻图中每条边的权值为对应样本间的距离。
本公开实施例提供的样本聚类装置包含在样本聚类设备中,且可用于执行上述任意实施例提供的样本聚类方法,具备相应的功能和有益效果。
实施例四
图10为本公开实施例四提供的一种样本聚类设备的结构示意图。如图10所示,该样本聚类设备包括处理器40、存储器41、输入装置42以及输出装置43;样本聚类设备中处理器40的数量可以是一个或多个,图10中以一个处理器40为例;样本聚类设备中的处理器40、存储器41、输入装置42以及输出装置43可以通过总线或其他方式连接,图10中以通过总线连接为例。
存储器41作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序以及模块,如本公开实施例中的样本聚类方法对应的程序指令/模块(例如,样本聚类装置中的距离统计模块301、距离获取模块302、均值计算模块303、连接确定模块304和样本聚类模块305)。处理器40通过运行存储在存储器41中的软件程序、指令以及模块,从而执行样本聚类设备的各种功能应用以及数据处理,即实现上述的样本聚类方法。
存储器41可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据样本聚类设备的使用所创建的数据等。此外,存储器41可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器41可包括相对于处理器40远程设置的存储器,这些远程存储器可以通过网络连接至样本聚类设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置42可用于接收输入的数字或字符信息,以及产生与样本聚类设备的用户设置以及功能控制有关的键信号输入。输出装置43可包括显示屏等显示设备。
上述样本聚类设备包含样本聚类装置,可以用于执行任意样本聚类方法,具备相应的功能和有益效果。
实施例五
本公开实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种样本聚类方法,该方法包括:
统计样本集中每个样本对应的第一样本距离,所述第一样本距离为所述样本与所述样本的第S近邻样本之间的距离;
在全部所述第一样本距离中,获取设定距离范围内的第一样本距离;
基于所述设定距离范围内的第一样本距离计算距离均值;
基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,所述样本与所述样本的连接样本为互为近邻样本且存在连接关系;
根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类,所述距离均值为扫描半径,所述S值为聚类最小包含样本数。
当然,本公开实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的方法操作,还可以执行本公开任意实施例所提供的样本聚类方法中的相关操作。
通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本公开可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更合适的实施方式。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述的方法。
值得注意的是,上述样本聚类装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本公开的保护范围。
注意,上述仅为本公开的部分实施例及所运用技术原理。

Claims (12)

  1. 一种样本聚类方法,包括:
    统计样本集中每个样本对应的第一样本距离,所述第一样本距离为所述样本与所述样本的第S近邻样本之间的距离;
    在全部所述第一样本距离中,获取设定距离范围内的第一样本距离;
    基于所述设定距离范围内的第一样本距离计算距离均值;
    基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,所述样本与所述样本的连接样本为互为近邻样本且存在连接关系;
    根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类,所述距离均值为扫描半径,所述S值为聚类最小包含样本数。
  2. 根据权利要求1所述的样本聚类方法,其中,所述根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类包括:
    基于所述距离均值对全部所述连接样本进行过滤,以滤除第二样本距离大于所述距离均值的连接样本,所述第二样本距离为样本与所述样本的连接样本之间的距离;
    基于S值和过滤后得到的连接样本对所述样本集中的样本进行聚类。
  3. 根据权利要求2所述的样本聚类方法,其中,所述基于S值和过滤后得到的连接样本对所述样本集中的样本进行聚类包括:
    依次统计每个样本的连接样本总数量;
    将所述连接样本总数量大于S值的样本作为核心样本;
    在得到的全部核心样本中,选择任一核心样本作为当前样本;
    访问所述当前样本的全部连接样本;
    将访问得到的每个连接样本分别作为顶点,并访问所述顶点对应的全部连接样本;
    重复将访问得到的每个连接样本分别作为顶点,并访问所述顶点对应的全部连接样本的操作,直到访问不到新的连接样本为止;
    将未被访问过的任一核心样本更新为当前样本,并返回执行访问所述当前样本的全部连接样本的操作,直到全部核心样本均被访问为止;
    将所述当前样本及基于当前样本访问得到的连接样本聚类为簇。
  4. 根据权利要求1所述的样本聚类方法,其中,所述基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本包括:
    获取每个样本对应的K近邻样本集合;
    根据全部所述K近邻样本集合,构建邻接矩阵,所述邻接矩阵中每个元素代表对应两个样本间的近邻关系;
    统计所述邻接矩阵中非零元素,以确定每个样本的全部连接样本。
  5. 根据权利要求4所述的样本聚类方法,其中,所述统计所述邻接矩阵中非零元素,以确定每个样本的全部连接样本包括:
    在所述邻接矩阵中,获取处于对称位置的元素组,所述元素组包括第i行第j列的第一元素和第j行第i列的第二元素;
    若所述第一元素和所述第二元素中包含至少一个零元素,则将所述第一元素和第二元素均设置为零元素;
    遍历所述邻接矩阵的全部元素组后,更新所述邻接矩阵;
    统计更新后的邻接矩阵中非零元素,并将所述非零元素对应的两个样本确定为互为近邻样本且具有连接关系;
    基于所述互为近邻样本,得到每个样本的全部连接样本。
  6. 根据权利要求1所述的样本聚类方法,其中,所述在全部所述第一样本距离中,获取设定距离范围内的第一样本距离包括:
    基于全部所述第一样本距离,构建频数分布直方图;
    统计所述频数分布直方图中各bin的频数,以确定设定距离范围;
    获取设定距离范围内的第一样本距离。
  7. 根据权利要求6所述的样本聚类方法,其中,所述统计所述频数分布直方图中各bin的频数,以确定设定距离范围包括:
    获取所述频数分布直方图中频数最大bin;
    计算相邻后位bin之间的频数落差,所述后位bin为所述频数分布直方图中位于频数最大bin后方的bin;
    确认频数落差最大的相邻后位bin,并在所述最大的相邻后位bin中选择位于后方的bin;
    将所述频数最大bin对应的第一样本距离和所述位于后方的bin对应的第一样本距离作为设定距离范围的距离阈值。
  8. 根据权利要求1所述的样本聚类方法,其中,所述基于所述设定距离范围内的第一样本距离计算距离均值包括:
    获取所述第一样本距离处于所述设定距离范围内的样本数量;
    对所述设定距离范围内每个第一样本距离进行相加,以得到样本总距离;
    将所述样本总距离与所述样本数量的商值作为距离均值。
  9. 根据权利要求1所述的样本聚类方法,所述统计样本集中每个样本对应的第一样本距离之前,还包括:
    构建样本集中每个样本的K近邻图,所述K近邻图中每条边的权值为对应样本间的距离。
  10. 一种样本聚类装置,包括:
    距离统计模块,用于统计样本集中每个样本对应的第一样本距离,所述第一样本距离为所述样本与所述样本的第S近邻样本之间的距离;
    距离获取模块,用于在全部所述第一样本距离中,获取设定距离范围内的第一样本距离;
    均值计算模块,用于基于所述设定距离范围内的第一样本距离计算距离均值;
    连接确定模块,用于基于每个所述样本对应的K近邻样本集合,确定每个样本的全部连接样本,其中,K>S,所述样本与所述样本的连接样本为互为近邻样本且存在连接关系;
    样本聚类模块,用于根据所述连接样本、所述距离均值和S值对所述样本集中的样本进行聚类,所述距离均值为扫描半径,所述S值为聚类最小包含样本数。
  11. 一种样本聚类设备,包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-9中任一所述的样本聚类方法。
  12. 一种计算机可读存储介质,其上存储有计算机程序,其中,该程序被处理器执行时实现如权利要求1-9中任一所述的样本聚类方法。
PCT/CN2019/126716 2019-06-24 2019-12-19 样本聚类方法、装置、设备及存储介质 Ceased WO2020258772A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910551643.8 2019-06-24
CN201910551643.8A CN110276401A (zh) 2019-06-24 2019-06-24 样本聚类方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020258772A1 true WO2020258772A1 (zh) 2020-12-30

Family

ID=67961664

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/126716 Ceased WO2020258772A1 (zh) 2019-06-24 2019-12-19 样本聚类方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN110276401A (zh)
WO (1) WO2020258772A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114298201A (zh) * 2021-12-23 2022-04-08 电子科技大学(深圳)高等研究院 基于多距离谱嵌入融合的单细胞甲基化数据聚类方法
CN114722940A (zh) * 2022-04-07 2022-07-08 北京邮电大学 一种基于近邻样本对构造的智能电表故障分类方法
CN116383377A (zh) * 2023-02-08 2023-07-04 广东外语外贸大学 情感知识增强的方面级情感分析方法、系统、装置和介质
CN118312656A (zh) * 2024-06-07 2024-07-09 常熟理工学院 基于机器学习的审批工作流数据智能筛查方法与系统

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110276401A (zh) * 2019-06-24 2019-09-24 广州视源电子科技股份有限公司 样本聚类方法、装置、设备及存储介质
CN111366160B (zh) * 2020-05-25 2020-10-27 深圳市城市交通规划设计研究中心股份有限公司 路径规划方法、路径规划装置及终端设备
CN113239964B (zh) * 2021-04-13 2024-03-01 联合汽车电子有限公司 车辆数据的处理方法、装置、设备和存储介质
CN113239963B (zh) * 2021-04-13 2024-03-01 联合汽车电子有限公司 车辆数据的处理方法、装置、设备、车辆和存储介质
CN114093521B (zh) * 2022-01-20 2022-04-12 广东工业大学 基于随机森林的均匀化样本重构血糖估计方法及系统
CN115063622B (zh) * 2022-07-01 2026-01-09 上海商汤智能科技有限公司 聚类方法、装置及计算机可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110055212A1 (en) * 2009-09-01 2011-03-03 Cheng-Fa Tsai Density-based data clustering method
CN103902655A (zh) * 2014-02-28 2014-07-02 小米科技有限责任公司 聚类方法、装置及终端设备
CN105930856A (zh) * 2016-03-23 2016-09-07 深圳市颐通科技有限公司 基于改进dbscan-smote算法的分类方法
CN108776806A (zh) * 2018-05-08 2018-11-09 河海大学 基于变分自编码器和密度峰值的混合属性数据聚类方法
CN110276401A (zh) * 2019-06-24 2019-09-24 广州视源电子科技股份有限公司 样本聚类方法、装置、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110055212A1 (en) * 2009-09-01 2011-03-03 Cheng-Fa Tsai Density-based data clustering method
CN103902655A (zh) * 2014-02-28 2014-07-02 小米科技有限责任公司 聚类方法、装置及终端设备
CN105930856A (zh) * 2016-03-23 2016-09-07 深圳市颐通科技有限公司 基于改进dbscan-smote算法的分类方法
CN108776806A (zh) * 2018-05-08 2018-11-09 河海大学 基于变分自编码器和密度峰值的混合属性数据聚类方法
CN110276401A (zh) * 2019-06-24 2019-09-24 广州视源电子科技股份有限公司 样本聚类方法、装置、设备及存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114298201A (zh) * 2021-12-23 2022-04-08 电子科技大学(深圳)高等研究院 基于多距离谱嵌入融合的单细胞甲基化数据聚类方法
CN114722940A (zh) * 2022-04-07 2022-07-08 北京邮电大学 一种基于近邻样本对构造的智能电表故障分类方法
CN116383377A (zh) * 2023-02-08 2023-07-04 广东外语外贸大学 情感知识增强的方面级情感分析方法、系统、装置和介质
CN118312656A (zh) * 2024-06-07 2024-07-09 常熟理工学院 基于机器学习的审批工作流数据智能筛查方法与系统

Also Published As

Publication number Publication date
CN110276401A (zh) 2019-09-24

Similar Documents

Publication Publication Date Title
WO2020258772A1 (zh) 样本聚类方法、装置、设备及存储介质
CN111950543B (zh) 一种目标检测方法和装置
CN112669463B (zh) 三维点云的曲面重建方法、计算机设备和计算机可读存储介质
Tao et al. Approximate MaxRS in spatial databases
CN113722415B (zh) 点云数据的处理方法、装置、电子设备及存储介质
US11250250B2 (en) Pedestrian retrieval method and apparatus
Papadakis et al. Progressive, holistic geospatial interlinking
CN111553215A (zh) 人员关联方法及其装置、图卷积网络训练方法及其装置
CN113722314B (zh) 一种空间连接查询方法、装置、电子设备及存储介质
CN106796589A (zh) 空间数据对象的索引方法和系统
CN110298687B (zh) 一种区域吸引力评估方法及设备
US20140370920A1 (en) Systems and methods for generating and employing an index associating geographic locations with geographic objects
CN112115382B (zh) 数据处理方法及装置、存储介质、电子装置
CN112419342B (zh) 图像处理方法、装置、电子设备和计算机可读介质
US20260010548A1 (en) Data management method and computing device
CN114511679A (zh) 点云数据处理方法、装置、设备及存储介质
CN114610825A (zh) 关联网格集的确认方法、装置、电子设备及存储介质
CN111210500B (zh) 一种三维点云处理方法及装置
CN106503245A (zh) 一种支撑点集合的选择方法及装置
CN110110736A (zh) 增量聚类方法和装置
CN110209853A (zh) 车辆的图片搜索方法、装置和设备
CN115080590A (zh) 数据查询方法、设备及存储介质
CN114299043B (zh) 点云质量评估方法、装置、电子设备和存储介质
CN117290594A (zh) 金融业务活动推荐方法、装置、计算机设备和存储介质
CN111382760A (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: 19934511

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: 19934511

Country of ref document: EP

Kind code of ref document: A1