Data classification method and apparatus, electronic device, and storage medium
By introducing an objective loss function and predetermined distribution constraints into the data classification model, the probability distribution of the data classification model is adjusted, which solves the problems of insufficient classification accuracy and high resource consumption caused by the long-tail effect, and achieves more efficient data classification.
Patent Information
- Application Number
- CN202111427636.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2041-11-26
AI Technical Summary
In classification problems, the long-tail effect causes a minority of categories to appear more frequently than other categories, making it difficult for existing technologies to learn and classify effectively, resulting in insufficient model generalization ability and high computational resource consumption.
By adjusting the probability distribution of the data classification model using the objective loss function and the constraints of a predetermined distribution, the adjusted probability data conforms to the predetermined distribution, thereby improving classification accuracy and reducing computational resource consumption.
It improves the accuracy of data classification, reduces the consumption of computing resources, and ensures the accuracy and efficiency of classification results.
Smart Images

Figure CN114120040B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of artificial intelligence, in particular to the field of deep learning and big data, and more particularly to a data classification method and device, an electronic device and a storage medium. BACKGROUND
[0002] In a classification problem, a basic problem that exists includes a long-tail effect problem. That is, in a data set, the occurrence frequency of data of a few categories is significantly higher than that of data of other categories except the few categories. This problem brings great challenges to modeling of a classification model. In related technologies, a re-weighting and re-sampling method is usually used to enable the model to sufficiently learn the data with a low occurrence frequency, so as to improve the generalization ability of the model through this method. SUMMARY
[0003] A data classification method and device, an electronic device and a storage medium are provided, which reduce consumption of computing resources and improve classification accuracy.
[0004] One aspect of the present disclosure provides a data classification method, comprising: inputting to-be-processed data into a data classification model to obtain initial probability data of the to-be-processed data for a predetermined category; determining adjusted probability data of the to-be-processed data for the predetermined category according to a target loss function and the initial probability data; wherein the target loss function takes the adjusted probability data of the to-be-processed data for the predetermined category as an independent variable; and determining a category of the to-be-processed data based on the adjusted probability data, wherein the target loss function includes the following constraint condition: a data distribution of the adjusted probability data satisfies a predetermined distribution.
[0005] Another aspect of the present disclosure provides a data classification device, comprising: an initial probability obtaining module configured to input to-be-processed data into a data classification model to obtain initial probability data of the to-be-processed data for a predetermined category; an adjusted probability determining module configured to determine adjusted probability data of the to-be-processed data for the predetermined category according to a target loss function and the initial probability data; wherein the target loss function takes the adjusted probability data of the to-be-processed data for the predetermined category as an independent variable; and a category determining module configured to determine a category of the to-be-processed data based on the adjusted probability data, wherein the target loss function includes the following constraint condition: a data distribution of the adjusted probability data satisfies a predetermined distribution.
[0006] Another aspect of the present disclosure provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the data classification method provided by the present disclosure.
[0007] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the data classification method provided by the present disclosure.
[0008] According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the data classification method provided by the present disclosure.
[0009] It should be understood that the contents described in this section are not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0010] The accompanying drawings are used to better understand the present scheme, and do not limit the present disclosure. Among them:
[0011] Figure 1 is an application scenario diagram of the data classification method and device according to an embodiment of the present disclosure;
[0012] Figure 2 is a flow diagram of the data classification method according to an embodiment of the present disclosure;
[0013] Figure 3 is a principle diagram of the data classification method according to an embodiment of the present disclosure;
[0014] Figure 4 is a principle diagram of the data classification method according to another embodiment of the present disclosure;
[0015] Figure 5 is a structural block diagram of the data classification device according to an embodiment of the present disclosure; and
[0016] Figure 6 is a structural block diagram of an electronic device for implementing the data classification method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0017] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to assist in understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, descriptions of well-known functions and structures are omitted in the following description.
[0018] The data classification method provided by the present disclosure comprises an initial probability obtaining stage, an adjusted probability determining stage and a category determining stage. In the initial probability obtaining stage, the data to be processed is input into a data classification model to obtain initial probability data of the data to be processed for a predetermined category. In the adjusted probability determining stage, according to a target loss function and the initial probability data, adjusted probability data of the data to be processed for the predetermined category is determined. The target loss function takes the adjusted probability data of the data to be processed for the predetermined category as an independent variable, and the target loss function comprises the following constraint condition: the data distribution of the adjusted probability data satisfies a predetermined distribution. In the category determining stage, the category of the data to be processed is determined based on the adjusted probability data.
[0019] The following will be described in combination with Figure 1 The application scenario of the method and device provided by the present disclosure will be described.
[0020] Figure 1 The application scenario of the data classification method and device according to the embodiments of the present disclosure is shown in FIG. 1.
[0021] As Figure 1 shown, the application scenario 100 can comprise an electronic device 110, which can be any electronic device with processing function, including but not limited to smart phone, tablet computer, laptop computer, desktop computer and server, etc.
[0022] The electronic device 110 can classify input image 121, text 122 or audio clip 123, etc. to obtain classification result 130. The classification result 130 can indicate, for example, the category of the target object in the image 121 (such as lesion category, non-lesion category, etc.), the category of the text 122 (such as sports news category, financial news category, etc.) or the category of the target object corresponding to the audio clip 123 (such as old adult category, young adult category, child category, etc.), etc., which is not limited by the present disclosure.
[0023] According to the embodiments of the present disclosure, a data classification model can be used to classify multimedia data such as input image 121, text 122 or audio clip 123. The distribution of the categories of the image 121, text 122 or audio clip 123 can be obtained by pre-statistics. The embodiments can use the data classification model to classify a batch of data, adjust the classification probability of the batch of data obtained by the data classification model according to the distribution of the categories obtained by statistics, and determine the category of the data according to the adjusted classification probability. Through the adjustment, the distribution of the finally determined data categories can be more consistent with the distribution of the categories obtained by pre-statistics, so that the classification accuracy can be improved to a certain extent.
[0024] According to an embodiment of the present disclosure, a logical adjustment method can also be used to adjust the classification probability. The logical adjustment method is derived from the Bayesian optimal criterion.
[0025] According to an embodiment of the present disclosure, as shown in Figure 1 The application scenario 100 can further include a server 140. The electronic device 110 can be communicatively connected with the server 140 through a network, which can include a wireless or wired communication link.
[0026] For example, the server 140 can be configured to train a data classification model, and in response to a model acquisition request sent by the electronic device 110, send the trained data classification model 150 to the electronic device 110, so as to facilitate the electronic device 110 to classify the input image 121, text 122 or audio segment 123, and adjust the classification result according to the pre-statistical distribution of the classification.
[0027] For example, the electronic device 110 can also send the input image 121, text 122 or audio segment 123 to the server 140 through the network, and the server 140 can classify the image 121, text 122 or audio segment 123 according to the trained data classification model 150.
[0028] According to an embodiment of the present disclosure, as shown in Figure 1 The application scenario 100 can further include a database 160, which can maintain a large number of images, texts or audio segments. The server 140 can access the database 160 and extract part of the images, texts or audio segments from the database 160 as sample images to train the data classification model.
[0029] It should be noted that the data classification method provided by the present disclosure can be executed by the electronic device 110 or the server 140. Accordingly, the data classification apparatus provided by the present disclosure can be arranged in the electronic device 110 or the server 140.
[0030] It should be understood that the number and type of electronic devices, servers and databases in FIG. 1 are only illustrative. According to the implementation needs, there can be any number and type of terminal devices, servers and databases.
[0031] The data classification method provided by the present disclosure will be described in detail below. Figures 2 to 4 The data classification method provided by the present disclosure will be described in detail below.
[0032] Figure 2 is a flowchart of the data classification method according to an embodiment of the present disclosure.
[0033] According to an embodiment of the present disclosure, as shown in Figure 2As shown, the data classification method 200 of this embodiment can include operation S210 to operation S230.
[0034] In operation S210, the data to be processed is input into the data classification model to obtain initial probability data of the data to be processed for the predetermined categories.
[0035] According to an embodiment of the present disclosure, the data classification model can be a deep learning model such as a back propagation neural network model, a convolutional neural network model or a recurrent neural network model. Different models can be used for the data classification model according to different data to be processed. For example, if the data to be processed is text, the data classification model can include a TextCNN model, a dynamic convolutional neural network (DCNN) model or a recurrent convolutional neural network (RCNN) model. If the data to be processed is an image, the data classification model can include a VGG network series model, a residual network (ResNet) series model or a LeNet series model. If the data to be processed is an audio clip, the data classification model can include a gate recurrent unit (GRU) model or a time convolutional network model.
[0036] This embodiment can input the data to be processed into the data classification model, and output a probability vector of the data to be processed for the predetermined categories from the data classification model as the initial probability data. The probability vector includes a probability value of the data to be processed belonging to each of the predetermined categories. In the case of multiple data to be processed, multiple probability vectors can be obtained, which can be spliced to form a probability matrix, and the probability matrix can be used as the initial probability data accordingly.
[0037] In operation S220, the adjusted probability data of the data to be processed for the predetermined categories is determined according to the target loss function and the initial probability data.
[0038] According to an embodiment of the present disclosure, the target loss function takes the adjusted probability data as an independent variable, and can be related to the initial probability data. For example, the target loss function can be represented by a difference between the initial probability data and the adjusted probability data. The target loss function can also include a constraint condition, which can be that the data distribution of the adjusted probability data satisfies a predetermined distribution. The operation S220 can solve the value of the adjusted probability data when the target loss function takes the minimum value under the constraint condition, thereby obtaining the adjusted probability data. Wherein, the difference between the initial probability data and the adjusted probability data can be represented by, for example, the negative of the similarity between the initial probability data and the adjusted probability data, so that the adjusted probability data can be solved by minimizing the target loss function.
[0039] According to an embodiment of the present disclosure, the predetermined distribution can be determined by the classification distribution of a large amount of data similar to the to-be-processed data in the field where the to-be-processed data is located. For example, the large amount of data can include data in a training set for training a data classification model, or can include data in a test set for testing a data classification model.
[0040] For example, the large amount of data can include sales data of multiple categories of goods in an e-commerce website, or can include multiple detection images of human body parts collected by a medical institution, etc. The predetermined distribution can be, for example, a uniform distribution, a Bernoulli distribution, a Poisson distribution, an exponential distribution, etc. In an embodiment, the large amount of data can include data of a test set with a uniform distribution of categories, and accordingly the predetermined distribution is a uniform distribution.
[0041] The to-be-processed data in this embodiment can be multiple data, so that the data distribution of the adjusted probability data more accurately satisfies the predetermined distribution. And thus the accuracy of the obtained category of the to-be-processed data can be improved to a certain extent.
[0042] It can be understood that the adjusted probability data, similar to the initial probability data, can represent an adjusted probability value of the to-be-processed data belonging to a predetermined category.
[0043] In operation S230, the category of the to-be-processed data is determined based on the adjusted probability data.
[0044] The embodiment can determine the category of the to-be-processed data according to the adjusted probability data. The amount of data of the adjusted probability data is the same as that of the initial probability data. The embodiment can take the predetermined category corresponding to the maximum probability value in the probability data corresponding to each to-be-processed data in the adjusted probability data as the category of the to-be-processed data. For example, the probability data corresponding to each to-be-processed data in the adjusted probability data is a probability vector. The dimension of the probability vector is the same as the number of predetermined categories, and each element in the probability vector corresponds to a predetermined category. The embodiment can take the predetermined category corresponding to the maximum element in the probability vector as the category of the to-be-processed data.
[0045] Since the data distribution of the adjusted probability data meets the predetermined distribution, the category determined by the embodiment according to the adjusted probability data can be more in line with actual needs, and thus the accuracy of classifying data can be improved.
[0046] According to the embodiment of the present disclosure, for a field with a long tail effect, the occurrence frequency of data of a few categories is usually higher than that of data of other categories. If a part of data is randomly selected from the field to train the data classification model, the data classification model may not accurately learn the features of data of other categories, and thus cannot accurately classify data of other categories. In order to improve the accuracy of the data classification model, a large amount of data generated in the field is usually needed to collect more data of categories with low occurrence probability, or the re-weighting method is used to assign a larger penalty to data of categories with low occurrence probability when classification is wrong. These methods are improvements to the training process of the data classification model, and have the problems of large training difficulty, high resource consumption, and uncontrollable model accuracy. In the embodiment of the present disclosure, the initial probability data output by the data classification model is adjusted according to the target loss function by taking the predetermined distribution as a constraint condition, and the category of the to-be-processed data is determined according to the adjusted probability data, which can make the distribution of the determined data category more in line with the distribution of data in various fields, compared with related technologies, can reduce the requirement for model accuracy, reduce the consumption of computing resources, and ensure high accuracy of the classification result.
[0047] It can be understood that the initial probability data can also be adjusted by using the logical adjustment method described in the foregoing, but compared with the method of the embodiment of the present disclosure, the method cannot guarantee that the distribution of the adjusted probability data meets the expected distribution (i.e., the predetermined distribution).
[0048] According to an embodiment of the present disclosure, the target loss function described above can further include a constraint condition that the sum of data of the adjusted probability data is a predetermined value. For example, for each piece of data to be processed, the initial probability data output by the data classification model is a probability vector, and the sum of all probability values in the probability vector should be 1. Accordingly, the sum of all probability values in the probability vector corresponding to each piece of data to be processed in the adjusted probability data should also be 1. If there are N pieces of data to be processed, the predetermined value of the sum of data of the adjusted probability data can be defined as N.
[0049] According to an embodiment of the present disclosure, when there are N pieces of data to be processed and the number of predetermined categories is C, the obtained adjusted probability data can be a probability matrix with a size of NxC. For the C elements in each row of the probability matrix, the sum of the C elements can be defined as 1. For example, assuming that the adjusted probability data is Y, the constraint condition that the sum of data of the adjusted probability data Y is a predetermined value can be represented by the following formula (1):
[0050] Y{1} C ={1} N . Formula (1)
[0051] wherein, {1} C represents a column vector including C elements, and the values of the C elements are all 1. {1} N represents a column vector including N elements, and the values of the N elements are all 1.
[0052] The constraint condition described by the above formula (1) can ensure the rationality of the adjusted probability data.
[0053] Figure 3 is a schematic diagram of the principle of the data classification method according to an embodiment of the present disclosure.
[0054] According to an embodiment of the present disclosure, an entropy regularization term can be added to the target loss function, so that the problem of solving the target loss function is converted into a convex optimization problem, a globally unique solution is obtained, and the complexity of solving the target loss function is reduced.
[0055] For example, in an embodiment, the target loss function can include two terms, one of which represents the distance between the initial probability data and the adjusted probability data, and the other of which is an entropy regularization term.
[0056] For example, as Figure 3As shown, the data classification method 300 of this embodiment can set the N pieces of to-be-processed data. This embodiment can sequentially input the N pieces of to-be-processed data (for example, to-be-processed data 311 to to-be-processed data 313) into the data classification model 320 in sequence, and can obtain initial probability data 330 after processing the N pieces of to-be-processed data by the data classification model 320. The initial probability data 330 can be a matrix with a size of N x C.
[0057] After obtaining the initial probability data 330, a data item representing the distance 340 between the initial probability data 330 and the adjusted probability data can be obtained by taking the adjusted probability data as the independent variable. The data item can be represented as, for example, where Y is the adjusted probability data, is the initial probability data. The f() function can include, for example, an inner product function, an L1 distance function, an L2 distance function, or a KL (Kullback-Leibler) divergence function, and the like. It should be noted that if the f() function includes an inner product function, f() is essentially the negative of the inner product function, because the inner product function generally represents the similarity between two data.
[0058] According to an embodiment of the present disclosure, the entropy regularization term can be represented by Y log Y, or can be represented by any data item that can represent the entropy regularization term, and the present disclosure does not limit this.
[0059] For example, in an embodiment, the target loss function can be represented by the following formula (2):
[0060]
[0061] where Y and are both matrix data with a row number of N, and a is a hyperparameter. In the case where Y is a probability matrix, ∑aY log Y represents the sum of the values of each element in the matrix obtained by aY log Y. The constraint condition of the target loss function can include the following formula (3):
[0062] {Y} T {1} N = μ. Formula (3)
[0063] where {Y} T represents the transpose matrix of Y, and μ is a predetermined distribution.
[0064] In an embodiment, the constraint condition of the target loss function can also include the formula (1) described above, which will not be described again here.
[0065] In an embodiment, For example, can be represented as where, represents the inner product between Y and represents the inner product between Y and represents the sum of elements in the matrix obtained by multiplying Y with It can be understood that the representation of the above formula (3) is only an example for the purpose of understanding the present disclosure, and the present disclosure is not limited thereto.
[0066] After obtaining the target loss function 350 and the initial probability data 330, the value of the adjusted probability data in the target loss function 350 can be solved by minimizing the target loss function 350, so as to obtain the adjusted probability data 360. The size of the adjusted probability data 360 is the same as that of the initial probability data, both of which are NxC matrices. Subsequently, the data category 370 of each of the N pieces of to-be-processed data can be determined according to the adjusted probability data 360.
[0067] According to an embodiment of the present disclosure, the Sinkhorn algorithm can be used to minimize the target loss function in the above formula (2). The Sinkhorn algorithm is commonly used in the Optimal Transport (OT) problem with entropy constraints. It can be understood that the target loss function with the constraint condition represented by the above formula (1) and formula (3) is essentially an optimal transport function.
[0068] Figure 4 is a schematic diagram of the principle of a data classification method according to another embodiment of the present disclosure.
[0069] According to an embodiment of the present disclosure, when adjusting the initial probability data, the correlation of data in the plurality of to-be-processed data can also be considered. For example, for two to-be-processed data with correlation, the distance between the probability values corresponding to the two to-be-processed data in the initial probability data should be similar to the distance between the probability values corresponding to the two to-be-processed data in the adjusted probability data. This is because the to-be-processed data with correlation usually belong to the same or similar category. By considering the correlation, the accuracy of the adjusted probability data obtained by adjustment can be further improved, and thus the classification accuracy of data can be improved.
[0070] Based on this, if the to-be-processed data includes a plurality of data, the embodiment can also add a data item representing the correlation between the plurality of data to the target loss function when adjusting the initial probability data.
[0071] For example, as shown in the above formula (4), the correlation between the plurality of data can be represented by a matrix Y. Figure 4 As shown, in the data classification method 400 of this embodiment, the data to be processed includes N data, i.e., data to be processed 411 to data to be processed 413. The method 400 can first determine, for each data of the N data, the neighbor data of the N data for the data, thereby obtaining neighbor data 421 to neighbor data 423. Each neighbor data can be a data group, for example. For example, the neighbor data 421 is a data group composed of at least one neighbor data for the data to be processed 411.
[0072] According to an embodiment of the present disclosure, the K-Nearest Neighbor algorithm can be used to search for the neighbor data of each data from the N data. It can be understood that the above K-Nearest Neighbor algorithm is only an example for the purpose of understanding the present disclosure, and the present disclosure is not limited thereto.
[0073] After obtaining the neighbor data for each data, the data association information for the plurality of data can be determined according to the neighbor relationship between each data and the neighbor data. The data association information can indicate that each data has an association relationship with the neighbor data for it. For example, the data association information can be represented by a neighbor graph 430 in the following formula (3). Figure 4
[0074] In the neighbor graph 430, a plurality of nodes and edges connecting the nodes can be included. Each node of the plurality of nodes is one data of the N data, and the edge connecting two nodes indicates that the data of the two nodes have a neighbor relationship. That is, one of the data of the two nodes is the neighbor data of the other data.
[0075] The embodiment can determine a regularization term 440 associated with the adjusted probability data based on the data association information. The regularization term 440 can indicate the data association information.
[0076] For example, the regularization term 440 can be represented by the following formula (4):
[0077]
[0078] wherein K is the number of neighbor data of each data, represents the square of the L2 distance between and . Wherein, represents the mth data x m the feature value extracted via the data classification model, represents the n th data x n The feature values extracted by the data classification model. These feature values can be the input values for logistic regression processing within the data classification model. P(y) represents n |x n ) and P(y m |x m The square of the L2 distance between P(y) and P(y). n |x n ) indicates that for data x n The adjusted probability data, P(y m |x m ) indicates that for data x m The adjusted probability data.
[0079] Let the L2 norm of P(y|x) be approximately equal to the L1 norm of P(y|x), then and The value of can be approximated as 1. Accordingly, the above formula (4) can be simplified to the following formula (5):
[0080]
[0081] in, express The trace of a matrix, i.e. The sum of all elements on the main diagonal of the matrix. This represents the Laplacian matrix of the aforementioned nearest neighbor graph, i.e., the Laplacian matrix indicating data association information. Wherein, This is a matrix representing the degree of each node in the nearest neighbor graph. In this matrix, the values on the diagonal are the degree of a node, and the rest are 0. It is an adjacency matrix. Taking an undirected graph as an example, if two nodes are connected, the value in the adjacency matrix corresponding to the relationship between the two nodes is 1, otherwise it is 0.
[0082] like Figure 4 As shown, in this embodiment, the data classification method 400 can input the data to be processed 411 to 413 into the data classification model 450 in sequence while obtaining the regularization term 440. After the data classification model 450 processes the N data to be processed, the initial probability data 460 can be obtained. The initial probability data 460 can be a matrix of size N×C.
[0083] After obtaining the regularization term 440 and the initial probability data 460, a data term representing the distance between the initial probability data 460 and the adjusted probability data can be obtained using a method similar to that described above. This regularization term 440 is then added to the target loss function described in the aforementioned embodiment to obtain the target loss function 470 of this embodiment. For example, the target loss function 470 can be expressed using the following formula (6):
[0084]
[0085] Here, β is a hyperparameter that can be set according to actual needs, and this disclosure does not impose any limitations on it. It is understood that the above representation of the objective loss function and regularization term is only used as an example to facilitate understanding of this disclosure, and this disclosure does not impose any limitations on it.
[0086] exist As described above Then, the above formula (6) can be converted into the following formula (7):
[0087]
[0088] It is understandable that the target loss function represented by formula (6) and / or formula (7) can have the constraints represented by formula (1) and / or formula (2) mentioned above, which will not be repeated here.
[0089] After obtaining the target loss function 470 and the initial probability data 460, the adjusted probability data values within the target loss function 470 can be obtained by minimizing the target loss function 470, thus yielding the adjusted probability data 480. The size of the adjusted probability data 480 is the same as that of the initial probability data, both being N×C matrices. Subsequently, based on this adjusted probability data 480, the data category 490 for each of the N data points to be processed can be determined.
[0090] According to embodiments of this disclosure, the Generalized Conditional Gradient (GCG) algorithm can be used to minimize the target loss function. The algorithm flow of the GCG algorithm may include:
[0091] Step 1, randomly select a probability data Y 0 ∈H, such that Y 0 This serves as the initial value for the adjusted probability data. Here, H is a non-empty set of the Hilbert space. Simultaneously, the function is defined.
[0092] Step 2: Set the initial value of counter t to 0 and find a feasible solution for the following formula (8):
[0093]
[0094] where Y* is the value of Y that minimizes F(Y). The feasible solution can be calculated by Sinkhorn algorithm described above, for example.
[0095] Step 3, a suitable step size s can be determined by using the following formula (9) t :
[0096]
[0097] where Y t-1 is the adjusted probability data obtained in the last cycle, and s(Y * -Y t-1 ) is a function of the step size related to (Y * -Y t-1 ).
[0098] Step 4, set Y t = Y t-1 + s(Y * -Y t-1 ), and set t = t + 1, return to execute step 2 until the difference between the value of the target loss function obtained according to Y t and the value of the target loss function obtained according to Y t-1 is less than a predetermined value. The predetermined value can be set according to actual needs, which is not limited in the present disclosure.
[0099] It can be understood that the method of minimizing the target loss function by using the generalized conditional gradient algorithm is only an example for understanding the present disclosure, which is not limited in the present disclosure.
[0100] Based on the data classification method provided by the present disclosure, the present disclosure further provides a data classification device. The device will be described in detail below. Figure 5 based on the data classification method provided by the present disclosure.
[0101] Figure 5 is a structural block diagram of the data classification device according to an embodiment of the present disclosure.
[0102] As shown in Figure 5 , the data classification device 500 of the embodiment can include an initial probability obtaining module 510, an adjusted probability determining module 520, and a category determining module 530.
[0103] The initial probability obtaining module 510 is configured to input the data to be processed into a data classification model to obtain initial probability data of the data to be processed for a predetermined category. In an embodiment, the initial probability obtaining module 510 can be configured to perform the operation S210 described above, which will not be described here.
[0104] The adjusted probability determining module 520 is configured to determine the adjusted probability data of the to-be-processed data for the predetermined class according to the target loss function and the initial probability data. The target loss function takes the adjusted probability data of the to-be-processed data for the predetermined class as an independent variable. The target loss function includes a constraint condition that the data distribution of the adjusted probability data satisfies a predetermined distribution. In an embodiment, the adjusted probability determining module 520 can be configured to perform the operation S220 described above, and details are not described herein again.
[0105] The class determining module 530 is configured to determine the class of the to-be-processed data based on the adjusted probability data. In an embodiment, the class determining module 530 can be configured to perform the operation S230 described above, and details are not described herein again.
[0106] According to an embodiment of the present disclosure, the target loss function further includes a constraint condition that the sum of the data of the adjusted probability data is a predetermined value.
[0107] According to an embodiment of the present disclosure, the target loss function described above is expressed by the following formula:
[0108]
[0109] The constraint condition of the target loss function includes:
[0110] {Y} T {1} N =μ.
[0111] wherein, represents the distance between Y and , Y is the adjusted probability data, is the initial probability data, Y and are both matrix data with N rows; α is a hyperparameter; {1} N represents a column vector including N elements, and the values of the N elements are all 1, and μ is a predetermined distribution.
[0112] According to an embodiment of the present disclosure, the adjusted probability determining module 520 is configured to minimize the target loss function by using a Sinkhorn algorithm to obtain the adjusted probability data.
[0113] According to embodiments of this disclosure, the data to be processed includes multiple data sets, and the data classification device 500 may further include a nearest neighbor data determination module, an association information determination module, and a regularization term determination module. The nearest neighbor data determination module is used to determine the nearest neighbor data for each data set among the multiple data sets. The association information determination module is used to determine data association information for the multiple data sets based on the nearest neighbor data for each data set. The regularization term determination module is used to determine a regularization term associated with the adjusted probability data based on the data association information. The regularization term indicates the data association information, and the target loss function includes the regularization term.
[0114] According to embodiments of this disclosure, the target loss function described above is expressed by the following formula:
[0115]
[0116] The constraints on the objective loss function include:
[0117] {Y} T {1} N =μ.
[0118] in, Indicate Y and The distance between them, where Y is the adjusted probability data. Given the initial probability data, Y and All data are matrix data with N rows, and α and β are hyperparameters. It is a regularization term; A Laplace matrix indicating data association information; {1} N Let μ represent a column vector containing N elements, all of which have a value of 1, where μ is a predetermined distribution.
[0119] According to an embodiment of this disclosure, the adjusted probability determination module 520 is specifically used to: minimize the target loss function using a generalized conditional gradient algorithm to obtain adjusted probability data.
[0120] It should be noted that the acquisition, collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solution disclosed herein all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0121] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0122] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement the data classification method of embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0123] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0124] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0125] The computing unit 601 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs various methods and processes described above, such as the data classification method. For example, in some embodiments, the data classification method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded onto the RAM 603 and executed by the computing unit 601, one or more steps of the data classification method described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the data classification method by any other suitable means, such as by means of firmware.
[0126] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0127] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0128] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0129] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0130] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0131] The computer system can include clients and servers. This relationship can be. The servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are mainframe products in the cloud computing service system, and solve the defects of large management difficulty and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server, or VPS for short). The servers can also be servers of a distributed system, or servers combined with a blockchain.
[0132] It should be understood that the various forms of flow shown above can be reordered, steps added or deleted. For example, the steps described in the present disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions of the present disclosure can be achieved, which are not limited herein.
[0133] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A data classification method, comprising: The data to be processed is input into a data classification model to obtain initial probability data of the data to be processed for a predetermined category. The data to be processed is text, image, or audio clip. Based on the target loss function and the initial probability data, under the constraints included in the target loss function, the target loss function is minimized to obtain the adjusted probability data of the data to be processed for the predetermined category; wherein, the target loss function uses the adjusted probability data of the data to be processed for the predetermined category as the independent variable; and Based on the adjusted probability data, the category of the data to be processed is determined. The objective loss function includes the following constraint: the data distribution of the adjusted probability data satisfies a predetermined distribution. The target loss function is expressed by the following formula: ; The constraints of the objective loss function include: ; in, Indicate Y and The distance between them, Y is the adjusted probability data. Given the initial probability data, Y and All data are matrix data with N rows; For hyperparameters; This represents a column vector containing N elements, where all N elements have a value of 1. This is the predetermined distribution.
2. The method according to claim 1, wherein, The objective loss function also includes the following constraints: The sum of the adjusted probability data is a predetermined value.
3. The method according to claim 1, wherein, Based on the target loss function and the initial probability data, and under the constraints included in the target loss function, the target loss function is minimized to obtain the adjusted probability data of the data to be processed for the predetermined category, including: The adjusted probability data are obtained by minimizing the target loss function using the Sinkhorn algorithm.
4. A data classification method, comprising: The data to be processed is input into a data classification model to obtain initial probability data of the data to be processed for a predetermined category. The data to be processed is text, image or audio segment, and includes multiple data. For each of the plurality of data, determine the nearest neighbor data for each of the plurality of data; Based on the nearest neighbor data for each of the data, determine the data association information for the multiple data; Based on the data association information, a regularization term is determined that is associated with the adjusted probability data, wherein the regularization term indicates the data association information; Based on the target loss function and the initial probability data, under the constraints included in the target loss function, the target loss function is minimized to obtain the adjusted probability data of the data to be processed for the predetermined category; wherein, the target loss function uses the adjusted probability data of the data to be processed for the predetermined category as the independent variable; and Based on the adjusted probability data, the category of the data to be processed is determined. The target loss function is expressed by the following formula: The constraints of the objective loss function include: ; in, Indicate Y and The distance between them, Y is the adjusted probability data. Given the initial probability data, Y and All data are matrix data with N rows. , For superparameters, For the regularization term; A Laplace matrix indicating the data association information; This represents a column vector containing N elements, where all N elements have a value of 1. This is the predetermined distribution.
5. The method according to claim 4, wherein, The objective loss function also includes the following constraints: The sum of the adjusted probability data is a predetermined value.
6. The method according to claim 4, wherein, Based on the target loss function and the initial probability data, and under the constraints included in the target loss function, the target loss function is minimized to obtain the adjusted probability data of the data to be processed for the predetermined category, including: The adjusted probability data are obtained by minimizing the target loss function using the Sinkhorn algorithm.
7. The method according to claim 4, wherein, Based on the target loss function and the initial probability data, and under the constraints included in the target loss function, the target loss function is minimized to obtain the adjusted probability data of the data to be processed for the predetermined category, including: The adjusted probability data are obtained by minimizing the target loss function using the generalized conditional gradient algorithm.
8. A data classification device, comprising: The initial probability acquisition module is used to input the data to be processed into the data classification model to obtain the initial probability data of the data to be processed for a predetermined category. The data to be processed is text, image or audio segment. The adjusted probability determination module is used to minimize the target loss function under the constraints included in the target loss function, based on the target loss function and the initial probability data, to obtain adjusted probability data of the data to be processed for the predetermined category; wherein the target loss function uses the adjusted probability data of the data to be processed for the predetermined category as its independent variable; and The category determination module is used to determine the category of the data to be processed based on the adjusted probability data. The objective loss function includes the following constraint: the data distribution of the adjusted probability data satisfies a predetermined distribution. The target loss function is expressed by the following formula: ; The constraints of the objective loss function include: ; in, Indicate Y and The distance between them, Y is the adjusted probability data. Given the initial probability data, Y and All data are matrix data with N rows; For hyperparameters; This represents a column vector containing N elements, where all N elements have a value of 1. This is the predetermined distribution.
9. The apparatus according to claim 8, wherein, The objective loss function also includes the following constraints: The sum of the adjusted probability data is a predetermined value.
10. The apparatus according to claim 8, wherein, The adjusted probability determination module is used for: The adjusted probability data are obtained by minimizing the target loss function using the Sinkhorn algorithm.
11. A data classification device, comprising: An initial probability acquisition module is used to input the data to be processed into a data classification model to obtain the initial probability data of the data to be processed for a predetermined category. The data to be processed is text, image or audio segment, and the data to be processed includes multiple data. The nearest neighbor data determination module is used to determine the nearest neighbor data for each of the plurality of data. The association information determination module is used to determine data association information for the multiple data based on the nearest neighbor data for each of the data. The regularization term determination module is used to determine a regularization term associated with the adjusted probability data based on the data association information, wherein the regularization term indicates the data association information; The adjusted probability determination module is used to minimize the target loss function under the constraints included in the target loss function, based on the target loss function and the initial probability data, to obtain adjusted probability data of the data to be processed for the predetermined category; wherein the target loss function uses the adjusted probability data of the data to be processed for the predetermined category as its independent variable; and The category determination module is used to determine the category of the data to be processed based on the adjusted probability data. The objective loss function includes the following constraint: the data distribution of the adjusted probability data satisfies a predetermined distribution. The target loss function is expressed by the following formula: The constraints of the objective loss function include: ; in, Indicate Y and The distance between them, Y is the adjusted probability data. Given the initial probability data, Y and All data are matrix data with N rows. , For superparameters, For the regularization term; A Laplace matrix indicating the data association information; This represents a column vector containing N elements, where all N elements have a value of 1. This is the predetermined distribution.
12. The apparatus according to claim 11, wherein, The objective loss function also includes the following constraints: The sum of the adjusted probability data is a predetermined value.
13. The apparatus according to claim 11, wherein, The adjusted probability determination module is used for: The adjusted probability data are obtained by minimizing the target loss function using the Sinkhorn algorithm.
14. The apparatus according to claim 11, wherein, The adjusted probability determination module is used for: The adjusted probability data are obtained by minimizing the target loss function using the generalized conditional gradient algorithm.
15. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 7.
17. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and apparatus for extracting name of POI, device and computer storage medium
US20220019632A1