Data clustering method, apparatus, and processor and electronic device

By selecting consecutively arranged data sample combinations to determine the centroid, the problem of low data clustering accuracy caused by uneven centroid distribution is solved, and the uniformity of centroid points and the accuracy of clustering algorithms are improved.

CN116610966BActive Publication Date: 2025-12-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310653827.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-02
Publication Date
2025-12-09
Estimated Expiration
2043-06-02

AI Technical Summary

Technical Problem

The accuracy of data clustering in existing technologies is relatively low, mainly due to the uneven distribution of centroids, which leads to poor clustering results.

Method used

By obtaining an ordered set of data samples, determining the combination of continuously arranged samples, filtering them to obtain the central samples as centroids, and clustering based on these centroids, the centroids are filtered using a window truncation method to ensure the uniformity of the centroids.

Benefits of technology

It improves the accuracy and precision of data clustering, ensures the uniformity of centroid selection, and enhances the accuracy of the clustering algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116610966B_ABST
    Figure CN116610966B_ABST
Patent Text Reader

Abstract

The application discloses a data clustering method and device, a processor and an electronic device. Relates to the field of big data, the method comprises: obtaining a data sample set, wherein the data sample set comprises N data samples arranged in order, N is a positive integer; determining K sample combinations from the N data samples, wherein each sample combination comprises M data samples arranged continuously, K is a positive integer, and M is a positive integer less than N; performing screening processing on each sample combination to obtain K screened sample combinations; obtaining a center sample of each screened sample combination, and determining the center sample as a centroid of the screened sample combination to obtain K centroids; and clustering the data sample set based on the K centroids. Through the application, the problem of low accuracy of data clustering in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of big data, and in particular, to a data clustering method and device, a processor and an electronic device. BACKGROUND

[0002] In the initialization stage, the clustering algorithm needs to determine the cluster center, i.e., the centroid. In the prior art, a random extraction method is often used to determine a preset number of centroids. However, this method has the problem that the extracted centroids are too scattered or concentrated, which leads to uneven distribution of the centroids, and thus causes low accuracy of subsequent data clustering.

[0003] Currently, there is no effective solution to the problem of low accuracy of data clustering in the related art. SUMMARY

[0004] The main purpose of the present application is to provide a data clustering method, device, processor and electronic device to solve the problem of low accuracy of data clustering in the related art.

[0005] To achieve the above purpose, according to one aspect of the present application, a data clustering method is provided. The method comprises: obtaining a data sample set, wherein the data sample set comprises N ordered data samples, N is a positive integer; determining K groups of sample combinations from the N data samples, wherein each group of sample combinations comprises M continuously arranged data samples, K is a positive integer, and M is a positive integer less than N; performing screening processing on each group of sample combinations to obtain K groups of screened sample combinations; obtaining a center sample of each group of screened sample combinations, and determining the center sample as a centroid of the screened sample combination to obtain K centroids; and clustering the data sample set based on the K centroids.

[0006] As an optional solution, the screening processing on each group of sample combinations to obtain K groups of screened sample combinations comprises: obtaining a first data sample with the maximum density in the i-th group of sample combinations, wherein i is a positive integer less than K; sequentially traversing all data samples included in the i-th group of sample combinations to obtain a target data sample that meets a preset distance condition, wherein the screened sample combination corresponding to the i-th group of sample combinations includes the target data sample, and the preset distance condition is used to indicate that the cosine distance between the target data sample and the first data sample is less than a preset cosine distance threshold.

[0007] As an optional solution, the first data sample with the maximum sample density in the ith sample combination is obtained by: obtaining the sample density of each data sample in the ith sample combination, and determining the first data sample with the maximum sample density from the ith sample combination; wherein the sample density of the current data sample in the ith sample combination is obtained by: obtaining P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples are closest to the current data sample in the ith sample combination, and the ith sample combination includes the P first neighbor data samples; obtaining P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples are closest to the first neighbor data sample in the ith sample combination, and the ith sample combination includes the P second neighbor data samples; performing a union operation on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample; obtaining the number and value of the neighbor data samples in the target neighbor data sample set, and obtaining the cumulative sum of the cosine distance between each neighbor data sample in the target neighbor data sample set and the current data sample; and determining the quotient of the number and value and the cumulative sum as the sample density of the current data sample.

[0008] As an optional solution, the K sample combinations are determined from the N data samples by: obtaining a window center associated with the jth sample combination, wherein the window center is used to indicate the (2j-1)*N / 2a data sample in the N data samples; and determining the M data samples from the (2j-1)*N / 2a data sample to the (2j-1)*N / 2a+M-1 data sample in the N data samples as the jth sample combination.

[0009] As an optional solution, the center sample of each of the filtered sample combinations is obtained, and the center sample is determined as the centroid of the filtered sample combination by: selecting one data sample from the filtered sample combination as an initial centroid neighbor point; determining at least one target data sample that satisfies a preset similarity condition from other data samples of the filtered sample combination, wherein the preset similarity condition is used to indicate that the cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold; and determining the center of the at least one target data sample as the center sample.

[0010] As an optional solution, the obtaining the data sample set comprises: obtaining an initial data sample set to be sorted, wherein the initial data sample set comprises N initial data samples arranged in disorder; sequentially traversing the N initial data samples, obtaining a sample density of each initial data sample, and determining an initial data sample with the smallest sample density as an edge data sample; and sorting other initial data samples according to cosine distances between the other initial data samples and the edge data sample, and determining a sorted initial data sample set as the data sample set, wherein the edge data sample is located at an edge position, and the farther the data sample with the greater cosine distance from the edge data sample is from the edge position, the closer the data sample is to a central position.

[0011] As an optional solution, the obtaining the initial data sample set to be sorted comprises: obtaining the initial sample set from a historical consumption log set, wherein the historical consumption log set comprises consumption log data generated in a use process of an account associated with a client in a historical time period; and after obtaining the clustered target sample set, the method further comprises: classifying a consumption risk level associated with the account by using a data clustering result.

[0012] To achieve the above object, according to another aspect of the present application, a data clustering device is provided. The device comprises: a first obtaining unit configured to obtain a data sample set, wherein the data sample set comprises N data samples arranged in order, and N is a positive integer; a determining unit configured to determine K sample combinations from the N data samples, wherein each sample combination comprises M data samples arranged in succession, K is a positive integer, and M is a positive integer smaller than N; a screening unit configured to perform screening processing on each sample combination to obtain K screened sample combinations; a second obtaining unit configured to obtain a center sample of each screened sample combination, and determine the center sample as a centroid of the screened sample combination to obtain K centroids; and a clustering unit configured to cluster the data sample set based on the K centroids.

[0013] As an optional solution, the screening unit comprises: a first obtaining module configured to obtain a first data sample with the maximum density in an i-th sample combination, wherein i is a positive integer smaller than K; and a first traversing module configured to sequentially traverse all data samples included in the i-th sample combination to obtain a target data sample meeting a preset distance condition, wherein the screened sample combination corresponding to the i-th sample combination comprises the target data sample, and the preset distance condition is used to indicate that a cosine distance between the target data sample and the first data sample is smaller than a preset cosine distance threshold.

