Customer group classification method and device
By calculating composite nearest neighbor similarity and multi-degree nearest neighbor relationships, combined with distance thresholds and weight coefficients, the problem of insufficiently accurate customer group classification in the existing technology is solved, and more accurate customer group division and clustering results are achieved.
Patent Information
- Application Number
- CN202410863590.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-29
- Publication Date
- 2024-10-01
AI Technical Summary
Existing customer group classification methods cannot obtain sufficiently accurate clustering results when processing data with large differences in density, resulting in inaccurate classification.
By calculating the composite nearest neighbor similarity between data points, considering multi-degree nearest neighbor relationships, using distance thresholds and weight coefficients to improve the accuracy of similarity calculation, and dividing connected clusters based on the similarity graph, excluding outliers to Improve the accuracy of clustering results.
It achieves a more precise division of customer groups, improves the accuracy and classification efficiency of clustering results, and is suitable for the needs of complex business scenarios.
Smart Images

Figure CN118735566A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data analysis technology, and in particular to a method and device for classifying customer groups. Background Art
[0002] In the operation of the supply chain, it is necessary to divide the massive number of customers into segments with distinct characteristics, so that refined and personalized operations and services can be adopted for these segments in the operation activities, ultimately improving the efficiency of operations and commercial results.
[0003] At present, the characteristic data of customers is converted into corresponding data points, and then clustering operations are performed on these data points. Due to the complexity of business activities in the supply chain, the density of data points is uneven and varies greatly. Using the Jarvis-Patrick algorithm to cluster data points based on the shared nearest neighbor method can effectively handle data with large differences in data density. However, this method only considers the relationship with the nearest few data points when calculating the similarity between data points. However, in actual situations, the relationship between data points is often more complicated. Therefore, using the Jarvis-Patrick algorithm cannot obtain more accurate clustering results, and there is a problem of inaccurate classification of customer groups.
[0004] Therefore, there is an urgent need for a solution to divide customer groups more accurately. Summary of the invention
[0005] The present application provides a method and device for classifying customer groups, so as to divide customer groups more accurately.
[0006] In a first aspect, the present application provides a method for classifying customer groups, the method comprising: obtaining a set of data points corresponding to customers to be classified; each data point in the set of data points represents multiple feature data of the corresponding customer; for each data point, determining the 1 to i degree nearest neighbors of the data point based on the distance between the data point and other data points; wherein the j degree nearest neighbor of the data point is the 1 degree nearest neighbor of each data point in the j-1 degree nearest neighbor of the data point; j is greater than 1 and less than or equal to i, and i is greater than or equal to 2; for any two data points, determining the similarity between the data point and the other data point in the 1 to i degree nearest neighbors; determining the composite nearest neighbor similarity between the data point and the other data point based on the similarity between the 1 to i degree nearest neighbors; wherein the similarity of the j degree nearest neighbor is determined based on the distance between the j degree nearest neighbor of the data point and the same data point in the j degree nearest neighbor of the other data point and the data point and the other data point respectively; the closer the distance, the higher the similarity of the j degree nearest neighbor; based on the composite nearest neighbor similarity between each data point and other data points, determining the group to which each customer to be classified belongs.
[0007] In the above technical solution, when calculating the nearest neighbor similarity, the influence of the distance between data points on the nearest neighbor similarity is taken into account. When the distance is closer, the nearest neighbor similarity is higher, so that the calculated nearest neighbor similarity is more accurate. In addition, by calculating the composite nearest neighbor similarity, the influence of the multi-degree nearest neighbor relationship of data points on the classification result is taken into account, so that the calculated similarity between data points is more accurate, and then the customer group segmentation result obtained based on the composite nearest neighbor similarity is more accurate.
[0008] In one possible design, the 1 to i degree nearest neighbors of the data point are determined based on the distance between the data point and other data points, including: taking the data point as a reference point and determining the distance between the reference point and other data points; selecting k data points closest to the reference point as the k nearest neighbors of the reference point; taking m nearest neighbors of the k nearest neighbors whose distance to the reference point is less than or equal to a distance threshold as the 1 degree nearest neighbors of the reference point; the distance threshold is determined based on the average distance of the k nearest neighbors of each data point; taking the 1 degree nearest neighbor of the reference point as the reference point, and continuing to determine the 2 degree nearest neighbors of the data point until the i degree nearest neighbor of the data point is determined.
[0009] In the above technical solution, on the one hand, by setting a distance threshold, discrete points that are too far away are restricted from becoming nearest neighbor points, thereby improving the accuracy of clustering results. On the other hand, the multi-degree nearest neighbors of data points are also counted to increase the accuracy of expressing the relationship between data points.
[0010] In one possible design, the composite nearest neighbor similarity between the data point and the other data point is determined based on the similarities of the nearest neighbors of degree 1 to i, including: adding the product of the similarities of the data point and each of the i-degree nearest neighbors of the other data point and the corresponding weight coefficient to obtain the composite nearest neighbor similarity between the data point and the other data point; wherein the weight coefficient decreases sequentially from degree 1 to i.
[0011] In the above technical solution, by calculating the composite nearest neighbor similarity, the influence of the multi-degree nearest neighbor relationship of data points on the classification results is taken into account, so that the calculated similarity between data points is more accurate, and then the clustering result based on the composite nearest neighbor similarity is more accurate, which is suitable for scenarios that require more precise classification results.
[0012] In a possible design, based on the composite nearest neighbor similarity between each data point and each other data point, determining the group to which each to-be-classified customer belongs includes: obtaining a similarity graph based on the composite nearest neighbor similarity between each data point and each other data point; wherein, if the composite nearest neighbor similarity between two data points is greater than or equal to a similarity threshold, then there is an edge between the two data points; traversing the similarity graph to obtain each connected cluster; and classifying each data point in the connected cluster into the same customer group.
[0013] In the above technical solution, the data points to be classified are clustered into multiple connected clusters based on the composite nearest neighbor similarity between the data points. The data features of the data points in the connected clusters are similar. Therefore, the customers represented by the data points in the same connected cluster are divided into one group. This clustering method is more accurate in the division results of customer groups.
[0014] In a possible design, before dividing the data points in the connected clusters into the same customer group, it also includes: deleting the connected clusters whose number of data points is less than a set number; taking the remaining data points as a new set of data points, and recalculating the composite nearest neighbor similarity between each data point in the new set of data points and other data points to obtain the connected clusters in the similarity graph, until the number of data points in each connected cluster is not less than the set number.
[0015] In the above technical solution, data points in the connected clusters with less than the set number of data points are considered outliers. After clustering is completed, deleting the outliers is equivalent to excluding customer data in the supply chain business data that has no analytical value and will affect the classification results. The data points after deleting the outliers are clustered again, which reduces the error caused by the outliers to the clustering results and makes the clustering results more accurate.
[0016] In one possible design, the similarity of the j-degree nearest neighbors of any two data points is determined by the following method: the same data point in the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point is taken as the shared i-degree nearest neighbor of the first data point and the second data point; the similarity of the i-degree nearest neighbors of the first data point and the second data point is determined based on a first distance between each shared i-degree nearest neighbor and the first data point and a second distance between the shared i-degree nearest neighbor and the second data point; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbors.
[0017] In the above technical solution, when calculating the nearest neighbor similarity, the influence of the distance between data points on the nearest neighbor similarity is considered. When the distance is closer, the nearest neighbor similarity is higher, so that the calculated nearest neighbor similarity is more accurate.
[0018] In a possible design, the similarity of the j-degree nearest neighbors of any two data points is determined by the following method: the data point that is the same in the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point is taken as the shared i-degree nearest neighbor of the first data point and the second data point; the standard deviation of the distance between each data point in the set of the first data point, the second data point and the shared i-degree nearest neighbor is determined; the similarity of the i-degree nearest neighbors of the first data point and the second data point is determined based on the first distance of each shared i-degree nearest neighbor from the first data point, the second distance from the second data point, and the standard deviation between the data points; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbors; the standard deviation between the data points is inversely proportional to the similarity of the i-degree nearest neighbors.
[0019] In the above technical solution, in the above technical solution, when calculating the similarity of the nearest neighbors, not only the influence of the distance between data points on the similarity of the nearest neighbors is considered, but also the influence of the uniformity of the distance distribution between data points on the similarity of the nearest neighbors is considered. The closer the distance, the higher the similarity of the nearest neighbors, and the more uniform the distance distribution between data points, the higher the similarity of the nearest neighbors, so that the calculated similarity of the nearest neighbors is more accurate.
[0020] In one possible design, obtaining a set of data points corresponding to the customers to be classified includes: obtaining a set of data points corresponding to the customers to be classified; dividing the set of data points corresponding to the customers to be classified into multiple regions based on at least one dimension data of the set of data points corresponding to the customers to be classified; and performing subsequent steps on the data points in each region respectively.
[0021] In the above technical solution, by dividing the data of at least one dimension into regions, customers are first roughly classified, and then the customers in each region are further classified. This method does not require all customer data in each region to participate in the classification calculation, which can greatly reduce the complexity of the calculation, reduce invalid calculations, and improve classification efficiency.
[0022] In a second aspect, an embodiment of the present application provides a device for classifying customer groups, the device comprising:
[0023] An acquisition module, used to acquire a set of data points corresponding to the customer to be classified; each data point in the set of data points represents multiple feature data of the corresponding customer;
[0024] A processing module, for determining, for each data point, the 1 to i degree nearest neighbors of the data point according to the distances between the data point and other data points; wherein the j degree nearest neighbors of the data point are the 1 degree nearest neighbors of each data point in the j-1 degree nearest neighbors of the data point; j is greater than 1 and less than or equal to i, and i is greater than or equal to 2;
[0025] The processing module is further used to determine, for any two data points, the similarity between the data point and another data point in the 1 to i degree nearest neighbor; determine the composite nearest neighbor similarity between the data point and the another data point based on the 1 to i degree nearest neighbor similarity; wherein the j degree nearest neighbor similarity is determined based on the distances between the j degree nearest neighbor of the data point and the same data point in the j degree nearest neighbor of the other data point and the data point and the other data point respectively; the closer the distance, the higher the similarity of the j degree nearest neighbor;
[0026] The classification module is used to determine the group to which each customer to be classified belongs based on the composite nearest neighbor similarity between each data point and other data points.
[0027] In one possible design, the processing module, when determining the 1 to i degree nearest neighbors of the data point based on the distances between the data point and other data points, is specifically used to: take the data point as a reference point to determine the distance between the reference point and other data points; select k data points closest to the reference point as the k nearest neighbors of the reference point; take the m nearest neighbors among the k nearest neighbors whose distances to the reference point are less than or equal to a distance threshold as the 1 degree nearest neighbors of the reference point; the distance threshold is determined based on the average distance of the k nearest neighbors of each data point; take the 1 degree nearest neighbor of the reference point as the reference point, and continue to determine the 2 degree nearest neighbors of the data point until the i degree nearest neighbor of the data point is determined.
[0028] In one possible design, the processing module, when determining the composite nearest neighbor similarity between the data point and the other data point based on the similarities of the nearest neighbors of degree 1 to i, is specifically used to: add the product of the similarities of the data point and each i-degree nearest neighbor of the other data point and the corresponding weight coefficient to obtain the composite nearest neighbor similarity between the data point and the other data point; wherein the weight coefficient decreases successively from degree 1 to i.
[0029] In a possible design, when the classification module determines the group to which each to-be-classified customer belongs based on the composite nearest neighbor similarity between each data point and each other data point, the classification module is specifically used to: obtain a similarity graph based on the composite nearest neighbor similarity between each data point and each other data point; wherein, if the composite nearest neighbor similarity between two data points is greater than or equal to a similarity threshold, then there is an edge between the two data points; traverse the similarity graph to obtain each connected cluster; and classify each data point in the connected cluster into the same customer group.
[0030] In a possible design, the classification module, before classifying the data points in the connected clusters into the same customer group, is also used to delete the connected clusters whose number of data points is less than a set number; use the remaining data points as a new set of data points, recalculate the composite nearest neighbor similarity between each data point in the new set of data points and other data points, and obtain the connected clusters in the similarity graph, until the number of data points in each connected cluster is not less than the set number.
[0031] In one possible design, the processing module determines the similarity of the j-degree nearest neighbors of any two data points by the following method: taking the same data point in the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point as the shared i-degree nearest neighbor of the first data point and the second data point; determining the similarity of the i-degree nearest neighbor of the first data point and the second data point based on a first distance between each shared i-degree nearest neighbor and the first data point and a second distance between the shared i-degree nearest neighbor and the second data point; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbor.
[0032] In one possible design, the processing module determines the similarity of the j-degree nearest neighbors of any two data points by the following method: taking the same data point in the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point as the shared i-degree nearest neighbor of the first data point and the second data point; determining the standard deviation of the distance between each data point in the set of the first data point, the second data point and the shared i-degree nearest neighbor; determining the similarity of the i-degree nearest neighbor of the first data point and the second data point based on the first distance of each shared i-degree nearest neighbor to the first data point, the second distance to the second data point, and the standard deviation between the data points; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbors; the standard deviation between the data points is inversely proportional to the similarity of the i-degree nearest neighbors.
[0033] In a possible design, the acquisition module, when acquiring the data point set corresponding to the customer to be classified, is specifically used to acquire the data point set corresponding to the customer to be classified; based on at least one dimension data of the data point set corresponding to the customer to be classified, the data point set corresponding to the customer to be classified is divided into multiple regions; the processing module is also used to execute subsequent steps for the data points in each region respectively.
[0034] In a third aspect, an embodiment of the present application further provides a computing device, including:
[0035] A memory for storing program instructions;
[0036] A processor is used to call the program instructions stored in the memory, and execute the method described in any possible design of the first aspect or the second aspect according to the obtained program instructions.
[0037] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-readable instructions are stored. When a computer reads and executes the computer-readable instructions, the method described in any possible design of the first aspect or the second aspect mentioned above is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flow chart of a method for classifying customer groups applicable to an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a process for determining the 1 to i degree nearest neighbor of a data point provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of a process for determining the group to which each customer to be classified belongs provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of the structure of a device for classifying customer groups provided in an embodiment of the present application;
[0043] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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 ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0045] In the embodiments of the present application, a plurality refers to two or more than two. The words "first", "second" and the like are only used for the purpose of distinguishing descriptions and cannot be understood as indicating or implying relative importance or order.
[0046] Figure 1A flow chart of a method for classifying customer groups provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes:
[0047] Step 101: Obtain a set of data points corresponding to the customers to be classified.
[0048] In an embodiment of the present application, each data point in the data point set represents multiple characteristic data of the corresponding customer. The characteristic data of the customer includes, but is not limited to, the following types of data: such as age, gender, annual income, loan amount, years of work experience, whether there is a property, whether married, permanent residence area, etc. The specific characteristic data used to classify the customer can be set according to actual needs. For example, the data point corresponding to each customer to be classified can be represented as (x, y, z), where x is the customer's age, y is the customer's annual income, and z is the customer's years of work, and then the customer is classified according to these three characteristic data.
[0049] In a possible implementation, when obtaining a set of data points corresponding to the customers to be classified, the set of data points corresponding to the customers to be classified can be divided into multiple regions based on at least one dimension data of the set of data points corresponding to the customers to be classified, and then subsequent steps are performed on the data points in each region respectively.
[0050] That is to say, a rough regional division is first performed on the data of a certain dimension or multiple dimensions, and then the data points corresponding to the customers in the region are subjected to subsequent classification steps. Exemplarily, the age of the customer can be divided into multiple regions, for example, into four regions of 0-20 years old, 21-40 years old, 41-60 years old, and over 60 years old. Or the working years of the customer can be divided into multiple regions, for example, into four regions of less than 10 years, 10-20 years, 21-30 years, and over 30 years old. Alternatively, age and marital status can be divided, for example, into eight regions of 0-20 years old married, 0-20 years old unmarried, 21-40 years old married, 21-40 years old unmarried, 41-60 years old married, 41-60 years old unmarried, over 60 years old married, and over 60 years old unmarried.
[0051] In the above technical solution, by dividing the data of at least one dimension into regions, customers are first roughly classified, and then the customers in each region are further classified. This method does not require all customer data in each region to participate in the classification calculation, which can greatly reduce the complexity of the calculation, reduce invalid calculations, and improve classification efficiency.
[0052] Step 102: for each data point, determine the 1 to i degree nearest neighbors of the data point according to the distances between the data point and other data points.
[0053] Among them, the j-degree nearest neighbor of a data point is the 1-degree nearest neighbor of each data point in the j-1-degree nearest neighbor of the data point, j is greater than 1 and less than or equal to i, and i is greater than or equal to 2.
[0054] Specifically, it can be achieved by Figure 2 The method shown in the figure, determining the 1 to i degree nearest neighbor of a data point according to the distance between the data point and other data points, includes the following steps:
[0055] Step 201: Take the data point as a reference point and determine the distance between the reference point and other data points.
[0056] The distance between the reference point and other data points can be calculated using the Euclidean distance formula, see formula 1.
[0057]
[0058] Among them, x i is the feature data of each dimension of the reference point X; i It is the feature data of each dimension of other data points Y.
[0059] Step 202: Select k data points closest to the reference point as k nearest neighbors of the reference point.
[0060] Among them, k can be set according to actual needs. For example, if k is set to 5, the five data points closest to the reference point are selected as the five nearest neighbors of the reference point.
[0061] Step 203: m nearest neighbors whose distances to the reference point are less than or equal to a distance threshold among the k nearest neighbors are used as the 1st-degree nearest neighbors of the reference point.
[0062] For example, assuming that the distances of the five nearest neighbors a, b, c, d, and e of the reference point X from the reference point X are 4, 5, 6, 8, and 9 respectively, and the distance threshold is 6, then the 1st-degree nearest neighbors of the reference point X are the three points a, b, and c whose distances from the reference point X are less than or equal to the distance threshold 6.
[0063] The distance threshold is determined based on the average distance of the k nearest neighbors of each data point. A calculation formula for the distance threshold is referred to Formula 2.
[0064]
[0065] Among them, K-distance is the distance threshold; dk i is the distance between each data point and its nearest neighbor; n is the number of times the distance is accumulated. For example, there are 5 data points in total and each data point has 3 nearest neighbors, then n is 5×3=15.
[0066] In addition, a distance threshold adjustment parameter kDistanceX may be set when calculating the distance threshold, and the distance threshold may be fine-tuned by adjusting the parameter kDistanceX. For another calculation formula of the distance threshold, refer to Formula 3.
[0067]
[0068] Step 204: Take the 1st degree nearest neighbor of the reference point as the reference point, and continue to determine the 2nd degree nearest neighbor of the data point until the i-degree nearest neighbor of the data point is determined.
[0069] Among them, the j-degree nearest neighbor of a data point is the 1-degree nearest neighbor of each data point in the j-1-degree nearest neighbor of the data point, j is greater than 1 and less than or equal to i, and i is greater than or equal to 2. In other words, the 2-degree nearest neighbor of a data point is the 1-degree nearest neighbor of the 1-degree nearest neighbor of the data point, the 3-degree nearest neighbor of a data point is the 1-degree nearest neighbor of the 2-degree nearest neighbor of the data point, and so on.
[0070] For example, suppose that the 1st-degree nearest neighbors of data point X are three data points a, b, and c, and the 1st-degree nearest neighbors of data point a are X, b, and c; the 1st-degree nearest neighbors of data point b are X, a, c, and d; the 1st-degree nearest neighbors of data point c are X, a, b, and e, then the 2nd-degree nearest neighbors of data point X are a, b, c, d, and e, which are 5 data points. Suppose that the 1st-degree nearest neighbors of data point d are b and f; the 1st-degree nearest neighbors of data point e are c and g, then the 3rd-degree nearest neighbors of data point X are the 1st-degree nearest neighbors of each of the 2nd-degree nearest neighbors (a, b, c, d, and e) of data point X, that is, a, b, c, d, e, f, and g, which are 7 data points.
[0071] In the above technical solution, on the one hand, by setting a distance threshold, discrete points that are too far away are restricted from becoming nearest neighbor points, thereby improving the accuracy of clustering results. On the other hand, the multi-degree nearest neighbors of data points are also counted to increase the accuracy of expressing the relationship between data points.
[0072] Step 103: For any two data points, determine the similarity between the nearest neighbors of the data point and another data point in degrees 1 to i.
[0073] For example, the similarity of the j-degree nearest neighbors of any two data points can be determined in the following two ways:
[0074] Method 1
[0075] Step 1-1: The data point that is the same among the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point is taken as the shared i-degree nearest neighbor of the first data point and the second data point.
[0076] For example, assuming that the 1st-degree nearest neighbors of data point A are three data points a, b, and c, and the 1st-degree nearest neighbors of data point B are three data points b, c, and d, then the shared 1st-degree nearest neighbors of data point A and data point B are two data points b and c.
[0077] Step 1-2: Determine the similarity between the i-degree nearest neighbors of the first data point and the second data point based on the first distance between each shared i-degree nearest neighbor and the first data point and the second distance between each shared i-degree nearest neighbor and the second data point.
[0078] The first distance and the second distance are inversely proportional to the similarity of the i-th nearest neighbor.
[0079] For example, a calculation formula for the similarity of the nearest neighbor of degree i is shown in Formula 4:
[0080]
[0081] Among them, Scorei is the similarity of the nearest neighbor of degree i; H j is the distance between each data point in the shared i-degree nearest neighbor and the original data point (the first data point and the second data point), fi is the influence parameter, and the influence parameters of each degree can be the same or different; m is the number of times the distance is accumulated.
[0082] For example, suppose that the 1st degree shared nearest neighbors of data point A and data point B are two data points b and c, and the first distance between data point b and data point A is H bA , the second distance from data point B is H bB ; The first distance between data point c and data point A is H cA , the second distance from data point B is H cB , then the similarity of the 1st-degree nearest neighbors of data point A and data point B is
[0083] It should be noted that if there is no common data point between the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point, the shared i-degree nearest neighbor of the first data point and the second data point is 0, and the similarity of the i-degree nearest neighbor is also 0.
[0084] In the above technical solution, when calculating the similarity of the nearest neighbors, the influence of the distance between data points on the similarity of the nearest neighbors is taken into account. When the distance is closer, the similarity of the nearest neighbors is higher, so that the calculated similarity of the nearest neighbors is more accurate.
[0085] Method 2
[0086] Step 2-1: The data point that is the same among the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point is taken as the shared i-degree nearest neighbor of the first data point and the second data point.
[0087] Step 2-2: Determine the standard deviation of the distance between each data point in the set of the first data point, the second data point, and the shared i-degree nearest neighbors.
[0088] By calculating the standard deviation of the distance between each data point, the uniformity of the distance distribution between the data points can be reflected, and the uniformity of the distance distribution can be used as one of the factors affecting the similarity of the nearest neighbors of the data points.
[0089] Step 2-3, determine the similarity between the i-degree nearest neighbors of the first data point and the second data point based on the first distance of each shared i-degree nearest neighbor to the first data point, the second distance to the second data point, and the standard deviation between each data point.
[0090] The first distance and the second distance are inversely proportional to the similarity of the nearest neighbors of degree i; the standard deviation between each data point is inversely proportional to the similarity of the nearest neighbors of degree i.
[0091] For example, another calculation formula for the similarity of the nearest neighbor of degree i is as follows:
[0092]
[0093] Among them, Scorei is the similarity of the nearest neighbor of degree i; L j is the distance between each data point in the shared i-degree nearest neighbor and the original data point (the first data point and the second data point), di is the influence parameter, the influence parameters of each degree can be the same or different, n is the number of accumulated distances, Mk is the distance between each data point in the shared i-degree nearest neighbor and each data point in the original data point set (the first data point, the second data point and the set of shared i-degree nearest neighbors), is the mean distance between each data point in the original data point set (the first data point, the second data point and the set of shared i-degree nearest neighbors), and m is the total number of Mk.
[0094] For example, suppose that the 1st degree shared nearest neighbors of data point A and data point B are two data points b and c, and the first distance between data point b and data point A is L bA , the second distance from data point B is L bB ; The first distance between data point c and data point A is L cA , the second distance from data point B is L cB , then the similarity of the 1st-degree nearest neighbors of data point A and data point B is Among them, σ is the standard deviation of the distances between the four data points A, B, b, and C.
[0095] In the above technical solution, when calculating the similarity of the nearest neighbors, not only the influence of the distance between data points on the similarity of the nearest neighbors is considered, but also the influence of the uniformity of the distance distribution between data points on the similarity of the nearest neighbors is considered. The closer the distance is, the higher the similarity of the nearest neighbors is, and the more uniform the distance distribution between data points is, the higher the similarity of the nearest neighbors is, so that the calculated similarity of the nearest neighbors is more accurate.
[0096] Step 104: Determine the composite nearest neighbor similarity between the data point and another data point based on the similarities of the nearest neighbors of degree 1 to i.
[0097] Among them, the similarity of the j-degree nearest neighbor is determined according to the distance between the j-degree nearest neighbor of the data point and the same data point in the j-degree nearest neighbor of another data point and the data point and the other data point respectively. The closer the distance, the higher the similarity of the j-degree nearest neighbor.
[0098] Specifically, when determining the composite nearest neighbor similarity between a data point and another data point based on the similarities of the nearest neighbors of degree 1 to i, the product of the similarities of the data point and each of the i-degree nearest neighbors of the other data point and the corresponding weight coefficient can be added to obtain the composite nearest neighbor similarity between the data point and the other data point.
[0099] Among them, the weight coefficient corresponding to the similarity of each i-degree nearest neighbor decreases from 1 to i, indicating that the larger the dimension of the nearest neighbor, the smaller the influence on the similarity of the nearest neighbor.
[0100] For example, the calculation formula of the composite nearest neighbor similarity is as follows:
[0101]
[0102] Among them, Scorei is the similarity of the nearest neighbor of degree i; xi is the weight coefficient corresponding to the similarity of the nearest neighbor of degree i, and N is the maximum degree of the nearest neighbor.
[0103] For example, assuming that the value of N is 2, that is, the composite nearest neighbor similarity is composed of the 1st degree similarity and the 2nd degree nearest neighbor similarity, the 1st degree nearest neighbor similarity between data point P1 and data point P2 is 10, and the corresponding weight coefficient is 1, and the 2nd degree nearest neighbor similarity is 8, and the corresponding weight coefficient is 0.5, then the composite nearest neighbor similarity between data point P1 and data point P2 is 10×1+8×0.5=14.
[0104] In the above technical solution, by calculating the composite nearest neighbor similarity, the influence of the multi-degree nearest neighbor relationship of data points on the classification results is taken into account, so that the calculated similarity between data points is more accurate, and then the clustering result based on the composite nearest neighbor similarity is more accurate, which is suitable for scenarios that require more precise classification results.
[0105] Step 105: Determine the group to which each customer to be classified belongs based on the composite nearest neighbor similarity between each data point and other data points.
[0106] Specifically, it can be achieved by Figure 3 The method shown in the figure determines the group to which each customer to be classified belongs based on the composite nearest neighbor similarity between each data point and other data points, including the following steps:
[0107] Step 301: Obtain a similarity graph based on the composite nearest neighbor similarity between each data point and other data points.
[0108] Each data point to be classified is added to the similarity graph based on the composite nearest neighbor similarity between each data point and other data points. If the composite nearest neighbor similarity between two data points is greater than or equal to the similarity threshold, there is an edge between the two data points. The similarity graph reflects the correlation between the customer data points of each supply chain.
[0109] Step 302: traverse the similarity graph to obtain each connected cluster.
[0110] After all the data points to be classified are added to the similarity graph, the similarity graph is traversed to obtain each connected cluster. Specifically, the breadth-first algorithm can be used to traverse the similarity graph to obtain each connected cluster, including the following steps:
[0111] Step 3021, starting from an unvisited data point in the graph, add it to a queue and mark it as visited.
[0112] Step 3022: Take data points out of the queue in sequence, visit their adjacent data points, add unvisited adjacent data points to the queue, and mark them as visited.
[0113] Step 3023: Repeat step 3022 until there are no unvisited data points in the queue.
[0114] Step 3024: Repeat steps 3021-3023 until there are no unvisited data points in the graph, and each queue is a connected cluster.
[0115] In one possible implementation, after obtaining each connected cluster, the connected clusters in which the number of data points is less than a set number can be deleted, and then the remaining data points are used as a new data point set, and the composite nearest neighbor similarity between each data point in the new data point set and other data points is recalculated to obtain each connected cluster in the similarity graph, until the number of data points in each connected cluster is not less than the set number.
[0116] In the above technical solution, data points in the connected clusters with less than the set number of data points are considered outliers. After clustering is completed, deleting the outliers is equivalent to excluding customer data in the supply chain business data that has no analytical value and will affect the classification results. The data points after deleting the outliers are clustered again, which reduces the error caused by the outliers to the clustering results and makes the clustering results more accurate.
[0117] Step 303: Classify each data point in the connected cluster into the same customer group.
[0118] In the above technical solution, the data points to be classified are clustered into multiple connected clusters based on the composite nearest neighbor similarity between the data points. The data features of the data points in the connected clusters are similar. Therefore, the customers represented by the data points in the same connected cluster are divided into one group. This clustering method is more accurate in the division results of customer groups.
[0119] In the above technical solution, when calculating the nearest neighbor similarity, the influence of the distance between data points on the nearest neighbor similarity is taken into account. When the distance is closer, the nearest neighbor similarity is higher, so that the calculated nearest neighbor similarity is more accurate. In addition, by calculating the composite nearest neighbor similarity, the influence of the multi-degree nearest neighbor relationship of data points on the classification results is taken into account, so that the calculated similarity between data points is more accurate, and then the customer group division results based on the composite nearest neighbor similarity are more accurate. Accurate customer classification can be used for subsequent customer group analysis to help better understand customer needs and preferences, and then provide better products and services. It can also be used for operational activities such as differentiated marketing to provide more refined and personalized services for operational businesses and improve operational efficiency and commercial results.
[0120] Based on the same technical concept, Figure 4 A schematic diagram of a customer group classification device 400 provided in an embodiment of the present application, such as Figure 4 As shown, the device comprises:
[0121] The acquisition module 401 is used to acquire a set of data points corresponding to the customer to be classified; each data point in the set of data points represents multiple feature data of the corresponding customer;
[0122] Processing module 402, for determining, for each data point, the 1 to i degree nearest neighbors of the data point according to the distances between the data point and other data points; wherein the j degree nearest neighbors of the data point are the 1 degree nearest neighbors of each data point in the j-1 degree nearest neighbors of the data point; j is greater than 1 and less than or equal to i, and i is greater than or equal to 2;
[0123] The processing module 402 is further used to determine, for any two data points, the similarity between the data point and another data point in the 1 to i degree nearest neighbor; determine the composite nearest neighbor similarity between the data point and the another data point based on the 1 to i degree nearest neighbor similarity; wherein the j degree nearest neighbor similarity is determined based on the distances between the j degree nearest neighbor of the data point and the same data point in the j degree nearest neighbor of the other data point and the data point and the other data point respectively; the closer the distance, the higher the similarity of the j degree nearest neighbor;
[0124] The classification module 403 is used to determine the group to which each customer to be classified belongs based on the composite nearest neighbor similarity between each data point and other data points.
[0125] In one possible design, the processing module 402, when determining the 1 to i degree nearest neighbors of the data point based on the distances between the data point and other data points, is specifically used to: take the data point as a reference point to determine the distance between the reference point and other data points; select k data points closest to the reference point as the k nearest neighbors of the reference point; take the m nearest neighbors among the k nearest neighbors whose distances to the reference point are less than or equal to a distance threshold as the 1 degree nearest neighbors of the reference point; the distance threshold is determined based on the average distance of the k nearest neighbors of each data point; take the 1 degree nearest neighbor of the reference point as the reference point, and continue to determine the 2 degree nearest neighbors of the data point until the i degree nearest neighbor of the data point is determined.
[0126] In one possible design, the processing module 402, when determining the composite nearest neighbor similarity between the data point and the other data point based on the similarities of the nearest neighbors of degree 1 to i, is specifically used to: add the product of the similarities of the data point and each i-degree nearest neighbor of the other data point and the corresponding weight coefficient to obtain the composite nearest neighbor similarity between the data point and the other data point; wherein the weight coefficient decreases sequentially from degree 1 to i.
[0127] In a possible design, the classification module 403, when determining the group to which each to-be-classified customer belongs based on the composite nearest neighbor similarity between each data point and each other data point, is specifically used to: obtain a similarity graph based on the composite nearest neighbor similarity between each data point and each other data point; wherein, if the composite nearest neighbor similarity between two data points is greater than or equal to a similarity threshold, then there is an edge between the two data points; traverse the similarity graph to obtain each connected cluster; and classify each data point in the connected cluster into the same customer group.
[0128] In a possible design, the classification module 403, before classifying each data point in the connected cluster into the same customer group, is also used to delete the connected clusters in which the number of data points is less than a set number; use the remaining data points as a new data point set, recalculate the composite nearest neighbor similarity between each data point in the new data point set and other data points, and obtain each connected cluster in the similarity graph, until the number of data points in each connected cluster is not less than the set number.
[0129] In one possible design, the processing module 402 determines the similarity of the j-degree nearest neighbors of any two data points by the following method: taking the same data point in the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point as the shared i-degree nearest neighbor of the first data point and the second data point; determining the similarity of the i-degree nearest neighbor of the first data point and the second data point based on a first distance between each shared i-degree nearest neighbor and the first data point and a second distance between the shared i-degree nearest neighbor and the second data point; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbors.
[0130] In one possible design, the processing module 402 determines the similarity of the j-degree nearest neighbors of any two data points by the following method: taking the same data point in the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point as the shared i-degree nearest neighbor of the first data point and the second data point; determining the standard deviation of the distance between each data point in the set of the first data point, the second data point and the shared i-degree nearest neighbor; determining the similarity of the i-degree nearest neighbor of the first data point and the second data point based on the first distance of each shared i-degree nearest neighbor from the first data point, the second distance from the second data point, and the standard deviation between the data points; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbors; the standard deviation between the data points is inversely proportional to the similarity of the i-degree nearest neighbors.
[0131] In a possible design, the acquisition module 401, when acquiring the data point set corresponding to the customer to be classified, is specifically used to obtain the data point set corresponding to the customer to be classified; based on at least one dimension data of the data point set corresponding to the customer to be classified, the data point set corresponding to the customer to be classified is divided into multiple areas; the processing module 402 is also used to execute subsequent steps for the data points in each area.
[0132] Based on the same technical concept, the present application embodiment provides a computing device, such as Figure 5 As shown, it includes at least one processor 501 and a memory 502 connected to the at least one processor. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 For example, the processor 501 and the memory 502 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0133] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501 , and the at least one processor 501 can execute the above-mentioned customer group classification method by executing the instructions stored in the memory 502 .
[0134] The processor 501 is the control center of the computing device, and can use various interfaces and lines to connect various parts of the computer device, and perform resource settings by running or executing instructions stored in the memory 502 and calling data stored in the memory 502.
[0135] Optionally, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.
[0136] The processor 501 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0137] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0138] Based on the same technical concept, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the classification method of customer groups listed in any of the above methods.
[0139] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0140] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0141] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0143] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0144] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for classifying customer groups, characterized in that: The method comprises: Obtaining a set of data points corresponding to the customer to be classified; each data point in the set of data points represents multiple feature data of the corresponding customer; For each data point, determine the 1 to i degree nearest neighbors of the data point according to the distances between the data point and other data points; wherein the j degree nearest neighbors of the data point are the 1 degree nearest neighbors of each data point in the j-1 degree nearest neighbors of the data point; j is greater than 1 and less than or equal to i, and i is greater than or equal to 2; For any two data points, determine the similarity between the data point and the other data point in the 1 to i degree nearest neighbor; determine the composite nearest neighbor similarity between the data point and the other data point based on the 1 to i degree nearest neighbor similarity; wherein the j degree nearest neighbor similarity is determined based on the distances between the j degree nearest neighbor of the data point and the same data point in the j degree nearest neighbor of the other data point and the data point and the other data point respectively; the closer the distance, the higher the similarity of the j degree nearest neighbor; Based on the composite nearest neighbor similarity between each data point and other data points, the group to which each customer to be classified belongs is determined.
2. The method according to claim 1, characterized in that Determining the 1 to i degree nearest neighbors of the data point according to the distances between the data point and other data points includes: Taking the data point as a reference point, determining the distance between the reference point and other data points; Select k data points closest to the reference point as k nearest neighbors of the reference point; m nearest neighbors of the k nearest neighbors whose distances to the reference point are less than or equal to a distance threshold are used as the 1st-degree nearest neighbors of the reference point; the distance threshold is determined based on the average distance of the k nearest neighbors of each data point; The 1st degree nearest neighbor of the reference point is used as the reference point, and the 2nd degree nearest neighbor of the data point is continued to be determined until the i-degree nearest neighbor of the data point is determined.
3. The method according to claim 1, characterized in that Determining the composite nearest neighbor similarity between the data point and the another data point according to the similarities of the nearest neighbors of degree 1 to i includes: The product of the similarity of each i-degree nearest neighbor of the data point and the corresponding weight coefficient is added to obtain the composite nearest neighbor similarity of the data point and the other data point; wherein the weight coefficient decreases from 1 to i degrees.
4. The method according to claim 1, characterized in that: Based on the composite nearest neighbor similarity between each data point and other data points, the group to which each customer to be classified belongs is determined, including: Based on the composite nearest neighbor similarity between each data point and each other data point, a similarity graph is obtained; wherein, if the composite nearest neighbor similarity between two data points is greater than or equal to a similarity threshold, there is an edge between the two data points; Traversing the similarity graph to obtain each connected cluster; Classify each data point in the connected cluster into the same customer group.
5. The method according to claim 4, characterized in that Before classifying the data points in the Unicom cluster into the same customer group, it also includes: Deleting the connected clusters whose number of data points is less than a set number; The remaining data points are taken as a new set of data points, and the composite nearest neighbor similarity between each data point in the new set of data points and other data points is recalculated to obtain each connected cluster in the similarity graph, until the number of data points in each connected cluster is not less than the set number.
6. The method according to any one of claims 1 to 5, characterized in that: The similarity of the j-degree nearest neighbors of any two data points is determined by the following method: The same data point among the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point is used as the shared i-degree nearest neighbor of the first data point and the second data point; The similarity between the i-degree nearest neighbors of the first data point and the second data point is determined based on the first distance between each shared i-degree nearest neighbor and the first data point and the second distance between the shared i-degree nearest neighbor and the second data point; the first distance and the second distance are inversely proportional to the similarity between the i-degree nearest neighbors.
7. The method according to any one of claims 1 to 5, characterized in that: The similarity of the j-degree nearest neighbors of any two data points is determined by the following method: The same data point among the j-degree nearest neighbor of the first data point and the j-degree nearest neighbor of the second data point is used as the shared i-degree nearest neighbor of the first data point and the second data point; Determine the standard deviation of the distance between each data point in the first data point, the second data point and the set of the shared i-degree nearest neighbors; The similarity between the i-degree nearest neighbors of the first data point and the second data point is determined based on the first distance of each shared i-degree nearest neighbor to the first data point, the second distance to the second data point, and the standard deviation between the data points; the first distance and the second distance are inversely proportional to the similarity of the i-degree nearest neighbors; the standard deviation between the data points is inversely proportional to the similarity of the i-degree nearest neighbors.
8. The method according to claim 1, characterized in that The step of obtaining a set of data points corresponding to the customer to be classified includes: Get the data point set corresponding to the customer to be classified; Based on at least one dimension data of the data point set corresponding to the customer to be classified, dividing the data point set corresponding to the customer to be classified into a plurality of regions; Perform the subsequent steps separately for the data points within each region.
9. A device for classifying customer groups, characterized in that: include: An acquisition module, used to acquire a set of data points corresponding to the customer to be classified; each data point in the set of data points represents multiple feature data of the corresponding customer; A processing module, for determining, for each data point, the 1 to i degree nearest neighbors of the data point according to the distances between the data point and other data points; wherein the j degree nearest neighbors of the data point are the 1 degree nearest neighbors of each data point in the j-1 degree nearest neighbors of the data point; j is greater than 1 and less than or equal to i, and i is greater than or equal to 2; The processing module is further used to determine, for any two data points, the similarity between the data point and another data point in the 1 to i degree nearest neighbor; determine the composite nearest neighbor similarity between the data point and the another data point based on the 1 to i degree nearest neighbor similarity; wherein the j degree nearest neighbor similarity is determined based on the distances between the j degree nearest neighbor of the data point and the same data point in the j degree nearest neighbor of the other data point and the data point and the other data point respectively; the closer the distance, the higher the similarity of the j degree nearest neighbor; The classification module is used to determine the group to which each customer to be classified belongs based on the composite nearest neighbor similarity between each data point and other data points.
10. A computing device, characterized in that include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 8 according to the obtained program instructions.
11. A computer-readable storage medium, characterized in that: The method comprises computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the method according to any one of claims 1 to 8 is implemented.
