Heterogeneous table data classification method based on multi-granularity and contrast learning
The high-quality positive and negative sample pairs are constructed through global and local multi-grained comparison learning methods, which solves the problem of inaccurate classification of tabular data, improves the robustness and prediction accuracy of the model, and utilizes the complex relationship patterns in tabular data.
Patent Information
- Application Number
- CN202411099686.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-11-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art ignores the subtle differences between positive and negative sample pairs in the field of tabular data, resulting in inaccurate classification of heterogeneous tabular data. Traditional methods focus more on model architecture and loss function design and ignore the complex relationship between samples.
Using global and local multi-grained comparison learning method, the features of heterogeneous table data are extracted, and the subset of features are randomly divided for clustering, high-quality positive and negative sample pairs are constructed, and the encoder and decoder networks are optimized through comparison learning to enhance The robustness of the model.
Effectively train the model to understand the complex relationships in the tabular data, improve the accuracy of classification prediction, and increase the robustness of the model, making full use of the sample relationship model under the multi-grained size of global and local features.
Smart Images

Figure CN119004209A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of table data processing, and in particular relates to a heterogeneous table data classification method based on multi-granularity and contrastive learning. Background Art
[0002] Contrastive learning has become a key branch in the field of modern artificial intelligence, often performing well in areas such as computer vision and natural language processing, and its performance is often better than or comparable to that of supervised learning methods.
[0003] The core of contrastive learning lies in creating a discriminative embedding space, which is usually achieved by enhancing the similarity of positive pairs and emphasizing the dissimilarity of negative pairs. Positive pairs are usually different augmented views of the same sample, while negative pairs consist of different samples. However, the construction of different views involves domain-specific data augmentation techniques, such as rotation, jigsaw puzzles in the image domain, and masked labels in natural language processing. Introducing these perturbations can not only strengthen the similarity signal, but also emphasize the differences between different samples, thereby better training the model.
[0004] Although there are methods on contrastive learning in the field of tabular data, the focus is mainly on the invention of model architecture and loss function design, while less attention is paid to the generation of positive and negative sample pairs. Current methods usually destroy some features of samples to create positive sample pairs, and use different samples as negative pairs, usually ignoring the interactions between different samples. Summary of the invention
[0005] In order to solve the problem of inaccurate classification of existing heterogeneous tabular data, the present invention application proposes a heterogeneous tabular data classification method based on multi-granularity and contrastive learning, including: obtaining heterogeneous tabular data to be detected, and inputting the data into a trained encoder network f and a classifier network h in sequence, wherein the classifier network outputs a classification result of a specific label;
[0006] The training process of the encoder network f and the classifier network h includes:
[0007] Obtain a first training sample set, which is derived from an open source heterogeneous table data set, and the samples in the first training sample set are each row of data in the heterogeneous table data;
[0008] Extract the features of each column of data in the sample to obtain Boolean features fb, category features fc and numerical features fu, decompose and merge them to obtain a global feature set;
[0009] The global feature set is randomly divided into k mutually exclusive feature subsets, samples are clustered under all feature subsets, and positive and negative sample pairs of each sample are constructed based on the clustering results;
[0010] Input the positive and negative sample pairs into the encoder network f, and after encoding, input them into the decoder network g for decoding, respectively obtain feature representations of the positive and negative sample pairs, calculate their contrast loss, and iteratively optimize the encoder network f and the decoder network g according to the contrast loss;
[0011] Obtaining a second training sample set with specific labels, which is derived from a data set related to the heterogeneous tabular data to be detected;
[0012] The second training sample set is input into the trained encoder network f to obtain the feature representation of the sample set, which is then input into the classifier network h to predict a specific label value. The classification loss is calculated based on the predicted label value and the true label value, and the classifier is iteratively optimized based on the classification loss until the classification loss function converges.
[0013] Beneficial effects of the present invention: The present invention focuses on the method of constructing positive and negative pairs of samples. Through the global and local multi-granularity contrastive learning method, by randomly dividing feature subsets and implementing strategic sample clustering, contrastive learning can effectively train to understand the complex relationship between samples in the tabular data set, improve classification prediction accuracy, and in addition, the method of constructing positive and negative sample pairs can increase the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a schematic diagram of a flow chart of an embodiment of the present invention;
[0015] Figure 2 A schematic diagram of the steps of network training in an embodiment of the present invention;
[0016] Figure 3 Schematic diagram of the process of local and global multi-granularity comparative learning in an embodiment of the present invention;
[0017] Figure 4 Schematic diagram of the pre-training and downstream classification task fine-tuning process in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The terms "first", "second", "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances. This is just a way of distinguishing objects with the same attributes when describing the embodiments of this application.
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] Despite significant progress in machine learning for image and natural language processing in the past, many key industries, including financial services, healthcare, and logistics, still rely heavily on data in structured tabular formats. Traditional methods, especially in the field of tabular data, tend to explore model architecture and loss function design, but often ignore the subtle differences between positive and negative sample pairs. Heterogeneous tabular data comes from structured tabular data in various fields of the real world that meet feature variables including classification, numbers, binary, and text. These structured tabular data may or may not have labels, and traditional supervised learning methods cannot use these unlabeled tabular data, resulting in a large amount of data waste. When creating positive and negative sample pairs in contrastive learning, if each sample is divided into several parts by column, and the parts from the same category are used as positive samples, this setting does not fully utilize the potential relationship pattern between samples at multiple granularities of global and local features, which is not conducive to the robustness of the model and the effect may not be ideal.
[0021] In order to solve this problem, the present invention introduces a global and local multi-granularity contrastive learning method, which draws on the contrastive learning method in the image field, and applies it to the field of heterogeneous structured data. In the field of tabular data, this invariance ensures that when certain positive features are disturbed or modified, the anchor point and the positive sample can still express basically the same semantic information.
[0022] Figure 1 Schematic diagram of a flow chart of an embodiment of the present invention. Figure 1 In the embodiment of the present invention, there are two stages of network training. In the first training stage, the first training sample set is used to process the data and construct positive and negative sample pairs. The positive and negative sample pairs are used to train the encoder network f and the decoder network g by contrastive learning. In the second training stage, the second training sample set is used to input the trained encoder network f to obtain its feature representation, and the classifier network h is trained by the feature representation. In the test stage, the heterogeneous table data to be tested is obtained, and the data is sequentially input into the trained encoder network f for encoding, and the encoded results are input into the trained classifier network h, and the classifier network outputs the classification results of specific labels.
[0023] Figure 2Schematic diagram of the flow of network training steps in an embodiment of the present invention.
[0024] The embodiment of the present invention proposes a heterogeneous table data classification method based on multi-granularity and contrastive learning. Figure 1 , 2 As shown, the method includes: obtaining heterogeneous table data to be detected, and inputting the data into the trained encoder network f and classifier network h in sequence, wherein the classifier network outputs a classification result of a specific label;
[0025] The training process of the encoder network f and the classifier network h includes:
[0026] First training phase:
[0027] S1: Obtain a first training sample set, which is derived from an open source heterogeneous table data set. The samples in the first training sample set are each row of data in the heterogeneous table data;
[0028] S2: Extract the features of each column of data in the sample to obtain Boolean features f b , category feature f c and numerical features f u , perform feature decomposition and merging to obtain a global feature set;
[0029] S3: Randomly divide the global feature set into k mutually exclusive feature subsets, cluster the samples under all feature subsets, and construct positive and negative sample pairs for each sample based on the clustering results;
[0030] S4: inputting the positive and negative sample pairs into the encoder network f, and then inputting them into the decoder network g for decoding, respectively obtaining feature representations of the positive and negative sample pairs, calculating their contrast loss, and iteratively optimizing the encoder network f and the decoder network g according to the contrast loss;
[0031] Second training phase:
[0032] S5: obtaining a second training sample set with specific labels, which is derived from a specific data set related to the heterogeneous tabular data to be detected;
[0033] S6: Input the second training sample set into the trained encoder network f to obtain the feature representation of the sample set, input it into the classifier network h to predict a specific label value, calculate the classification loss according to the predicted label value and the true label value, and iteratively optimize the classifier according to the classification loss until the classification loss function converges.
[0034] In some embodiments, heterogeneous tabular data is structured electronic table data including multiple data types. The data types of heterogeneous tabular data include categorical, numeric, binary, and text. Heterogeneous tabular data is the most common form of data and is ubiquitous in the medical field, such as medical diagnosis based on patient medical history.
[0035] In S1, an open source heterogeneous table data training sample set is obtained as a first training sample set, such as an open source medical data table data set.
[0036] Heterogeneous tabular data are usually stored in relational databases in the form of tables or spreadsheets, where rows represent data samples and columns represent feature variables of different data types, including categorical, numeric, binary, and text. Table 1 shows an example of anemia dataset, and its values are simulated values.
[0037] Table 1 Examples of unlabeled anemia dataset
[0038] age gender trouble breathing Shortness of breath Chest tightness Hemoglobin concentration 19 male yes yes no High 25 female no no yes normal
[0039] Table 1 shows the public anemia prediction dataset (without labels) on the Kaggle website, where the column values are simulated values. Open source platforms such as Kaggle, OpenML, and UCI websites provide medical data tables. A large number of medical data tables are unlabeled, and only a small number of them are labeled after being annotated. In a large number of medical table data, each row represents the information of a patient after a certain test, including name, age, gender, symptoms, and test results; each column is a collection of specific data, for example, the age column represents the age data set of different patients.
[0040] In the embodiment of the present invention, each row of heterogeneous table data is regarded as a sample, and the sample set is represented as D. Among them, x i represents the i-th sample, x i Specifically, it is the i-th row of data in the heterogeneous table data, i represents the sequence number, i∈[1,N], and N represents the total number of samples, i.e., the number of rows. After labeling, the sample set with labels is represented as D'. Among them, x i represents the i-th sample, y i represents the i-th sample x i The corresponding label. For sample x i Extracting features means extracting features from each column of the i-th row in the heterogeneous table data to obtain its feature set F, where F = {f1, f2, ..., f d}, f d Represents the characteristics of the data in the dth column of the i-th row in heterogeneous table data.
[0041] For example, the first training sample set in the embodiment of the present invention is derived from: collecting medical table data from an open source data platform; extracting small batches of rows (which may be labeled or unlabeled) from different medical data tables.
[0042] In some embodiments, before extracting the features of each column of data in the first training sample set (ie, step S2), the method further includes:
[0043] Determine the type of each column of data in the sample, which includes categorical data, numerical data, and binary data;
[0044] Preprocess each column of data in the sample, including:
[0045] The minimum-maximum standardization method is used to standardize numerical data;
[0046] Perform hot encoding on the categorized data to obtain the category word vector;
[0047] Binarize binary data to obtain a Boolean vector.
[0048] For example, for categorical data, for example, if the column name is "gender" and one of the rows is "** concentration" ("high"), the column name is directly concatenated with it, and "high" becomes "** concentration high"; for numerical data, for example, if the column name is "age" and one of the rows is "19", the column name is first segmented and then encoded into a word vector, and then the specific value and the word vector are multiplied element by element; for binary data, for example, if the column name is "chest tightness" and one of the rows is "yes", the column name is first segmented and then encoded into a word vector, and then "yes" or "no" is converted to 1 or 0, and whether to retain this word vector is determined based on whether the specific feature value is 1 or 0. If it is 1, it is directly retained; if it is 0, this feature is not added to the subsequent encoding.
[0049] For example, the encoder network f, decoder network g and classifier network h in the present invention can adopt the existing Transformer network framework, and the preprocessing of each column of data in the sample can be completed in the embedding layer (embedding) of the Transformer to convert the data into word vectors; the encoder network f and the decoder network g have multi-head attention modules, which can learn the intrinsic correlation and contextual information in the data and extract the feature representation of the data; the classifier network h can be an MLP to output the classification result.
[0050] In some embodiments, in S2, feature decomposition and merging are performed, which specifically includes:
[0051] S201: From the character perspective, according to the length of the feature name, the Boolean feature f b and the category feature f c Split into l features of the same length as the feature name, and then add two features, namely ":" and "value", to obtain the split Boolean feature set F b and the category feature set F c .
[0052] S202: From the character perspective, according to the length of the feature name, the numerical feature f u Split into l features with the same length as the feature name, and obtain the numerical feature set F after splitting u .
[0053] S203: The split Boolean feature set F b , category feature set F c and the numerical feature set F u Merge into a global feature set F' Suppose there are M global feature sets, which can be expressed as: F' = F b ∪F c ∪F u .
[0054] For example, in Table 1, the numerical feature "age" can be split into two features "year" and "age", and the Boolean feature "shortness of breath" can be split into four features "breath", "shortness", ":" and "value". After the above feature decomposition process, the number of features can be increased, which is conducive to representing samples from different feature granularities.
[0055] Figure 3 Schematic diagram of the process of local and global multi-granularity comparative learning in an embodiment of the present invention. Figure 3 In the equation, f1′, f2′…f m ′ represents the features after splitting, f1′ is “year”, f2′ is “age”, f3′ is “qi”, f4′ is “promote”…
[0056] Reference Figure 2 As shown, in S3, the global feature set is randomly divided into multiple mutually exclusive feature subsets, such as f1′ "year" and f3′ "air" as a subset. Ensure that each subset contains different types of mixed features to maintain data diversity. Specifically:
[0057] For each batch of samples, the global feature set F′ is randomly divided into K non-overlapping subsets F1, F2, ..., F k , so that And for every pair (j1,j2) Then, according to each feature subset F jClustering is performed, and the obtained cluster group is represented as G = {G1, G2, ..., G k}, where G j is the clustering result of j feature subsets. j The i-th group in is represented as for The cluster centers of all x in are expressed as
[0058] In some embodiments, in S4, a K-Means clustering algorithm is used to cluster the feature subsets. Specifically:
[0059] On each feature subset, the K-Means clustering algorithm is used to identify potential patterns in the samples, and the optimal K value is determined by the elbow algorithm, that is, the point where the rate of decrease of the sum of squares (SSE) within the cluster decreases sharply in the K-Means clustering. The elbow algorithm assists in finding the optimal number of clusters by drawing a line graph of SSE and K value, thereby achieving effective clustering of feature subsets. Ultimately, the cluster center of each feature subset will serve as a representative of the training sample and participate in the subsequent construction and comparative learning of positive and negative sample pairs, providing rich multi-granular information for the training of the encoder network and decoder network.
[0060] Reference Figure 2 As shown in the figure, based on the clustering results of each feature subset, a positive and negative sample pair is constructed for each training sample. Specifically:
[0061] For a given i-th sample x i , assuming that the group it belongs to is represented by By matching globally and locally at multiple granularities, that is, maximizing the sample x i Align the cluster centers with the clusters associated with them, thereby obtaining k positive sample pairs for each sample, which can be expressed as:
[0062]
[0063] In the formula, P represents the positive sample pair of each sample, x i represents the i-th sample, Indicates the sample x under the jth feature subset i The cluster to which it belongs, k represents the number of positive pairs and also represents the number of feature subsets, Indicates the sample x under the jth feature subset i The cluster center of the cluster to which it belongs.
[0064] When constructing negative sample pairs, in order to avoid false negative examples and samples from forming negative pairs, the embodiment of the present invention proposes to exclude i Highly correlated samples instead of using all samples in the batch.
[0065] The clustering results between feature subsets may vary. In this embodiment of the present invention, i Co-existence at least The samples in the groups are considered highly correlated. The set of these highly correlated samples is represented as X p , denote all samples in the current batch as X b , consisting of all samples X in the current batch b Remove highly correlated samples X p , and obtain the negative sample pair of each sample, which is specifically expressed as:
[0066] N={(x i ,x n )|x n ∈X b \X p}. (2)
[0067] Where N represents the negative pair of each training sample, x i represents the i-th sample, x n Represents x i Corresponding negative samples, Xb represents the set of all samples in the current batch, and Xp represents sample x i A highly correlated set of samples, X b \X p Represents the set X b With the set X p The difference between .
[0068] The embodiment of the present invention adopts a strategy of randomly dividing the global feature set into feature subsets and clustering samples within these subsets. This process aims to reveal inherent groupings and patterns in the data, similar to creating different data views by perturbing the original image in the image field. The positive sample pairs are designed by aligning the samples with the centroid of the cluster to which they belong. Even when the features are perturbed or changed, the feature vectors encoded by the model can still express the core semantic information. For negative sample pairs, in order to avoid false negative examples and samples forming negative pairs, this embodiment does not adopt random pairing, but specifically pairs the samples with samples from different clusters to ensure semantic differences between negative pair samples.
[0069] The positive and negative sample pairs constructed in step S3 represent the similarities and differences of the heterogeneous tabular data in the training sample set.
[0070] Specifically, in S4:
[0071] The positive and negative sample pairs constructed in step S3, where x i represents the anchor sample (i.e., the i-th training sample), Represents the anchor sample x iThere are pairs of positive and negative samples, that is, Represents x at the same time i The corresponding positive sample Or negative samples
[0072] The anchor point sample x i and its positive and negative sample sets Input to the encoder network f, after being encoded by the encoder f, input to the decoder g, and finally obtain the feature representation z of the anchor point sample (i) And the feature representation of its positive and negative sample sets Calculate the feature representation z of the anchor point sample (i) And the feature representation of its positive and negative sample sets The contrast loss between them.
[0073] In some embodiments, the contrast loss adopts InfoNCE contrast loss.
[0074] Through the InfoNCE contrast loss, the feature representation z of all anchor samples (i.e. training samples) is minimized (i) and its positive and negative sample sets The distance between the feature representations of the positive samples in the image is maximized, while the feature representation z of all anchor samples (i.e. training samples) is maximized. (i) and its positive and negative sample sets The distance between the feature representations of negative samples.
[0075] Stochastic gradient descent (SGD) is used to optimize the parameters of the encoder network f and the decoder network g.
[0076]
[0077] In the formula, z (i) Represents the feature representation of the anchor sample (i.e., training sample), Represents the feature representation of the positive and negative sample sets of the anchor sample (i.e., training sample), f(.) represents the output of the encoder, g(.) represents the output of the decoder, and N represents the total number of samples.
[0078]
[0079] In the formula, represents the cosine similarity between the feature representation of any i-th anchor sample and the feature representation of the positive and negative sample sets, z (i) Represents the feature representation of the anchor sample (i.e., training sample), The feature representation of the positive and negative sample sets representing the anchor sample (i.e., training sample) is expressed as ||·||2, and N represents the total number of samples.
[0080] The contrast loss is specifically:
[0081]
[0082] In the formula, Loss represents the InfoNCE contrast loss, N represents the total number of samples, represents the cosine similarity between the feature representation of any i-th anchor sample and the feature representation of the positive and negative sample sets, Represents x i The corresponding positive sample Represents x i Corresponding negative samples, τ represents the temperature coefficient, which is used to control the smoothness of the softmax distribution.
[0083] The purpose of the first stage of the embodiment of the present invention is to use any open source dataset to construct positive and negative sample pairs through comparative learning, and pre-train the encoder network f and the decoder network g.
[0084] In order to implement a specific classification task in a specific technical field, a suitable classifier needs to be trained, that is, the second stage of training is required.
[0085] Second training phase:
[0086] S5: Obtain a second training sample set with labels, which is derived from a specific data set related to the heterogeneous tabular data to be detected. The correlation here means that for the heterogeneous tabular data in a specific field, the data structure and type of the second training sample are consistent with the heterogeneous tabular data to be detected, and data alignment between the two can be achieved.
[0087] In some embodiments, the second labeled training sample set is a historical data set of the heterogeneous tabular data to be detected, and the historical data set has been labeled.
[0088] For example, Table 2 is a public anemia prediction dataset (with labels) on the Kaggle website, where the column values are simulated values.
[0089] Table 2 Anemia dataset examples with labels
[0090] age gender trouble breathing Shortness of breath Chest tightness Hemoglobin concentration anemia 24 male yes yes no normal 0 49 female no no yes Low 1
[0091] In Table 2, each row of data is annotated with a label. For example, a label of "1" indicates that the patient represented by the samples in this row is diagnosed with anemia, and a label of "0" indicates that the patient represented by the samples in this row is not diagnosed with anemia.
[0092] Figure 4 Schematic diagram of the pre-training and downstream classification task fine-tuning process in an embodiment of the present invention. Figure 4In the above, INPUT represents input data (i.e., input training samples), x represents training samples; x' represents positive samples or negative samples corresponding to x; f represents encoder network; g represents decoder network; z represents the feature representation of x decoded by decoder g; z' represents the feature representation of x' decoded by decoder g; h represents classifier network, y represents the true label of sample x, and y' represents the predicted label of x predicted by classifier h.
[0093] Reference Figure 4 As shown in the figure, for the classification task, a pre-trained encoder network f is used for encoding, and then the labels of the samples are obtained through a pre-trained classifier h. By optimizing the cross entropy classification loss Loss back propagation to optimize the parameters of the encoder network f and the classifier h, the prediction accuracy of the classifier is improved.
[0094] For example: if the public anemia prediction dataset (with labels) shown in Table 2 is used to train a classifier network h, the trained classifier network h can be used for predictive classification of a medical spreadsheet dataset that is consistent with or related to the structure and data type of the anemia prediction dataset.
[0095] According to the technical solution provided in the embodiment of the present application, the embodiment of the present application has the following significant advantages and significant technical effects:
[0096] 1) Flexibility and versatility: The feature processing method of the present application can encode heterogeneous tabular data containing categorical features, numerical features, and binary features. For classification tasks, no matter how many tabular features there are, as long as they meet the above feature types, the method of the present application can be used for processing.
[0097] 2) Improve model performance: By introducing global and local multi-granularity contrast learning, this method makes full use of the potential relationship between samples under global and local feature multi-granularity. This means that the existing methods in the NLP field make full use of the potential relationship patterns between samples under global and local feature multi-granularity, thereby improving the model accuracy and generalization ability.
[0098] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, which can include: ROM, RAM, disk or CD, etc.
[0099] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for classifying heterogeneous tabular data based on multi-granularity and contrastive learning, characterized in that: include: Obtain heterogeneous table data to be detected, and input it into the trained encoder network f and classifier network h in sequence, and the classifier network outputs the classification result of a specific label; The training process of the encoder network f and the classifier network h includes: Obtain a first training sample set, which is derived from an open source heterogeneous table data set, and the samples in the first training sample set are each row of data in the heterogeneous table data; Extract the features of each column of data in the sample and obtain the Boolean features f b , category feature f c and numerical features f u , perform feature decomposition and merging to obtain a global feature set; The global feature set is randomly divided into k mutually exclusive feature subsets, samples are clustered under all feature subsets, and positive and negative sample pairs of each sample are constructed based on the clustering results; Input the positive and negative sample pairs into the encoder network f, and after encoding, input them into the decoder network g for decoding, respectively obtain feature representations of the positive and negative sample pairs, calculate their contrast loss, and iteratively optimize the encoder network f and the decoder network g according to the contrast loss; Obtaining a second training sample set with specific labels, which is derived from a data set related to the heterogeneous tabular data to be detected; The second training sample set is input into the trained encoder network f to obtain the feature representation of the second training sample set, which is input into the classifier network h to predict a specific label value, the classification loss is calculated according to the predicted label value and the true label value, and the classifier is iteratively optimized according to the classification loss until the classification loss function converges.
2. According to claim 1, a heterogeneous table data classification method based on multi-granularity and contrastive learning is characterized in that: The heterogeneous table data is structured electronic table data including multiple data types.
3. The heterogeneous table data classification method based on multi-granularity contrastive learning according to claim 1 is characterized in that: The second training sample set is a historical data set of the heterogeneous table data to be detected, and the historical data set has been labeled.
4. The method for classifying heterogeneous table data based on multi-granularity and contrastive learning according to claim 1, characterized in that: Before extracting the features of each column of data in the first training sample set, the method further includes: Determine the type of each column of data in the sample, which includes categorical data, numerical data, and binary data; Preprocess each column of data in the sample, including: The minimum-maximum standardization method is used to standardize numerical data; Perform hot encoding on the categorized data to obtain the category word vector; Binarize binary data to obtain a Boolean vector.
5. The method for classifying heterogeneous table data based on multi-granularity and contrastive learning according to claim 1, characterized in that: The feature decomposition and merging process includes: S201: From the character perspective, according to the length of the feature name, the Boolean feature f b and the category feature f c Split into l features of the same length as the feature name, and then add two features, ":" and "value", to obtain the split Boolean feature set F b and the category feature set F c ; S202: From the character perspective, according to the length of the feature name, the numerical feature f u Split into l features with the same length as the feature name, and obtain the numerical feature set F after splitting u ; S203: The split Boolean feature set F b , category feature set F c and the numerical feature set F u Merge into the global feature set F'.
6. A heterogeneous table data classification method based on multi-granularity and contrastive learning according to claim 1 or 5, characterized in that: The K-Means clustering algorithm is used to cluster the feature subsets.
7. The method for classifying heterogeneous table data based on multi-granularity and contrastive learning according to claim 1, characterized in that: The positive and negative sample pairs are expressed as: In the formula, P represents the positive pair of each training sample, x i represents the i-th sample, Indicates the sample x under the jth feature subset i The cluster it belongs to, k represents the number of positive pairs and also the number of feature subsets. Indicates the sample x under the jth feature subset i The cluster center of the cluster to which it belongs; N={(x i ,x n )|x n ∈X b \X p } Where N represents the negative pair of each training sample, x i represents the i-th sample, x n Represents x i The corresponding negative sample, X b represents the set of all samples in the current batch, X p Represents sample x i A collection of highly correlated samples.
8. The method for classifying heterogeneous table data based on multi-granularity and contrastive learning according to claim 7, characterized in that: The contrast loss adopts InfoNCE contrast loss, which is specifically expressed as: In the formula, Loss represents the InfoNCE contrast loss, N represents the total number of samples, represents the cosine similarity between the feature representation of any i-th anchor sample and the feature representation of the positive and negative sample sets, Represents x i The corresponding positive sample Represents x i Corresponding negative samples; τ represents the temperature coefficient, which is used to control the smoothness of the softmax distribution.