[0014] As an optional solution, the obtaining module comprises: a first obtaining submodule, configured to obtain sample densities of each data sample included in the ith sample combination, and determine the first data sample with the maximum sample density; wherein the obtaining of the sample density of the current data sample in the ith sample combination comprises: a second obtaining submodule, configured to obtain P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples are closest to the current data sample in terms of cosine distance in the ith sample combination, and the ith sample combination comprises the P first neighbor data samples; a third obtaining submodule, configured to obtain P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples are closest to the first neighbor data sample in terms of cosine distance in the ith sample combination, and the ith sample combination comprises the P second neighbor data samples; a fourth obtaining submodule, configured to perform a set union operation on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample; a fifth obtaining submodule, configured to obtain a number and a value of neighbor data samples included in the target neighbor data sample set, and obtain an accumulated sum value of cosine distances between each neighbor data sample included in the target neighbor data sample set and the current data sample; and a determining submodule, configured to determine a quotient of the number and the value and the accumulated sum value as the sample density of the current data sample.

[0015] As an optional solution, the determining unit comprises: a second obtaining module, configured to obtain a window center associated with the jth sample combination, wherein the window center is used to indicate the (2j-1)*N / 2a data sample in the N data samples; and a first determining module, configured to determine M data samples from the (2j-1)*N / 2a data sample to the (2j-1)*N / 2a+M-1 data sample in the N data samples as the jth sample combination.

[0016] As an optional solution, the second obtaining module comprises: a third obtaining module, configured to select one data sample from the screened sample combination as an initial centroid neighbor point; a second determining module, configured to determine at least one target data sample satisfying a preset similarity condition from other data samples of the screened sample combination, wherein the preset similarity condition is used to indicate that a cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold; and a third determining module, configured to determine a center of the at least one target data sample as the center sample.

[0017] As an optional solution, the first obtaining unit comprises: a fourth obtaining module, configured to obtain an initial data sample set to be sorted, wherein the initial data sample set comprises N initial data samples arranged in disorder; a second traversing module, configured to traverse the N initial data samples one by one, obtain the sample density of each initial data sample, and determine the initial data sample with the smallest sample density as an edge data sample; and a sorting module, configured to sort other initial data samples according to the cosine distance between the other initial data samples and the edge data sample, and determine the initial data sample set after sorting as the data sample set, wherein the edge data sample is located at an edge position, and the data sample with the greater cosine distance from the edge data sample is farther away from the edge position and closer to the central position.

[0018] As an optional solution, the fourth obtaining module comprises: a sixth obtaining sub-module, configured to obtain the initial sample set from a historical consumption log set, wherein the historical consumption log set comprises consumption log data generated in the use process of the account associated with the client in a historical time period; and the apparatus further comprises a classification module, configured to, after obtaining the target sample set after clustering, classify the consumption risk level of the account associated with the account by using the data clustering result.

[0019] According to the application, the following steps are adopted: obtaining a data sample set, wherein the data sample set comprises N data samples arranged in order, N being a positive integer; determining K sample combinations from the N data samples, wherein each sample combination comprises M data samples arranged in succession, K being a positive integer and M being a positive integer smaller than N; performing screening processing on each sample combination to obtain K screened sample combinations; obtaining a center sample of each screened sample combination and determining the center sample as the centroid of the screened sample combination to obtain K centroids; and clustering the data sample set based on the K centroids. According to the application, based on the data sample set after preliminary sorting, a plurality of windows are obtained by screening (window interception) of locally continuous samples, and a center sample of each window is obtained to determine the centroid used for subsequent clustering, wherein based on the continuous arrangement, window interception and determination of the center sample, the new centroid point and the initial centroid point have a relatively uniform relationship, which guarantees the uniformity of the centroid point selection, thereby achieving the technical effect of improving the accuracy of subsequent clustering based on the centroid. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and are used to interpret the illustrative embodiments of the present application and their descriptions, and shall not constitute improper limitation to the present application. In the drawings:

[0021] Figure 1 is a flow chart of a data clustering method according to an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a data clustering method according to an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of a data clustering method according to an embodiment of the present application;

[0024] Figure 4 is a schematic diagram of a data clustering method according to an embodiment of the present application;

[0025] Figure 5 is a schematic diagram of a data clustering apparatus according to an embodiment of the present application;

[0026] Figure 6 is a schematic diagram of a data clustering electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] It should be noted that the embodiments and features of the embodiments in the present application can be combined with each other without conflict. The technical solutions in the embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should be within the scope of protection of the present application.

[0028] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should be within the scope of protection of the present application.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0030] It should be noted that the related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties. For example, an interface is provided between the system and the related user or institution. Before obtaining the related information, the interface needs to send a request to the aforementioned user or institution, and after receiving the consent information feedback from the aforementioned user or institution, the related information is obtained.

[0031] The application will be described below in conjunction with preferred implementation steps, Figure 1 is a flowchart of the data clustering method provided by the embodiment of the present application, as shown in the figure, the method comprises the following steps: Figure 1

[0032] Step S101, obtaining a data sample set, wherein the data sample set comprises N ordered data samples, and N is a positive integer;

[0033] Step S102, determining K sample combinations from the N data samples, wherein each sample combination comprises M continuously arranged data samples, K is a positive integer, and M is a positive integer less than N;

[0034] Step S103, performing screening processing on each sample combination to obtain K screened sample combinations;

[0035] Step S104, obtaining the center sample of each screened sample combination, and determining the center sample as the centroid of the screened sample combination to obtain K centroids;

[0036] Step S105, clustering the data sample set based on the K centroids.

[0037] Optionally, in the present embodiment, the above-mentioned data clustering method can be applied in the customer group risk identification scene, but is not limited thereto. In this scene, after obtaining the input log data indicating the recent consumption of the customer group, based on the above-mentioned data clustering method, the centroid can be reasonably dispersed and selected based on the window interception distance method, and the subsequent clustering calculation result based on the selected centroid can be used to evaluate the customer risk and generate the customer type according to the clustering analysis, and the service provider can be provided with relevant reasonable suggestions, thereby achieving the purpose of accurate risk identification and grade classification for customers, thereby effectively avoiding the risk of providing related business services for customers by the service provider, and improving the risk management ability of the service provider.

[0038] ​And, by using the above data clustering method, based on the preliminary ordered data sample set, a plurality of windows are obtained by filtering (window cutting) of locally continuous samples, and the center sample of each window is obtained to determine the subsequent centroid for clustering, wherein based on the continuous arrangement and window cutting and the determination method of the center sample, the new centroid point obtained is in a "relative uniform relationship" with the initial centroid point, which guarantees the uniformity of the selection of the centroid point, thereby achieving the technical effect of improving the accuracy of subsequent clustering based on the centroid algorithm.

