Continuous feature embedding method for relational data based on clustering and deep neural network
By combining clustering algorithms and deep neural networks in structured data, continuous feature embedding is performed on relational data, which solves the problem of the deep learning model's insufficient ability to embed continuous features and achieves effective use of features and data transformation. .
Patent Information
- Application Number
- CN202210037678.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-13
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-01-13
AI Technical Summary
In the classification task of structured data, deep learning models are weak in embedding continuous features of relational data, resulting in a decline in feature utilization, and existing feature embedding methods cannot effectively solve the problems of dense continuous features and heterogeneous structures.
Adopt a clustering-based method to calculate the importance of continuous features through , combine distance information and bucket index to perform weighted summation to generate a unique Embedding vector.
It effectively solves the problem of reduced utilization ability of continuous feature embedding and data sparsity, makes full use of the associated information of continuous features, converts low-dimensional data into high-dimensional data, protects the importance of features, and improves the generalization ability of the model.
Smart Images

Figure CN114385713B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of structured data, and in particular to a continuous feature embedding method for relational data based on clustering and deep neural networks. Background Art
[0002] Relational data is structured data. Its rows can be regarded as samples in the data, and its columns can be regarded as features of the samples. Due to its efficient data management and display capabilities, relational data is widely used in the medical field (such as patient prediction, death or disease event prediction), financial field (such as customer prediction, credit assessment), and recommendation system (such as click-through rate prediction (CTR)). Among the above businesses, the essence of many businesses is to achieve prediction purposes by classifying samples, that is, the classification of relational data.
[0003] With the development of deep learning, more and more classification models have been proposed and performed well in unstructured fields such as images, audio, and text. However, in structured fields, deep learning has not performed well. In fact, in most classification tasks, decision trees such as XGBoost perform better than deep learning. In the classification task of structured data, relational data is an "unconquered castle" because deep learning faces many challenges, such as dirty data, data imbalance and small data volume, which are the first challenges of deep learning. The deep neural network model that processes relational data is more sensitive to the perturbation of feature values and is not good at processing dense continuous features. This is the second challenge of deep learning. The heterogeneous structure of relational data is the third challenge for deep neural networks, and the fourth challenge is related to feature embedding. Feature embedding is very important in relational data classification tasks based on deep learning. Feature embedding is also called feature representation, feature encoding, feature distribution representation, etc. Its meaning is to map feature values to a certain value or vector. The reason for using feature embedding is that neural networks cannot directly process discrete feature values. The choice of feature embedding technology will have a direct impact on the model, but the feature embedding methods are very wide-ranging, which is the fourth challenge of neural networks.
[0004] For discrete feature embedding, it can be roughly divided into two ways. The first way is pre-processing encoding, such as one-hot encoding and label encoding. For example, flowers have three colors: red, yellow, and blue. Color is a discrete feature for flowers. Label encoding form: red is 1, yellow is 2, and blue is 3. Label encoding will mislead the network model, because in the real world, 1+2=3, but red+yellow! ≠ blue. One-hot encoding form: red is [1,0,0], yellow is [0,1,0], and blue is [0,0,1]. The vector dimension of the one-hot encoding form is equal to the number of features, which may lead to sparse data. For example, everyone has a discrete feature of ethnicity, but there are more than 2,000 ethnic groups in the world, which will cause dimensionality explosion, causing the network to overfit. Another disadvantage of one-hot encoding is that it cannot allow the model to learn the similarity or correlation between categories. The second way is automatic encoding, which updates the encoding parameters as the neural network is trained, such as Embedding. Using Embedding to replace one-hot encoding eliminates the risk of data sparsity, reduces the number of network parameters, and improves the generalization ability of the network. At present, Embedding is still a simple and mature encoding technology.
[0005] However, there is a lack of research on continuous feature embedding, because the embedding of discrete feature values can be directly concatenated with continuous feature values into a large training vector for deep neural network training. However, this simple concatenation method will cause discrete features to be over-represented in the training vector, and each continuous feature only occupies one unit of space in the training vector, resulting in a decrease in the ability of the neural network to utilize continuous features when doing classification. Summary of the invention
[0006] In view of this, the present invention discloses a continuous feature embedding method for relational data based on clustering and deep neural network to solve the above-mentioned problems such as the decline in continuous feature embedding utilization ability and SDB and DBS.
[0007] The technical solution provided by the present invention is specifically a continuous feature embedding method for relational data based on clustering and deep neural network, comprising the following steps:
[0008] The continuous feature embedding method of relational data based on clustering and deep neural network includes the following steps:
[0009] S1: Use the XGBoost toolkit to calculate the importance of each continuous field and obtain the importance ranking of continuous features of relational data;
[0010] S2: Build a bucket divider to automatically formulate discretization rules through the Mean Shift clustering algorithm combined with the K-means clustering algorithm, and discretize the continuous features of relational data;
[0011] S3: The neural network receives the bucket index information generated by the feature discretization by the bucket divider and the distance information from each feature value to the center point of each bucket;
[0012] S4: constructing an Embedding layer of a neural network, which is used to use the bucket index information as a discrete value of a continuous feature and use a neural network to learn an Embedding representation of the bucket index;
[0013] S5: Construct aggregation function: According to the aggregation strategy, use the distance information generated in the bucketing / discretization process and the embedding vector of the bucket index to assign unique embedding vectors to different continuous feature values;
[0014] S6: Concatenate the feature vector or original value of each field into a large training vector, and input it into the fully connected layer and other layers of the neural network in turn for training.
[0015] Furthermore, the Mean Shift clustering algorithm is specifically:
[0016] The d-dimensional space R formed by k samples xi, where i = 1, 2, ... k d In the d-dimensional space R, point x is selected as the initial center point, and point x is the center of the sphere. d Draw a high-dimensional sphere region S with a radius r r (x), there are n sample points falling into this area;
[0017] S r (x) = {y:(yx) T (yx)≤r 2} (1)
[0018] Move point x in the direction of shift and by a distance of ||shift||. When ||shift||≤min_dis, point x stops moving and point selection is completed at one time, where min_dis is a hyperparameter.
[0019]
[0020] The K-means algorithm is specifically:
[0021] There are k samples xi, where i = 1, 2, ... k, and these points are divided into n clusters Ci, where i = 1, 2, ... n), and the goal is to minimize the square error E:
[0022]
[0023] u i It is cluster C i The center of mass.
[0024] Furthermore, the weighted sum of the embedding vectors of distance information and bucket index in S5 is:
[0025]
[0026] k is the number of buckets in a set of bucket embeddings for a field, dis(num,Bn) is the distance from the continuous eigenvalue num to the center point of the nth bucket, and En is the bucket embedding corresponding to the nth bucket.
[0027] Furthermore, the above method also includes: S7: softmax function output, classification; using a cross entropy loss function to measure the current classification result and the expected classification result:
[0028]
[0029] The cross entropy loss function measures the degree of deviation between the current predicted result and the actual result.
[0030] Furthermore, the weights and biases are changed by gradient descent, thereby reducing the above bias values. The following is an algorithm for updating parameters by gradient descent:
[0031]
[0032] Furthermore, the S2 specifically includes:
[0033] S21: Use the Mean Shift algorithm to start clustering, select an initial center point c in the space formed by many eigenvalues of a continuous field, and determine a circular area with a radius of r;
[0034] S22: Calculate the vectors from the center point c to other data points in the region, and find the sum shift of these vectors; the center point c will move L along the direction of shift, and the size of L is the modulus of shift;
[0035] S23: Repeat S21 until L is less than a certain threshold; the point selection is completed once;
[0036] S24: Through the above clustering processes and cluster merging, all the center points are finally determined and MeanShift training is completed;
[0037] S25: Initializing the center point pair K-means;
[0038] S26: Calculate the distance from each eigenvalue to the center point. The eigenvalue is divided into the corresponding cluster if it is closer to the center point.
[0039] S27: Recalculate the mean of each cluster / bucket to update the center point;
[0040] S28: Repeat S26 and S27 until the change range of the center point is less than a certain threshold; bucketing is completed.
[0041] The present invention provides a method for embedding continuous features of relational data based on clustering and deep neural networks. First, unsupervised machine learning (clustering) is used to obtain the distribution of continuous features, and then supervised deep learning is performed in combination with the distribution information of continuous features to achieve automatic embedding of continuous features. The weighted summation strategy of bucket embedding and distance ratio can allow similar continuous features to have similar Embedding representations. According to the distance from the feature value to the center point of the bucket, the Embedding representation of each bucket is weighted and summed, which can make full use of the association information between each bucket and the association information between the numerical feature and each bucket. This not only eliminates the SBD and DBS problems, but also converts low-dimensional data into high-dimensional data while ensuring data continuity, thereby protecting the importance of continuous features.
[0042] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 The traditional training vector synthesis method provided by the disclosed embodiment of the present invention;
[0046] Figure 2 A schematic diagram of the structure of a continuous feature embedding model for relational data based on clustering and deep neural networks provided in an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of capital-gain field bucketing provided in the embodiment disclosed in the present invention;
[0048] Figure 4 A schematic diagram of a polymerization process provided for an embodiment of the present invention;
[0049] Figure 5 A schematic diagram of the initial center point used in the disclosed embodiment of the present invention;
[0050] Figure 6 A schematic diagram of calculating moving distance and direction provided in an embodiment disclosed in the present invention;
[0051] Figure 7 A schematic diagram of gradually moving a center point through iteration provided in an embodiment disclosed in the present invention;
[0052] Figure 8 A schematic diagram of the completion of Mean Shift training provided in the disclosed embodiment of the present invention;
[0053] Fig. 9 A schematic diagram of bucketing completion provided in the embodiment disclosed in the present invention;
[0054] Fig.10 A schematic diagram of the connection between the bucket divider and the neural network provided in the embodiment disclosed in the present invention;
[0055] Fig.11 The minimum distance strategy Embedding image provided by the disclosed embodiment of the present invention;
[0056] Fig.12 The mean strategy Embedding image of the Adult main bucket embedding provided by the embodiment disclosed in the present invention;
[0057] Fig.13 The weighted sum strategy of the Adult bucket embedding and distance ratio Embedding image provided by the disclosed embodiment of the present invention;
[0058] Fig.14 The f1-score statistics of the three strategies for the Adult dataset provided by the disclosed embodiment of the present invention;
[0059] Fig.15 The Csgo minimum distance strategy Embedding image provided by the disclosed embodiment of the present invention;
[0060] Fig.16 The mean strategy Embedding image of the Csgo main bucket embedding provided by the embodiment disclosed in the present invention;
[0061] Fig.17 The weighted summation strategy of Csgo bucket embedding and distance ratio Embedding image provided by the embodiment disclosed in the present invention;
[0062] Fig.18The f1-score statistics of the three strategies of the Csgo dataset provided in the embodiment disclosed in the present invention;
[0063] Fig.19 A schematic diagram of the bucket field changes of the Adult data set provided in the embodiment disclosed in the present invention;
[0064] Fig. 20 A schematic diagram of the bandwidth and classification performance changes of the Adult dataset provided in the embodiment disclosed in the present invention. DETAILED DESCRIPTION
[0065] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present invention. Instead, they are merely examples of systems consistent with some aspects of the present invention as detailed in the appended claims.
[0066] In the prior art, the embedding of continuous features can be roughly divided into two ways. The first is to discretize the continuous features first, and then use the discrete feature embedding technology to achieve continuous feature embedding. Among them, there are many strategies for discretizing continuous features. 1. Bucketing: Divide the continuous feature values into several buckets, and the bucket index can be regarded as a discrete feature. The advantage of bucketing is that it can make the data look simpler and easier to understand. For example, the age of children can be divided into infants, toddlers, young people, etc. Equal-width bucketing is one of the classic discretization strategies. 2. Decision tree: Continuous features are used as input, and the index of the leaf node can be used as a discrete feature. 3. Clustering algorithm: Continuous features are divided into different clusters through various clustering algorithms, and the cluster index can be regarded as a discrete feature. However, the above embedding method will cause problems with sdb and dbs.
[0067] The second way to embed continuous features is to directly use the expressive power of deep neural networks to embed continuous features. 1. Field Embedding: Assign an Embedding vector to each continuous column. The values of each column share the same Embedding vector. The embedding of continuous features is the product of the feature and the Embedding vector. Experiments show that this method does not bring much improvement to the network. 2. Field-wise: The continuous features of each field share a neural network, and each feature is used as input to get the embedding of the feature. This method can make the embeddings in the same field more similar, but it still does not solve the sdb and dbs problems. 3. AutoDis: It is a model that focuses most of its attention on the embedding of continuous features. It assigns a set of Embedding vectors to each continuous field, uses a neural network to obtain a set of probabilities for each Embedding vector corresponding to a certain continuous feature, and uses the idea of weighted summation to obtain the embedding of continuous features. This method effectively solves the sbd and dbs problems, but the number of each set of Embedding vectors is a hyperparameter for the neural network, and the parameters cannot be set according to the distribution of continuous features.
[0068] like Figure 1 As shown in the figure, it is a traditional way to synthesize training vectors; suppose that the data set used to train the network consists of S instances (C1, C2, N1, N2, y), where y is the label, C1 and C2 are discrete values of discrete fields, and N1 and N2 are continuous values of continuous fields. C1 and C2 are represented as four-dimensional vectors in the Embedding layer, and N1 and N2 still keep their original values in the neural network. In the training vector, C1 and C2 occupy a total of eight units of space, while N1 and N2 each occupy one unit of space, which will cause C1 and C2 to be over-represented, reducing the ability of the neural network to utilize N1 and N2 when doing classification. Therefore, it is necessary to propose a numerical feature embedding method.
[0069] In view of the above specific problems, this embodiment provides a continuous feature embedding method for relational data based on clustering and deep neural network; comprising the following steps:
[0070] S1: Use the XGBoost toolkit to calculate the importance of each continuous field and obtain the importance ranking of continuous features of relational data;
[0071] S2: Build a bucketizer that can automatically formulate bucketing rules (discretization rules) by using the Mean Shift clustering algorithm combined with the K-means clustering algorithm, and bucket the continuous features of relational data (feature discretization);
[0072] S3: The neural network receives the bucket index information generated by the feature discretization by the bucket divider and the distance information from each feature value to the center point of each bucket;
[0073] S4: constructing an Embedding layer of a neural network, which is used to use the bucket index information as a discrete value of a continuous feature and use a neural network to learn an Embedding representation of the bucket index;
[0074] In the Embedding layer of the neural network, learn the Embedding vector of each bucket index information;
[0075] S5: Construct aggregation function: According to the aggregation strategy, use the distance information generated in the bucketing / discretization process and the embedding vector of the bucket index to assign unique embedding vectors to different continuous feature values;
[0076] S6: concatenate the feature vector or original value of each field into a large training vector, and input it into the fully connected layer and other layers of the neural network in turn for training; Figure 2 This embedding method can transform low-dimensional data of continuous fields into high-dimensional continuous data. The more similar the eigenvalues are, the more similar the embeddings of the features are, that is, the closer the embedding vectors are.
[0077] After the continuous features are bucketed (discretized), the corresponding discrete eigenvalues are not bucket indices, but the distance information between the bucket index's embedding vector and the bucketizer is used to assign unique embedding vectors to different eigenvalues through the idea of weighted summation. The purpose of this step is to avoid the sdb and dbs problems from interfering with the neural network.
[0078] The definition and origin of the boundary value embedding problem (sdb and dbs problem) are as follows: When two values in a field are very close, but are divided into two buckets, the two values will be converted into two different embedding vectors, thus forming the sdb problem. When two values in a field are very different, but are divided into the same bucket, the two values will be converted into the same embedding vector, thus forming the dbs problem, such as Figure 3 shown. Figure 3Bucket visualization of 46,000 continuous eigenvalues in the capitalgain field of the adult dataset. The horizontal axis is the bucket into which the field data is divided, and the vertical axis is the continuous eigenvalue. Points with the same horizontal axis will be converted into the same embedding vector. Take three points, point 1: the point with the largest eigenvalue in the first bucket, point 2: the point with the smallest eigenvalue in the first bucket, point 3: the point with the largest eigenvalue in the second bucket. The eigenvalue of point 1 is much larger than that of point 2, and the eigenvalue of point 2 is similar to that of point 3. Points 1 and 2 are represented by the same vector, which forms a dbs problem, and points 2 and 3 are represented by different vectors, which forms an sdb problem.
[0079] In order to allow the bucketizer to capture the distribution information of continuous features and automatically formulate bucketing rules, this implementation adopts the Mean Shift algorithm, which can automatically determine the location of the center point and the location of the cluster through iteration according to the density of the sample, and the clustering effect can achieve the optimal solution. The number of center points of the K-means algorithm is a hyperparameter, and the location of the center point is also randomly generated, which makes the clustering effect of the K-means algorithm fluctuate and can only achieve a local optimal solution. Using the center point obtained by the MeanShift algorithm to initialize the K-means algorithm can improve the clustering ability and efficiency of the K-means algorithm, and can also use the K-means algorithm to obtain distance information for use in deep neural networks.
[0080] The above Mean Shift algorithm:
[0081] The d-dimensional space R formed by k samples xi, where i = 1, 2, ... k d In the d-dimensional space R, point x is selected as the initial center point, and point x is the center of the sphere. d A high-dimensional spherical region Sr(x) with a radius of r is drawn in the figure, and there are n sample points falling into this region;
[0082] S r (x) = {y:(yx) T (yx)≤r 2} (1)
[0083] Move point x in the direction of shift and by a distance of ||shift||. When ||shift||≤min_dis, point x stops moving and point selection is completed at one time, where min_dis is a hyperparameter.
[0084]
[0085] The K-means algorithm is specifically:
[0086] There are k samples xi , where i = 1, 2, ... k, divide these points into n clusters C i , where i = 1, 2, ... n), the goal is to minimize the square error E:
[0087]
[0088] u i It is cluster C i The center of mass.
[0089] This implementation also involves a set of bucket embeddings for continuous fields. The continuous feature values of structured data often present multi-peak distribution, so the number of buckets (bucketing rules) for each field should be determined by the continuous feature distribution. A set of bucket embeddings is assigned to a certain continuous field. The distance between bucket embeddings hides the degree of association between each cluster (bucket) divided according to the feature value distribution. Its essence is to use embedding vectors to represent the distribution information of feature values.
[0090] E Bucket = x·e
[0091] x is the matrix composed of one-hot vectors corresponding to each bucket, e is the embedding matrix of the continuous field, e∈Rk×d, where k is the number of buckets of the continuous field, and d is the dimension of the embedding vector. The above formula can be used to obtain a set of bucket embeddings for a continuous field.
[0092] The above approach helps the neural network understand and learn numerical features, but the downside is that it will cause sdb and dbs problems. Therefore, if you want to make full use of Bucket embedding, you need to formulate a reasonable aggregation strategy in the aggregation function to eliminate the sdb and dbs problems.
[0093] The weighted sum of bucket embedding and distance ratio in S5 above:
[0094]
[0095] k is the number of buckets in a set of bucket embeddings for a field, dis(num,Bn) is the distance from the continuous feature value num to the center point of the nth bucket, and En is the bucket embedding corresponding to the nth bucket. The process is as follows Figure 4As shown. Assume there is a feature value num, and the bucket divider contains 3 buckets. The three points above, to the left, and below num are the center points of the three buckets. The distances from num to the three points are da, db, and dc, respectively. EmbeddingA, EmbeddingB, and EmbeddingC are the embeddings of the three buckets. The unique Embedding vector of num is obtained by weighted summing the distance and Embedding through the aggregation function.
[0096] This implementation scheme also includes: S7: softmax function output, classification; for the result of Softmax output, the probability of correct classification should be increased as much as possible, and the cross entropy loss function can be used to measure the current classification result and our expected classification result:
[0097]
[0098] The cross entropy loss function measures the degree of deviation between the current prediction result and the actual result. At the same time, the cross entropy loss function has better smoothness than the ordinary mean square error loss, which is convenient for gradient descent calculation and prevents the function from falling into the local optimum.
[0099] The cross entropy function measures the deviation between the classification result we output and the actual result. We can then use gradient descent to change the weight and deviation, thereby reducing the deviation value. This change can be determined by the positive or negative derivative to determine the parameter change. The following is an algorithm for updating parameters through gradient descent:
[0100]
[0101] Specifically, this implementation scheme includes the following steps:
[0102] (1) Use the XGBoost toolkit to calculate the importance of each field and obtain the priority of the field bucket.
[0103] (2) Use the Mean Shift algorithm to start clustering. Select an initial center point c in the space formed by many eigenvalues of a continuous field and determine a circular area with a radius of r, such as Figure 5 As shown;
[0104] (3) Calculate the vectors from the center point c to other data points in the region and find the sum of these vectors, shift. The center point c will move L along the direction of shift, and the size of L is the modulus of shift, such as Figure 6 As shown;
[0105] (4) Repeat step 2 until L is less than a certain threshold, such as Figure 7 As shown;
[0106] (5) Site selection is completed in one step;
[0107] (6) Through the above clustering processes and cluster merging, all the center points are finally determined, such as Figure 8 As shown;
[0108] (7) Initialize K-means with these center points;
[0109] (8) Calculate the distance from each eigenvalue to the center point. The eigenvalue is assigned to the corresponding cluster if it is closer to the center point.
[0110] (9) Recalculate the mean of each cluster (bucket) to update the center point;
[0111] (10) Repeat steps 8 and 9 until the change in the center point is less than a certain threshold;
[0112] (11) Bucketing is completed, such as Fig. 9 As shown;
[0113] (12) Pass the bucket information to the neural network as follows Fig.10 As shown;
[0114] (13) Bucket index learns vector representation in the Embedding layer and assigns unique feature vectors to different continuous features through aggregation functions;
[0115] (14) Concatenate the continuous feature embedding, other continuous feature values, and discrete feature embedding into a large training vector and input it into the fully connected layer to start training;
[0116] (15) Softmax function output for classification;
[0117]
[0118]
[0119]
[0120] Finally, observe the Softmax output results.
[0121] The present invention will be further described in the following examples, but the present invention is not limited to these examples.
[0122] Example 1
[0123] 1) Find real-world relational datasets on kaggle that have both discrete fields and continuous fields. This embodiment uses the Adult, Csgo, and Bank real-world datasets. The Adult dataset predicts whether an individual's annual income is greater than 50,000 US dollars. Each sample has 14 fields, including age, education, gender information, etc. It has 39,072 training samples and 9,768 test samples. The Csgo dataset predicts which of the two teams can win. Each sample has 97 fields, including maps, scores, character health value information, etc. It has 97,928 training samples and 24,482 test samples. The Bank dataset predicts whether a customer purchases a financial product. Each sample has 21 fields, including work, education, marriage information, etc. It has 32,950 training samples and 8,237 test samples.
[0124] 2) The baseline for the neural network is the Rossmann competition network model on Kaggel. The neural network in our method is also based on this model with an aggregation function added.
[0125] 3) Write the model code.
[0126] 4) In order to prove the effectiveness of the aggregation strategy of the present invention, two other aggregation strategies are proposed as follows:
[0127] Minimum distance strategy: The embedding vector corresponding to a continuous eigenvalue is the bucket embedding corresponding to the bucket closest to the eigenvalue.
[0128] e num =E i bucket (7)
[0129] i is the center point of the i-th bucket that is closest to the eigenvalue num, E i bucket is the bucket embedding of the i-th bucket. The essence of this strategy is to discretize continuous features through clustering. This strategy cannot solve the sdb and dbs problems.
[0130] Mean of main bucket embeddings: The Embedding vector corresponding to a continuous eigenvalue is the mean of the bucket embeddings corresponding to the K buckets closest to the eigenvalue.
[0131] e num =(E num1 bucket +E num2 bucket +……+E numK bucket ) / k (8)
[0132] E numk bucket is the bucket embedding of the Kth bucket closest to the feature value num. This strategy will cause the loss of feature distribution information, making the network unable to fully understand the distribution of continuous features, which will restrict the improvement of network performance and add a hyperparameter K to the network.
[0133] 5) Comparison of continuous feature embedding methods: DeepGBM, equal-width bucketing strategy + Embedding (EE) and traditional Embedding classification method (TE) are compared with our method. The Accuracy, Recall, Precision and F1 Score of the classification model are obtained, and the impact of each continuous feature embedding method on the classification model is analyzed through four indicators.
[0134] 6) Analysis of aggregation functions and embeddings: We take different feature values from the most important fields in the adult training set and the Csgo training set, and obtain the embedding vector of each feature value through three aggregation strategies (minimum distance strategy, mean strategy of main bucket embedding, and weighted sum strategy of bucket embedding and distance ratio). These embedding vectors are mapped to a 2D graph using the t-sne dimensionality reduction technique, and some conclusions are obtained by combining the f1-score statistics of the three aggregation strategies.
[0135] 7) Explore the impact of the number of bucketed fields on the classification model: Observe the changes in the classification results by changing the number of processed fields in the order of field importance from high to low, with the number range being {0, 1, 2, 3, 4, 5}.
[0136] 8) Explore the impact of bandwidth on the classification model: Bandwidth directly affects the clustering effect of meanshift. In order to explore the impact of bandwidth on the final classification performance, we observe the performance of the model by changing the bandwidth.
[0137] Comparison results of continuous feature embedding methods:
[0138] In the Adult dataset, DeepGBM performs best in terms of accuracy, while XGBoost performs best in terms of precision, recall, and f1-score. AutoCE improves by 0.002, 0.004, -0.003, and 0.012, respectively, compared with the above best results.
[0139] In the Csgo dataset, traditional entity embeddings performed best in terms of accuracy, precision, and f1-score, and the equal-width bucketing strategy + traditional entity embeddings performed best in terms of recall. AutoCE improved by 0.001, 0.004, 0.03, and 0.004 respectively compared with the above best results.
[0140] In the Bank dataset, DeepGBM performs best in terms of accuracy, while XGBoost performs best in terms of precision, recall, and f1-score. AutoCE improves by 0.005, 0.002, 0.018, and 0.010 respectively compared with the above best results.
[0141] Overall, the equal-width bucketing strategy did not improve network performance. During the bucketing process, its simple discretization rule made the data simpler and easier to understand, but it destroyed the continuity of the data and restricted the classification ability of the neural network. Because the bucketing rule is (max-min) / k, max and min are the maximum and minimum values of the continuous feature, so the value of (max-min) is unchanged. k is the number of buckets. When k increases, the number of boundary values increases due to the increase in the number of buckets, which aggravates the sdb problem. When k decreases, the range of the eigenvalues in the bucket increases due to the increase in the width of the bucket. The eigenvalues with large differences will be represented by the same vector, which aggravates the dbs problem.
[0142] Table 1 Classification results of Adult dataset
[0143] Accuracy Precision Recall F1-score TE 0.829 0.659 0.726 0.691 EE 0.832 0.756 0.476 0.584 XGBoost 0.815 <![CDATA[ 0.804 ]]> <![CDATA[ 0.830 ]]> <![CDATA[ 0.805 ]]> DeepGBM <![CDATA[ 0.872 ]]> 0.775 0.657 0.711 AutoCE 0.874 0.808 0.827 0.817
Claims
1. A continuous feature embedding method for relational data based on clustering and deep neural network, characterized in that: The steps include: S1: Use the XGBoost toolkit to calculate the importance of each continuous field and obtain the importance ranking of continuous features of relational data; S2: Build a bucket divider to automatically formulate discretization rules through the Mean Shift clustering algorithm combined with the K-means clustering algorithm, and discretize the continuous features of relational data; S3: The neural network receives the bucket index information generated by the feature discretization by the bucket divider and the distance information from each feature value to the center point of each bucket; S4: constructing an Embedding layer of a neural network, which is used to use the bucket index information as a discrete value of a continuous feature and use a neural network to learn an Embedding representation of the bucket index; S5: Construct aggregation function: According to the aggregation strategy, use the distance information generated in the bucketing / discretization process and the embedding vector of the bucket index to assign unique embedding vectors to different continuous feature values; S6: concatenate the feature vector or original value of each field into a large training vector, and input it into other layers of the neural network in turn for training; The Mean Shift clustering algorithm is specifically: The d-dimensional space R formed by k samples xi, where i = 1, 2, ... k d In the d-dimensional space R, point x is selected as the initial center point, and point x is the center of the sphere. d Draw a high-dimensional sphere region S with a radius r r (x), there are n sample points falling into this area; S r (x)={y:(yx) T (yx)≤r 2 } (1) Move point x in the direction of shift and by a distance of ||shift||. When ||shift||≤min_dis, point x stops moving and point selection is completed at one time, where min_dis is a hyperparameter. The K-means algorithm is specifically: There are k samples xi, where i = 1, 2, ... k, and these points are divided into n clusters Ci, where i = 1, 2, ... n), and the goal is to minimize the square error E: u i It is cluster C i The centroid of Weighted sum of embedding vectors of distance information and bucket index in S5: k is the number of buckets in a set of bucket embeddings for a field, dis(num,Bn) is the distance from the continuous feature value num to the center point of the nth bucket, and En is the bucket embedding corresponding to the nth bucket; Also includes: S7: softmax function output for classification; using cross entropy loss function to measure the current classification result and the expected classification result: The cross entropy loss function measures the degree of deviation between the current prediction result and the actual result; The weights and biases are changed by gradient descent, thereby reducing the above bias values. The following is the algorithm for updating parameters by gradient descent: The S2 specifically includes: S21: Use the Mean Shift algorithm to start clustering, select an initial center point c in the space formed by many eigenvalues of a continuous field, and determine a circular area with a radius of r; S22: Calculate the vectors from the center point c to other data points in the region, and find the sum shift of these vectors; the center point c will move L along the direction of shift, and the size of L is the modulus of shift; S23: Repeat S21 until L is less than a certain threshold; one point selection is completed; S24: Through the above clustering processes and cluster merging, all the center points are finally determined and Mean Shift training is completed; S25: Initializing the center point pair K-means; S26: Calculate the distance from each eigenvalue to the center point. The eigenvalue is divided into the corresponding cluster if it is closer to the center point. S27: Recalculate the mean of each cluster / bucket to update the center point; S28: Repeat S26 and S27 until the change range of the center point is less than a certain threshold; bucketing is completed.