[0039] Optionally, in the embodiment, the data sample set can but is not limited to include N ordered data samples, which can but is not limited to be obtained by sorting the initial data sample set to be sorted, wherein the sorting process can but is not limited to be used to determine the edge data sample with the maximum sample density from the initial data samples, and then sort other initial data samples based on the cosine distance between the other initial data samples and the edge data sample. The greater the cosine distance between the other initial data samples and the edge data sample, the farther the other initial data samples are from the edge position of the edge data sample, and the closer the other initial data samples are to the center position.

[0040] Optionally, in the embodiment, each of the K sample combinations can but is not limited to include M continuously arranged data samples.

[0041] Optionally, in the embodiment, each sample combination can but is not limited to be a window, wherein the first data sample included in the window has the farthest cosine distance from the edge data sample, the last data sample included in the window has the closest cosine distance from the edge data sample, and each data sample included in the window is continuously arranged in the data sample set.

[0042] Optionally, in the embodiment, each of the K sample combinations is filtered to obtain K filtered sample combinations corresponding to the sample combinations, wherein the filtering process can but is not limited to be used to remove data samples in each sample combination that do not meet a preset distance condition, and the preset distance condition is used to indicate that the cosine distance between the data sample and the first data sample with the maximum sample density is less than a preset cosine distance threshold, and the sample density is used to indicate the quotient of the total number of neighboring samples of the data sample and the cumulative sum of the cosine distances between all neighboring samples and the data sample.

[0043] Optionally, in this embodiment, obtaining the center sample of each group of filtered sample combinations may, but is not limited to, selecting a data sample from the filtered sample combinations as the initial centroid nearest neighbor; determining at least one target data sample that satisfies a preset similarity condition from other data samples of the filtered sample combinations, wherein the preset similarity condition is used to indicate that the cosine similarity between at least one target data sample and the initial centroid nearest neighbor is greater than a preset similarity threshold; and determining the center of at least one target data sample as the center sample.

[0044] It should be noted that the initial centroid nearest neighbor can be, but is not limited to, randomly selected, and the center of at least one target data sample can be, but is not limited to, the data sample that has the smallest sum of cosine distances among at least one target data sample and other data samples (referring to other data samples among at least one target data sample besides the current data sample).

[0045] It should be noted that after obtaining the centroid of each filtered sample combination, the centroid is determined as the centroid of the filtered sample combination. K centroids are accumulated, and the data sample set is clustered based on the K centroids.

[0046] To further illustrate, such as Figure 2 As shown (where white spheres represent sample points and black spheres represent centroids), an optional data clustering method includes:

[0047] Step S1: Obtain a data sample set that includes multiple data samples arranged in an ordered manner, such as... Figure 2 As shown in (a), the rightmost (edge) white ball is used to indicate edge data samples, and the edge data samples are the data samples with the lowest sample density among multiple data samples. The other data samples are arranged in ascending order from right to left according to the cosine distance from the edge data samples. The data samples arranged further to the left have a larger cosine distance from the edge data samples.

[0048] Step S2: From the sorted data sample set, three sample combinations are selected. Each sample combination includes four consecutively arranged data samples, forming three windows, such as... Figure 2 As shown in (b) in the figure, each data sample may, but is not limited to, exist within one or more window / sample combinations.

[0049] Step S3: Filter each sample combination and remove data samples that do not meet the preset conditions. The preset conditions may include, but are not limited to, the cosine distance between the data sample and the first data sample with the highest sample density in the sample combination being greater than a preset cosine distance threshold.

[0050] It should be noted that the above preset condition can further increase other additional sub-conditions according to actual needs, such as whether the data amount of the data sample meets the standard, and the embodiment does not make additional limitations.

[0051] It should also be noted that, as shown in (c) of Figure 2 In (c) and (d) of

[0052] Step S4, obtaining the center sample of each screened sample combination, and determining the center sample as the centroid of the screened sample combination, obtaining three centroids, as shown in (c) and (d) of Figure 2 The three black balls in (c) and (d) are the centroids of the screened sample combinations.

[0053] Step S5, clustering the data sample set based on the three centroids.

[0054] Through the embodiments provided in the present application, a data sample set is obtained, wherein the data sample set includes N ordered data samples, N is a positive integer; K sample combinations are determined from the N data samples, each sample combination includes M continuously arranged data samples, K is a positive integer, and M is a positive integer less than N; each sample combination is screened to obtain K screened sample combinations; the center sample of each screened sample combination is obtained, and the center sample is determined as the centroid of the screened sample combination, obtaining K centroids; and the data sample set is clustered based on the K centroids. Based on the preliminary ordered data sample set, the present application obtains multiple windows through the screening (window cutting) of local continuous samples, and obtains the center sample of each window to determine the centroid used for subsequent clustering, wherein based on the continuous arrangement, window cutting, and determination of the center sample, the new centroid point and the initial centroid point have a "relative uniform relationship", which guarantees the uniformity of the centroid point selection, thereby achieving the technical effect of improving the accuracy of the subsequent clustering algorithm based on the centroid.

[0055] As an optional solution, the screening of each sample combination to obtain K screened sample combinations includes:

[0056] S1, obtaining a first data sample with the maximum sample density in the i th sample combination, wherein i is a positive integer less than K;

[0057] S2, sequentially traversing all data samples included in the i-th sample combination, to obtain a target data sample meeting a preset distance condition, wherein the filtered sample combination corresponding to the i-th sample combination includes the target data sample, and the preset distance condition is used to indicate that a cosine distance between the target data sample and the first data sample is less than a preset cosine distance threshold.

[0058] Optionally, in the embodiment, a first data sample with maximum sample density in each sample combination is obtained, and a data sample in each sample combination with a cosine distance less than a preset cosine distance threshold from the corresponding first data sample is determined as a filtered sample combination of each sample combination, wherein the sample density is used to indicate a quotient of a total number of neighbor samples of a data sample and a cumulative sum of cosine distances between all neighbor samples and the data sample.

[0059] Optionally, in the embodiment, the calculation of the sample density of the data sample X can include but is not limited to the following:

[0060] The sample density of the data sample X = (the total number of second-order Kn neighbor samples of the data sample X) / the cumulative sum of cosine distances between all second-order Kn neighbor samples and the data sample X.

[0061] Wherein, the second-order Kn neighbor samples of the data sample X are: a set of Kn neighbor samples closest (in terms of cosine distance) to the data sample X is N1, a set of Kn neighbor samples closest to each data sample in N1 is N2, and a union set of N1 and N2 is N_total, and the samples in N_total are the second-order Kn neighbor samples of the data sample X, and the number of samples in N_total is the total number of second-order Kn neighbor samples of the data sample X.

[0062] According to the embodiments provided in the application, a first data sample with maximum sample density in the i-th sample combination is obtained, wherein i is a positive integer less than K; all data samples included in the i-th sample combination are sequentially traversed, to obtain a target data sample meeting a preset distance condition, wherein the filtered sample combination corresponding to the i-th sample combination includes the target data sample, and the preset distance condition is used to indicate that a cosine distance between the target data sample and the first data sample is less than a preset cosine distance threshold.

[0063] As an optional solution, obtaining the first data sample with maximum sample density in the i-th sample combination includes:

[0064] S1, obtaining sample densities of each data sample included in the i-th sample combination, and determining a first data sample with maximum sample density from the sample densities;

[0065] Wherein, obtaining the sample density of the current data sample of the i-th sample combination includes:

[0066] S2, obtaining P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples are closest to the current data sample in terms of cosine distance in the ith sample combination, and the ith sample combination comprises the P first neighbor data samples;

[0067] S3, obtaining P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples are closest to the first neighbor data sample in terms of cosine distance in the ith sample combination, and the ith sample combination comprises the P second neighbor data samples;

[0068] S4, performing set union processing on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample;

[0069] S5, obtaining the number and value of the neighbor data samples included in the target neighbor data sample set, and obtaining the cumulative sum of the cosine distances between each neighbor data sample included in the target neighbor data sample set and the current data sample;

[0070] S6, determining the quotient of the number and value and the cumulative sum as the sample density of the current data sample.

[0071] Optionally, in the embodiment, the sample densities of the data samples in the current sample combination are obtained, the data sample with the largest sample density is determined as the first data sample of the current sample combination, and other data samples in the current sample combination that have a cosine distance from the first data sample greater than a preset cosine distance threshold are removed to obtain a screened sample combination.

[0072] Optionally, in the embodiment, the calculation method of the sample density of the data sample X can include but is not limited to:

[0073] The sample density of the data sample X=(the total number of second-order Kn neighbor samples of the data sample X) / the cumulative sum of the cosine distances between all second-order Kn neighbors and the data sample X.

[0074] Wherein, the second-order Kn neighbor samples of the data sample X are: the set of Kn nearest neighbor samples of the data sample X (cosine distance) is N1, the set of Kn nearest neighbor samples of each data sample in N1 is N2, the union set of N1 and N2 is N_total, and the samples in N_total are the second-order Kn neighbor samples of the data sample X. The number of samples in N_total is the total number of second-order Kn neighbor samples of the data sample X.

[0075] Further examples are as follows: Figure 3As shown, the two neighbor samples closest to data sample A1 in terms of cosine distance are data samples A2 and A3, and the set N1 corresponding to data sample A1 is {A2, A3}; further, the two neighbor samples closest to data sample A2 in terms of cosine distance are data samples A4 and A5, and the two neighbor samples closest to data sample A3 in terms of cosine distance are data samples A6 and A7, and the set N2 corresponding to data sample A1 is {A4, A5, A6, A7}, and the set N_total corresponding to data sample A1 is {A2, A3, A4, A5, A6, A7}; further, the total number of second-order Kn neighbor samples of data sample A1 is 6, and the cumulative sum of the cosine distances between all second-order Kn neighbor samples and data sample A1 is d21+d31+d41+d51+d61+d71, and the sample density of data sample A1 is 6 / (d21+d31+d41+d51+d61+d71).

[0076] According to the embodiments provided in the present application, the sample density of each data sample included in the ith sample combination is obtained, and the first data sample with the maximum sample density is determined; wherein the sample density of the current data sample of the ith sample combination is obtained by: obtaining P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples are closest to the current data sample in terms of cosine distance in the ith sample combination, and the ith sample combination includes the P first neighbor data samples; obtaining P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples are closest to the first neighbor data sample in terms of cosine distance in the ith sample combination, and the ith sample combination includes the P second neighbor data samples; performing set union processing on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample; obtaining the number and value of the neighbor data samples included in the target neighbor data sample set, and obtaining the cumulative sum of the cosine distances between each neighbor data sample included in the target neighbor data sample set and the current data sample; and determining the quotient of the number and value and the cumulative sum as the sample density of the current data sample.

[0077] As an optional solution, the K sample combinations are determined from the N data samples, including:

[0078] S1, obtaining a window center associated with the jth sample combination, wherein the window center is used to indicate the (2j-1)*N / 2a data sample in the N data samples;

[0079] S2, determining the M data samples from the (2j-1)*N / 2a data sample to the (2j-1)*N / 2a+M-1 data sample in the N data samples as the jth sample combination.

[0080] Optionally, in the embodiment, the window center can be, but is not limited to, used to indicate the first data sample in the sample combination (i.e., the window), i.e., the starting position of the sample combination / window.

[0081] Optionally, in the embodiment, each sample combination set can include, but is not limited to, M data samples, wherein the first data sample in the M data samples is the (2j-1)*N / 2a-th data sample in the N data samples, and the M-th data sample in the M data samples is the (2j-1)*N / 2a+M-1-th data sample in the N data samples.

[0082] According to the embodiment provided in the application, the window center associated with the j-th sample combination is obtained, wherein the window center is used to indicate the (2j-1)*N / 2a-th data sample in the N data samples; and the M data samples from the (2j-1)*N / 2a-th data sample to the (2j-1)*N / 2a+M-1-th data sample in the N data samples are determined as the j-th sample combination.

[0083] As an optional solution, obtaining the center sample of each filtered sample combination set and determining the center sample as the centroid of the filtered sample combination set includes:

[0084] S1, selecting one data sample from the filtered sample combination set as an initial centroid neighbor point;

[0085] S2, determining at least one target data sample from other data samples of the filtered sample combination set that satisfies a preset similarity condition, wherein the preset similarity condition is used to indicate that the cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold;

[0086] S3, determining the center of the at least one target data sample as the center sample.

[0087] Optionally, in the embodiment, the initial centroid neighbor point can be, but is not limited to, randomly selected, and the center of the at least one target data sample can be, but is not limited to, used to indicate the data sample in the at least one target data sample that has the minimum sum of cosine distances with other data samples (i.e., data samples other than the current data sample in the at least one target data sample).

[0088] For further illustration, a data sample L1 is randomly selected from the filtered set Dg as an initial centroid neighbor point, and a data sample Li is determined from the set Dg, and the center of the data sample Li is determined as the center sample, i.e., the centroid, wherein cos(Xi, X1)≥T2, Xi is the vector information corresponding to the data sample Li, X1 is the vector information corresponding to the data sample L1, and T2 is a preset cosine similarity threshold, which is used to indicate the preset similarity threshold.

[0089] It should be noted that after the center sample of each screened sample combination is obtained, the center sample is determined as the centroid of the screened sample combination, K centroids are accumulated, and the data sample set is clustered based on the K centroids.

[0090] Through the embodiments provided in the present application, one data sample is selected from the screened sample combination as an initial centroid neighbor point; at least one target data sample satisfying a preset similarity condition is determined from other data samples of the screened sample combination, wherein the preset similarity condition is used to indicate that the cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold; and the center of the at least one target data sample is determined as the center sample.

[0091] As an optional solution, the data sample set includes:

[0092] S1, obtaining an initial data sample set to be sorted, wherein the initial data sample set includes N initial data samples arranged in disorder;

[0093] S2, sequentially traversing the N initial data samples, obtaining the sample density of each initial data sample, and determining the initial data sample with the smallest sample density as an edge data sample;

[0094] S3, sorting other initial data samples according to the cosine distance between the other initial data samples and the edge data sample, and determining the sorted initial data sample set as the data sample set, wherein the edge data sample is located at an edge position, the data sample with the greater cosine distance from the edge data sample is farther away from the edge position and closer to the center position.

[0095] Optionally, in the present embodiment, the data sample set can but is not limited to include N data samples arranged in order, which can but is not limited to be obtained after the initial data sample set to be sorted is sorted, wherein the above sorting processing can but is not limited to indicate that the edge data sample with the maximum sample density is determined from the initial data samples, and then other initial data samples are sorted based on the cosine distance between the other initial data samples and the edge data sample. The greater the cosine distance from the edge data sample, the farther away from the edge position of the edge data sample, and the closer to the center position.

[0096] By the embodiments provided in the present application, an initial data sample set to be sorted is obtained, wherein the initial data sample set includes N initial data samples arranged in disorder; N initial data samples are sequentially traversed, sample density of each initial data sample is obtained, and an initial data sample with minimum sample density is determined as an edge data sample; other initial data samples are sorted according to cosine distances between the other initial data samples and the edge data sample, and the sorted initial data sample set is determined as a data sample set, wherein the edge data sample is located at an edge position, and the farther the position of a data sample with greater cosine distance from the edge data sample is from the edge position, the closer the position is to a central position.

[0097] As an optional solution, the initial data sample set to be sorted includes:

[0098] S1, obtaining an initial sample set from a historical consumption log set, wherein the historical consumption log set includes consumption log data generated in a use process of an account associated with a client in a historical time period;

[0099] After obtaining the clustered target sample set, the method further includes:

[0100] S2, classifying a consumption risk level associated with the account by using the data clustering result.

[0101] Optionally, in the present embodiment, the historical consumption log can be but is not limited to log data generated by a user in a use process of a client through an account, and can include but is not limited to different types of log data, wherein the different types can include but are not limited to normal consumption type and abnormal consumption type, wherein the normal / abnormal consumption type is used to indicate normal / abnormal consumption amount.

[0102] It should be noted that the customer risk is evaluated based on the subsequent clustering calculation result based on the selected centroid, the customer type generated by the clustering analysis is used to provide relevant reasonable suggestions for a service party, and the purpose of accurate risk identification and level classification for the customer is achieved, so that the risk of the service party in providing relevant business services for the customer is effectively avoided, and the risk management ability of the service party is improved.

[0103] By the embodiments provided in the present application, an initial sample set is obtained from a historical consumption log set, wherein the historical consumption log set includes consumption log data generated in a use process of an account associated with a client in a historical time period; S2, a consumption risk level associated with the account is classified by using a data clustering result.

[0104] As an optional solution, the above clustering method is applied to a scenario of initializing kmeans credit card customer classification based on density intercept distance, wherein the traditional kmeans clustering algorithm randomly extracts initial centroids in the initialization stage, which causes the extracted centroids to be too dispersed or concentrated, not particularly uniform, thereby slowing down the clustering convergence speed and making the clustering effect poor. Especially under massive text data, such defects will be highlighted more.

[0105] In view of the problems of the existing clustering method, such as slow convergence speed and poor clustering effect when performing K-means clustering on a large number of texts, the embodiment proposes a kmeans massive data clustering method based on density intercept distance initialization, which specifically includes:

[0106] In step S402, based on the input customer data sample, a data set dataset is obtained: the input customer data sample is recorded as the data set dataset;

[0107] In step S404, the density of each sample in the data set dataset is calculated: wherein the density calculation method of the sample X is as follows:

[0108] The density of the sample X=(the total number of second-order Kn neighbor samples of X) / the cumulative sum of the cosine distance of all second-order Kn neighbors and X

[0109] The second-order Kn neighbor of X is: the set N1 composed of the Kn nearest neighbor samples of the sample point X (cosine distance), the set N2 composed of the Kn nearest neighbor samples of each sample point in N1, and the union set N_total composed of N1 and N2, the samples in N_total are the second-order Kn neighbor samples of X, and the number of samples in N_total is the number of second-order Kn neighbor samples of X.

[0110] In step S406, the sample with the minimum density is recorded as the edge point Cb, the cosine distance between the edge point Cb and all samples in the data set dataset is calculated, and the samples in dataset are sorted in ascending order according to the calculation result to obtain the data set datalist;

[0111] In step S408, k samples are selected from the data set datalist to form a window center set windowlist according to Ai=(2i-1)n / 2k: the window center is set, and the setting method is: k samples are selected from the listdata according to Ai=(2i-1)n / 2k to form a window center set windowlist, wherein n is the total number of samples in listdata, k is the set cluster number, and Ai is the (2i-1)n / 2k sample in listdata, that is, the i-th window center of windowlist.

[0112] Step S410, for the samples of the data set listdata, use the window center to select the candidate centroid set;

[0113] Step S412, for each candidate centroid set, find the sample with the largest density from the candidate centroid set as Cni, and form a set Cn_set with the samples in dataset whose cosine distance with Cni is less than threshold T1, and calculate the center of the samples in Cn_set to obtain the centroid Ci;

[0114] Step S414, obtain K centroids

[0115] For the above steps S410 and S412, the specific content includes:

[0116] Select the candidate centroid set Cset1, obtain the first window center in windowlist, and according to the set window size size, obtain the A1 (i.e. (2*1-1)n / 2k)th element to A1+size (a total of size+1 elements) in listdata as the candidate centroid set Cset1.

[0117] Similarly, select the candidate centroid set Cset2, obtain the second window center in windowlist, and according to the set window size size, obtain the A2 (i.e. (2*2-1)n / 2k)th element to A2+size (a total of size+1 elements) in listdata as the candidate centroid set Cset2. ......

[0119] Similarly, select the candidate centroid set Csetk, obtain the kth window center in windowlist, and according to the set window size size, obtain the Ak (i.e. (2*k-1)n / 2k)th element to Ak+size (a total of size+1 elements) in listdata as the candidate centroid set Csetk.

[0120] Find the sample with the largest density from the candidate centroid set Cset1 as Cn1, and record the set composed of the samples in dataset whose cosine distance with Cn1 is less than threshold T1 as Cn1_set, and calculate the center of the samples in Cn1_set to obtain the centroid C1.

[0121] Similarly, find the sample with the largest density from the candidate centroid set Cset2 as Cn2, and record the set composed of the samples in dataset whose cosine distance with Cn2 is less than threshold T1 as Cn2_set, and calculate the center of the samples in Cn2_set to obtain the centroid C2. ......

[0123] Similarly, find the sample with the largest density from the candidate centroid set Csetk as Cnk, and the set of samples in dataset with cosine distance less than threshold T1 from Cnk is denoted as Cnk_set, and the center of the samples in Cnk_set is calculated to obtain the centroid Ck.

[0124] It should be noted that the obtained C1, C2,..., are used as initial centroids to perform Kmeans clustering on the dataset.

[0125] It should be noted that the above clustering method is used to improve the initialization stage of the kmeans algorithm, and a density cutting distance method is proposed to reasonably disperse and select the centroids in the initialization process, which accelerates the initialization convergence speed and improves the quality of the initial centroid selection, and the clustering quality is better, and the customer type division is more accurate; and the customer risk is evaluated according to the clustering calculation result of the customer data, and reasonable suggestions are proposed for the bank according to the customer types generated by the clustering analysis. The credit card customers are accurately identified and classified, so as to divide the customer risk level.

[0126] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.

[0127] The embodiment of the present application also provides a data clustering device, and it should be noted that the data clustering device of the embodiment of the present application can be used to execute the data clustering method provided by the embodiment of the present application. The data clustering device provided by the embodiment of the present application is introduced as follows.

[0128] Figure 5 is a schematic diagram of the data clustering device according to the embodiment of the present application. As shown in Figure 5 , the device comprises:

[0129] The first acquisition unit 502 is configured to acquire a data sample set, wherein the data sample set comprises N data samples arranged in order, and N is a positive integer;

[0130] The determination unit 504 is configured to determine K sample combinations from the N data samples, wherein each sample combination comprises M data samples arranged continuously, K is a positive integer, and M is a positive integer smaller than N;

[0131] The screening unit 506 is configured to perform screening processing on each sample combination to obtain K screened sample combinations;

[0132] The second obtaining unit 508 is configured to obtain a center sample of each filtered sample combination, and determine the center sample as a centroid of the filtered sample combination, to obtain K centroids;

[0133] The clustering unit 510 is configured to cluster the data sample set based on the K centroids.

[0134] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the filtering unit 506 comprises:

[0135] The first obtaining module is configured to obtain a first data sample with the maximum density in the ith sample combination, wherein i is a positive integer less than K;

[0136] The first traversing module is configured to traverse all data samples included in the ith sample combination in sequence to obtain a target data sample meeting a preset distance condition, wherein the filtered sample combination corresponding to the ith sample combination comprises the target data sample, and the preset distance condition is used to indicate that a cosine distance between the target data sample and the first data sample is less than a preset cosine distance threshold.

[0137] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the obtaining module comprises:

[0138] The first obtaining submodule is configured to obtain sample densities of each data sample included in the ith sample combination, and determine the first data sample with the maximum sample density therefrom;

[0139] The sample density of the current data sample of the ith sample combination is obtained by:

[0140] The second obtaining submodule is configured to obtain P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples have the closest cosine distance to the current data sample in the ith sample combination, and the ith sample combination comprises the P first neighbor data samples;

[0141] The third obtaining submodule is configured to obtain P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples have the closest cosine distance to the first neighbor data sample in the ith sample combination, and the ith sample combination comprises the P second neighbor data samples;

[0142] The fourth obtaining submodule is configured to perform a set union processing on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample;

[0143] The fifth obtaining sub-module is configured to obtain a number and a value of the neighbor data samples included in the target neighbor data sample set, and obtain an accumulated sum value of the cosine distances between each neighbor data sample included in the target neighbor data sample set and the current data sample;

[0144] The determining sub-module is configured to determine a quotient of the number and the value and the accumulated sum value as the sample density of the current data sample.

[0145] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the determining unit 504 comprises:

[0146] The second obtaining module is configured to obtain a window center associated with the jth sample combination, wherein the window center is used to indicate the (2j-1)*N / 2a data sample in the N data samples.

[0147] The first determining module is configured to determine M data samples from the (2j-1)*N / 2a data sample to the (2j-1)*N / 2a+M-1 data sample in the N data samples as the jth sample combination.

[0148] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the apparatus further comprises:

[0149] The fourth determining module is configured to determine that the preset convergence condition is met in a case where the number of the determined centroid points reaches a preset number threshold.

[0150] The fifth determining module is configured to determine that the preset convergence condition is met in a case where the cosine distance between each sample point in each second sample subset and the corresponding centroid point is not greater than a preset cosine distance.

[0151] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the second obtaining module comprises:

[0152] The third obtaining module is configured to select one data sample from the screened sample combination as an initial centroid neighbor point.

[0153] The second determining module is configured to determine at least one target data sample satisfying a preset similarity condition from other data samples of the screened sample combination, wherein the preset similarity condition is used to indicate that the cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold.

[0154] The third determining module is configured to determine the center of the at least one target data sample as the center sample.

[0155] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the first obtaining unit comprises:

[0156] The fourth obtaining module is configured to obtain an initial data sample set to be sorted, wherein the initial data sample set comprises N initial data samples arranged in disorder;

[0157] The second traversing module is configured to traverse the N initial data samples one by one, obtain a sample density of each initial data sample, and determine an initial data sample with the smallest sample density as an edge data sample;

[0158] The sorting module is configured to sort other initial data samples according to cosine distances between the other initial data samples and the edge data sample, and determine a sorted initial data sample set as a data sample set, wherein the edge data sample is located at an edge position, and the farther the position of a data sample with a larger cosine distance from the edge data sample is from the edge position, the closer the position of the data sample is to a central position.

[0159] Optionally, in the data clustering apparatus provided in the embodiments of the present application, the fourth obtaining module comprises:

[0160] The sixth obtaining sub-module is configured to obtain an initial sample set from the historical consumption log set, wherein the historical consumption log set comprises consumption log data generated in a use process of an account associated with the client in a historical time period;

[0161] The apparatus further comprises:

[0162] The classification module is configured to, after obtaining the clustered target sample set, classify a consumption risk level of the account associated with the client by using the data clustering result.

[0163] The data clustering apparatus provided in the embodiments of the present application is based on the data sample set sorted initially, obtains a plurality of windows through a filtering (window intercepting) mode of local continuous samples, and obtains a center sample of each window to determine a subsequent centroid for clustering, wherein, based on the continuous arrangement, the window intercepting, and the determination mode of the center sample, a "relative uniform relationship" is formed between the new centroid point and the initial centroid point, the uniformity of the centroid point selection is guaranteed, and thus the technical effect of improving the accuracy of subsequent clustering based on the centroid algorithm is achieved.

[0164] The data clustering apparatus comprises a processor and a memory, the first obtaining unit, the determination clustering unit, the filtering unit, the second obtaining unit, the clustering unit, and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize the corresponding functions.

[0165] The processor comprises a core, and the core calls the corresponding program units from the memory. One or more than one core can be set, and the uniformity of the centroid point selection is guaranteed by adjusting the core parameters, so as to improve the accuracy of clustering.

[0166] The memory can include non-persistent memory in a computer readable medium, random access memory (RAM), and / or non-volatile memory such as read only memory (ROM) or flash memory, and the memory includes at least one memory chip.

[0167] The embodiment of the present application provides a computer readable storage medium, which stores a program, and the program is executed by a processor to realize the data clustering method.

[0168] The embodiment of the present application provides a processor, which is used for running a program, and the program is executed to realize the data clustering method.

[0169] As shown in the figure, the embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor realizes the following steps when executing the program: Figure 6

[0170] Obtaining a data sample set, wherein the data sample set includes N data samples arranged in order, and N is a positive integer;

[0171] Determining K sample combinations from the N data samples, wherein each sample combination includes M data samples arranged in order, K is a positive integer, and M is a positive integer less than N;

[0172] Performing screening processing on each sample combination to obtain K screened sample combinations;

[0173] Obtaining a center sample of each screened sample combination, and determining the center sample as a centroid of the screened sample combination to obtain K centroids;

[0174] Clustering the data sample set based on the K centroids.

[0175] As an optional solution, the performing screening processing on each sample combination to obtain K screened sample combinations includes:

[0176] Obtaining a first data sample with maximum density in the i-th sample combination, wherein i is a positive integer less than K;

[0177] Traversing all data samples included in the i-th sample combination in sequence to obtain a target data sample meeting a preset distance condition, wherein the screened sample combination corresponding to the i-th sample combination includes the target data sample, and the preset distance condition is used to indicate that a cosine distance between the target data sample and the first data sample is less than a preset cosine distance threshold.

[0178] As an optional solution, the obtaining a first data sample with maximum density in the i-th sample combination includes:​

[0179] obtaining a sample density of each data sample included in the ith sample combination, and determining a first data sample with the maximum sample density from the sample density of each data sample included in the ith sample combination;

[0180] wherein the obtaining of the sample density of the current data sample of the ith sample combination comprises:

[0181] obtaining P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples are closest to the current data sample in terms of cosine distance in the ith sample combination, and the ith sample combination includes the P first neighbor data samples;

[0182] obtaining P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples are closest to the first neighbor data sample in terms of cosine distance in the ith sample combination, and the ith sample combination includes the P second neighbor data samples;

[0183] performing a union operation on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample;

[0184] obtaining a number and a value of neighbor data samples included in the target neighbor data sample set, and obtaining an accumulated sum value of cosine distances between each neighbor data sample included in the target neighbor data sample set and the current data sample;

[0185] determining a quotient of the number and the value and the accumulated sum value as the sample density of the current data sample.

[0186] As an optional solution, the obtaining of the center sample of each filtered sample combination and the determining of the center sample as the centroid of the filtered sample combination comprises:

[0187] selecting an initial centroid neighbor point from the filtered sample combination;

[0188] determining at least one target data sample satisfying a preset similarity condition from other data samples of the filtered sample combination, wherein the preset similarity condition is used to indicate that a cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold;

[0189] determining a center of the at least one target data sample as the center sample.

[0190] As an optional solution, the obtaining of the data sample set comprises:

[0191] obtaining an initial data sample set to be sorted, wherein the initial data sample set includes N initial data samples arranged in disorder;

[0192] sequentially traversing the N initial data samples, obtaining a sample density of each initial data sample, and determining an initial data sample with a minimum sample density as an edge data sample;

[0193] sorting other initial data samples according to cosine distances between the other initial data samples and the edge data sample, and determining a set of the sorted initial data samples as a data sample set, wherein the edge data sample is located at an edge position, and the farther the data sample is from the edge position and the closer the data sample is to a central position, the greater the cosine distance between the data sample and the edge data sample.

[0194] As an optional solution, obtaining the set of initial data samples to be sorted includes:

[0195] obtaining the set of initial samples from a set of historical consumption logs, wherein the set of historical consumption logs includes consumption log data generated in a historical time period by a user account associated with the client;

[0196] After obtaining the set of target samples after clustering, the method further includes:

[0197] classifying a consumption risk level associated with the account using the data clustering result.

[0198] The device herein can be a server, a PC, a PAD, a mobile phone, etc.

[0199] The application also provides a computer program product adapted to execute a program initialized with the following method steps when executed on a data processing device:

[0200] obtaining a data sample set, wherein the data sample set includes N data samples arranged in order, and N is a positive integer;

[0201] determining K groups of sample combinations from the N data samples, wherein each group of sample combinations includes M data samples arranged in succession, K is a positive integer, and M is a positive integer smaller than N;

[0202] performing screening processing on each group of sample combinations to obtain K groups of screened sample combinations;

[0203] obtaining a central sample of each group of screened sample combinations, and determining the central sample as a centroid of the screened sample combination, to obtain K centroids;

[0204] performing clustering on the data sample set based on the K centroids.

[0205] As an optional solution, performing screening processing on each group of sample combinations to obtain K groups of screened sample combinations includes:

[0206] obtaining a first data sample with the largest density in the i-th sample combination, wherein i is a positive integer less than K;

[0207] sequentially traversing all data samples included in the i-th sample combination to obtain a target data sample meeting a preset distance condition, wherein the i-th sample combination corresponds to the sample combination after the screening and the target data sample is included in the sample combination after the screening, and the preset distance condition is used to indicate that a cosine distance between the target data sample and the first data sample is less than a preset cosine distance threshold.

[0208] As an optional solution, obtaining the first data sample with the largest density in the i-th sample combination includes:

[0209] obtaining the density of each data sample included in the i-th sample combination, and determining the first data sample with the largest density from the density of each data sample;

[0210] wherein, obtaining the density of the current data sample in the i-th sample combination includes:

[0211] obtaining P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples have the smallest cosine distance with the current data sample in the i-th sample combination, and the i-th sample combination includes the P first neighbor data samples;

[0212] obtaining P second neighbor data samples associated with each first neighbor data sample, wherein the P second neighbor data samples have the smallest cosine distance with the first neighbor data sample in the i-th sample combination, and the i-th sample combination includes the P second neighbor data samples;

[0213] performing a union operation on the P first neighbor data samples and the P second neighbor data samples associated with each first neighbor data sample to obtain a target neighbor data sample set associated with the current data sample;

[0214] obtaining the number and value of the neighbor data samples included in the target neighbor data sample set, and the cumulative sum value of the cosine distances between each neighbor data sample included in the target neighbor data sample set and the current data sample;

[0215] determining the quotient of the number and value and the cumulative sum value as the density of the current data sample.

[0216] As an optional solution, obtaining the center sample of each sample combination after the screening and determining the center sample as the centroid of the sample combination after the screening includes:

[0217] selecting one data sample from the sample combination after the screening as an initial centroid neighbor point;

[0218] At least one target data sample meeting a preset similarity condition is determined from other data samples in the sample combination, wherein the preset similarity condition is used to indicate that a cosine similarity between the at least one target data sample and the initial centroid near point is greater than a preset similarity threshold value.

[0219] The center of the at least one target data sample is determined as a center sample.

[0220] As an optional solution, obtaining the data sample set comprises:

[0221] An initial data sample set to be sorted is obtained, wherein the initial data sample set comprises N initial data samples arranged in disorder;

[0222] The N initial data samples are sequentially traversed, a sample density of each initial data sample is obtained, and an initial data sample with the smallest sample density is determined as an edge data sample;

[0223] According to a cosine distance between other initial data samples and the edge data sample, the other initial data samples are sorted, and the sorted initial data sample set is determined as the data sample set, wherein the edge data sample is located at an edge position, a data sample with a greater cosine distance from the edge data sample is farther away from the edge position and closer to a center position.

[0224] As an optional solution, obtaining the initial data sample set to be sorted comprises:

[0225] The initial sample set is obtained from a historical consumption log set, wherein the historical consumption log set comprises consumption log data generated in a use process of an account associated with a client in a historical time period;

[0226] After obtaining the clustered target sample set, the method further comprises:

[0227] The consumption risk level associated with the account is classified by using the data clustering result.

[0228] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.

[0229] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.

[0230] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.

[0231] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.

[0232] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0233] The memory can include non-persistent memory and / or volatile memory, such as a random access memory (RAM) including a cache area for the temporary storage of data. The memory can also include non-volatile memory, such as read only memory (ROM) for storing structural information and / or instruction code to boot an operating system. Access and / or storage of information on the memory can be performed by one or more memory controllers. The memory can also include other volatile memory and / or non-volatile memory, such as flash memory, magnetic computer storage media, optical computer storage media, tape, and / or soft or hard disk drives.

[0234] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.

[0235] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but also other elements not explicitly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0236] In addition, the user information (including but not limited to the account-related information of the client) and the data (including but not limited to the initial sample data for clustering) involved in the present application are all information and data authorized by the user or sufficiently authorized.

[0237] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0238] The above is only an embodiment of the present application and is not intended to limit the present application. Those skilled in the art can make various changes and modifications to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the scope of the claims of the present application.

Claims

1. A data clustering method, characterized by, The method comprises: obtaining an initial sample set from a historical consumption log set, wherein the historical consumption log set comprises consumption log data generated by a client-associated account during use in a historical time period; sequentially traversing N initial data samples included in the initial data sample set to obtain a sample density of each initial data sample, and determining an initial data sample with the smallest sample density as an edge data sample, N being a positive integer; sorting other initial data samples according to a cosine distance between the other initial data samples and the edge data sample, and determining a sorted initial data sample set as a data sample set, the data sample set comprising N data samples in an ordered arrangement; determining K sample combinations from the N data samples, wherein each sample combination comprises M data samples in a continuous arrangement, a first data sample in each sample combination is farthest from the edge data sample of the sample combination in terms of cosine distance, and a last data sample in each sample combination is closest to the edge data sample of the sample combination in terms of cosine distance, K being a positive integer and M being a positive integer smaller than N; removing, in each sample combination, a data sample with a cosine distance greater than a preset cosine distance threshold from a data sample with the largest sample density, to obtain K filtered sample combinations; obtaining a center sample of each filtered sample combination, and determining the center sample as a centroid of the filtered sample combination, to obtain K centroids; performing clustering on the data sample set based on the K centroids.

2. The method of claim 1, wherein, The removing, in each sample combination, a data sample with a cosine distance greater than a preset cosine distance threshold from a data sample with the largest sample density, to obtain K filtered sample combinations comprises: obtaining a first data sample with the largest density in an i-th sample combination, i being a positive integer smaller than K; sequentially traversing all data samples included in the i-th sample combination to obtain a target data sample meeting a preset distance condition, wherein the filtered sample combination corresponding to the i-th sample combination comprises the target data sample, and the preset distance condition indicates that a cosine distance between the target data sample and the first data sample is smaller than the preset cosine distance threshold.

3. The method of claim 2, wherein, The obtaining a first data sample with the largest density in an i-th sample combination comprises: obtaining sample densities of each data sample included in the i-th sample combination, and determining the first data sample with the largest sample density therefrom; wherein the obtaining a sample density of a current data sample of the i-th sample combination comprises: obtaining P first neighbor data samples associated with the current data sample, wherein the P first neighbor data samples are closest to the current data sample in terms of cosine distance in the i-th sample combination, and the i-th sample combination comprises the P first neighbor data samples; obtaining P second neighbor data samples associated with each of the first neighbor data samples, wherein the P second neighbor data samples are closest to the first neighbor data samples in the ith sample combination, and the ith sample combination comprises the P second neighbor data samples; performing a union operation on the P first neighbor data samples and the P second neighbor data samples associated with each of the first neighbor data samples to obtain a target neighbor data sample set associated with the current data sample; obtaining a number and a value of neighbor data samples included in the target neighbor data sample set, and obtaining a cumulative sum value of cosine distances between each of the neighbor data samples included in the target neighbor data sample set and the current data sample; determining a quotient of the number and the value and the cumulative sum value as a sample density of the current data sample.

4. The method of claim 1, wherein, The determining of the K sample combinations from the N data samples comprises: obtaining a window center associated with a jth sample combination, wherein the window center is used to indicate a (2j-1)*N / 2a data sample in the N data samples; determining M data samples from the (2j-1)*N / 2a data sample to the (2j-1)*N / 2a+M-1 data sample in the N data samples as the jth sample combination.

5. The method of claim 1, wherein, The obtaining of the center sample of each of the screened sample combinations and the determining of the center sample as a centroid of the screened sample combination comprises: selecting an initial centroid neighbor point from the screened sample combination; determining at least one target data sample satisfying a preset similarity condition from other data samples of the screened sample combination, wherein the preset similarity condition is used to indicate that a cosine similarity between the at least one target data sample and the initial centroid neighbor point is greater than a preset similarity threshold; determining a center of the at least one target data sample as the center sample.

6. The method of claim 1, wherein after obtaining the target sample set after clustering, the method further comprises: classifying a consumption risk level associated with the account by using the data clustering result.

7. A data clustering apparatus, characterized by comprising: The device is configured to: obtain an initial sample set from a historical consumption log set, wherein the historical consumption log set comprises consumption log data generated by an account associated with a client in a historical time period; sequentially traverse N initial data samples included in the initial data sample set, obtain a sample density of each initial data sample, and determine an initial data sample with a minimum sample density as an edge data sample, N being a positive integer; sort other initial data samples according to cosine distances between the other initial data samples and the edge data sample, and determine a sorted initial data sample set as a data sample set, the data sample set comprising N data samples arranged in order, N being a positive integer; and determine a sample density of each data sample in the data sample set, and determine a data sample with a minimum sample density as an edge data sample, and sort other data samples according to cosine distances between the other data samples and the edge data sample, and determine a sorted data sample set as a target sample set, the target sample set comprising N data samples arranged in order, N being a positive integer. ​ determining units configured to determine K groups of sample combinations from the N data samples, wherein each group of sample combinations includes M data samples arranged in sequence, a first data sample in each group of sample combinations is farthest from the edge data sample of the each group of sample combinations in terms of cosine distance, a last data sample in each group of sample combinations is closest to the edge data sample of the each group of sample combinations in terms of cosine distance, K is a positive integer, and M is a positive integer less than N; screening units configured to remove, in each group of sample combinations, a data sample whose cosine distance with a data sample of the highest density is greater than a preset cosine distance threshold, to obtain K groups of screened sample combinations; second obtaining units configured to obtain a center sample of each group of the screened sample combinations, and determine the center sample as a centroid of the screened sample combination, to obtain K centroids; clustering units configured to cluster the data sample set based on the K centroids.

8. A processor, comprising: The processor is configured to run a program, and the program, when running, performs the method in any one of claims 1 to 6.

9. An electronic device, comprising: The apparatus includes one or more processors and memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Personal financial credit risk evaluation method and system and storage medium

    CN111062806A

  • Mean clustering method and device

    CN114662578A

  • Traffic data clustering method and device, equipment and medium

    CN115563522A