A sample classification method and model updating method for online learning

By using Mahalanobis distance and pairwise constraints in graph-based semi-supervised learning, it solves the problem that Euclidean distance cannot accurately represent sample similarity, improves the classification accuracy of semi-supervised learning and the label confidence of online learning, and is suitable for A system without manual calibration.

CN111353516BActive Publication Date: 2024-10-15HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201811578276.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-12-21
Publication Date
2024-10-15
Estimated Expiration
2038-12-21

AI Technical Summary

Technical Problem

In existing graph-based semi-supervised learning, Euclidean distance cannot accurately represent the degree of similarity between samples, resulting in reduced accuracy of semi-supervised learning and online learning.

Method used

The Mahalanobis distance is used to represent the similarity between samples, and the positive semi-definite matrix is ​​constrained by pairwise constraints to ensure that the distance between samples with the same category labels is small and the distance between samples with different category labels is large, thereby improving classification accuracy.

Benefits of technology

By satisfying the pairwise constraint of the Mahalanobis distance, it accurately represents the degree of sample similarity, improves the classification accuracy of semi-supervised learning, makes the label confidence of online learning high, and is suitable for systems without human calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111353516B_ABST
    Figure CN111353516B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a sample classification method for online learning, which is used to improve the classification accuracy of semi-supervised learning. The method of the present application includes: obtaining a target sample set, the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label; determining the pairwise constraints of the multiple training samples according to the first category label; determining a semi-positive definite matrix that satisfies the pairwise constraints; determining the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix; determining the second category label of the prediction sample according to the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm, thereby improving the classification accuracy of semi-supervised learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a sample classification method and a model updating method for online learning. Background Art

[0002] In the training phase of machine learning, samples with category labels are very scarce, while samples without category labels are relatively easy to obtain and are numerous. Since semi-supervised learning combines samples without category labels with a small number of samples with category labels during the training phase, compared with supervised learning that uses only category-labeled samples, semi-supervised learning can reduce training costs while ensuring model accuracy.

[0003] Online learning algorithms can update supervised models online by obtaining correct category labels and predicted labels of supervised models. Online learning methods are mainly used in systems that can obtain data annotations in real time. In systems without user feedback, online learning needs to solve the problem of how to obtain correct category labels. In one implementation method, the correct category labels can be obtained through a graph-based semi-supervised learning model.

[0004] In traditional graph-based semi-supervised learning, a weight graph is constructed, and each sample (including samples with category labels and samples without category labels) is used as a node in the graph. The similarity between samples is used as the weight of the edge in the weight graph. The label information in the weight graph is gradually transferred from samples with category labels to samples without category labels through a graph-based semi-supervised learning algorithm, thereby labeling samples without category labels and achieving sample classification.

[0005] However, in the prior art, the Euclidean distance between sample eigenvalues ​​is usually used as the similarity between samples. Since the Euclidean distance between sample eigenvalues ​​can only reflect the distance between eigenvalues, there are often cases where the Euclidean distance between eigenvalues ​​is small and the samples belong to different categories, or the Euclidean distance between eigenvalues ​​is large and the samples belong to the same category. Therefore, the Euclidean distance cannot accurately represent the similarity between samples, thereby reducing the classification accuracy of semi-supervised learning, and further reducing the accuracy of online learning. Summary of the invention

[0006] The embodiments of the present application provide a sample classification method, a model updating method and a server for online learning, which use Mahalanobis distance to represent the similarity between samples, and use pairwise constraints to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraints can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance composed of the semi-positive definite matrix that satisfies the pairwise constraints can accurately represent the similarity between samples, thereby improving the classification accuracy of semi-supervised learning.

[0007] The first aspect of the embodiment of the present application provides a sample classification method for online learning, including: obtaining a target sample set, the target sample set including multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label; determining the pairwise constraints of the multiple training samples according to the first category label; determining a semi-positive definite matrix that satisfies the pairwise constraints; determining the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix; determining the second category label of the prediction sample according to the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm. In the embodiment of the present application, the Euclidean distance between each sample is not directly determined by multiple training samples and prediction samples, but the pairwise constraints of the multiple training samples are determined according to the first category label, and the pairwise constraints can be used to constrain the semi-positive definite matrix in the Mahalanobis distance between every two samples. Since the pairwise constraints can ensure that the distance between training samples with the same category label in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance including the semi-positive definite matrix that satisfies the pairwise constraints can accurately represent the similarity between samples. In the above manner, the Mahalanobis distance is used to represent the similarity between samples, and the pairwise constraint is used to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraint can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance composed of the semi-positive definite matrix that satisfies the pairwise constraint can accurately represent the similarity between samples, thereby improving the classification accuracy of semi-supervised learning.

[0008] In an optional design of the first aspect, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance of any two training samples with different first category labels is greater than or equal to a first non-negative value. In this embodiment, the server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can minimize the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance of any two training samples with different first category labels is greater than or equal to a first non-negative value. The pairwise constraint is obtained through training of training samples and first category labels. While minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, by constraining the Mahalanobis distance of any two training samples with different first category labels to be greater than or equal to a first non-negative value, samples belonging to the same category are clustered most closely, and the intervals between samples belonging to different categories are kept at a certain distance.

[0009] In an optional design of the first aspect, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels. The server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can minimize the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximize the sum of squared Mahalanobis distances between the training samples with different first category labels. The pairwise constraint is obtained through training with training samples and first category labels. While minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, the sum of squared Mahalanobis distances between the training samples with different first category labels is maximized, so that samples belonging to the same category are clustered most closely, and samples belonging to the same category are kept in the most sparse state.

[0010] In an optional design of the first aspect, the pairwise constraint includes: maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance of any two training samples with the same first category label is less than or equal to a second non-negative value. The server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can maximize the sum of squared Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance of any two training samples with the same first category label is less than or equal to a second non-negative value. The pairwise constraint is obtained through training with training samples and first category labels. While maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels, by constraining the Mahalanobis distance of any two training samples with the same first category label to be less than or equal to a second non-negative value, the closeness between samples of the same category is within a certain range, and the samples of different categories remain in the most sparse state.

[0011] In an optional design of the first aspect, the second category label of the predicted sample is determined by a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between each two samples, including: determining the similarity of each two samples according to the Gaussian kernel function and the Mahalanobis distance; determining the label transfer probability between each two samples according to the similarity; and determining the second category label of the predicted sample by a label expansion algorithm according to the label transfer probability. The graph-based semi-supervised learning algorithm in the embodiment of the present application can also be a label expansion algorithm, a semi-supervised learning algorithm based on Gaussian fields and harmonic functions, a locally and globally consistent semi-supervised learning algorithm, a popular regularization algorithm, an alternating minimization graph direct inference algorithm, etc.

[0012] The second aspect of an embodiment of the present application provides a model updating method, including: the server first obtains a target sample set, the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label, the server then determines the third category label of the prediction sample according to the supervised learning model, the server then determines the pairwise constraints of the multiple training samples according to the first category label, the server then determines a semi-positive definite matrix that satisfies the pairwise constraints, the server then determines the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, the server then determines the second category label of the prediction sample according to the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm, the server then determines the loss value of the supervised learning model according to the second category label and the third category label, and finally the server updates the supervised learning model through an online learning algorithm according to the loss value. Through the above method, on the one hand, in the semi-supervised learning model, the Mahalanobis distance is used to represent the similarity between samples, and the pairwise constraint is used to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraint can ensure that the distance between training samples with the same category label in the training sample is small, and the distance between training samples with different category labels in the training sample is large, the Mahalanobis distance composed of the semi-positive definite matrix that satisfies the pairwise constraint can accurately represent the similarity between samples, thereby improving the classification accuracy of the semi-supervised learning model, so that the confidence of the second category label obtained by the semi-supervised learning model is high, and it can be used as the correct label of the online learning algorithm to update the supervision model; on the other hand, in this implementation, each time a predicted sample is obtained, the predicted sample is sent to the two models respectively. After being sent to the supervision model, the third category label of the predicted sample is obtained as the result of this prediction. In addition, it is sent to the semi-supervised learning model, and the semi-supervised learning model combines the pre-stored sample library to give the second category label. After the second category label predicted by the semi-supervised learning model, the supervision model is updated online using the online learning algorithm, so that the online learning algorithm can be applied in a system without manual calibration.

[0013] In an optional design of the second aspect, the updating of the supervised learning model through an online learning algorithm according to the loss value includes: determining the sample size of the prediction samples; if the sample size is equal to a preset value, updating the supervised learning model through an online learning algorithm according to the loss value. The update rate of the online learning algorithm for updating the supervised model can be controlled by setting the sample size of the input prediction samples. The supervised model is updated only after the number of prediction samples reaches a preset value. In this embodiment, the application flexibility of this embodiment is improved by adjusting the update rate of the supervised model.

[0014] In an optional design of the second aspect, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance of any two training samples with different first category labels is greater than or equal to a first non-negative value. In this embodiment, the server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can minimize the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance of any two training samples with different first category labels is greater than or equal to a first non-negative value. The pairwise constraint is obtained through training with training samples and first category labels. While minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, by constraining the Mahalanobis distance of any two training samples with different first category labels to be greater than or equal to a first non-negative value, samples belonging to the same category are clustered most closely, and the intervals between samples belonging to different categories are kept at a certain distance.

[0015] In an optional design of the second aspect, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels. The server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can minimize the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximize the sum of squared Mahalanobis distances between the training samples with different first category labels. The pairwise constraint is obtained through training with training samples and first category labels. While minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, the sum of squared Mahalanobis distances between the training samples with different first category labels is maximized, so that samples belonging to the same category are clustered most closely, and samples belonging to the same category are kept in the most sparse state.

[0016] In an optional design of the second aspect, the pairwise constraint includes: maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance of any two training samples with the same first category label is less than or equal to a second non-negative value. The server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can maximize the sum of squared Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance of any two training samples with the same first category label is less than or equal to a second non-negative value. The pairwise constraint is obtained through training with training samples and first category labels. While maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels, by constraining the Mahalanobis distance of any two training samples with the same first category label to be less than or equal to a second non-negative value, the closeness between samples of the same category is within a certain range, and the samples of different categories remain in the most sparse state.

[0017] In an optional design of the second aspect, the second category label of the predicted sample is determined by a graph-based semi-supervised learning algorithm based on the Mahalanobis distance of each two samples, including: determining the similarity of each two samples according to the Gaussian kernel function and the Mahalanobis distance; determining the label transfer probability between each two samples according to the similarity; and determining the second category label of the predicted sample by a label expansion algorithm according to the label transfer probability. In an optional design of the first aspect, the second category label of the predicted sample is determined by a graph-based semi-supervised learning algorithm based on the Mahalanobis distance of each two samples, including: determining the similarity of each two samples according to the Gaussian kernel function and the Mahalanobis distance; determining the label transfer probability between each two samples according to the similarity; and determining the second category label of the predicted sample by a label expansion algorithm according to the label transfer probability. The graph-based semi-supervised learning algorithm in the embodiment of the present application can also be a label expansion algorithm, a semi-supervised learning algorithm based on Gaussian fields and harmonic functions, a locally and globally consistent semi-supervised learning algorithm, a popular regularization algorithm, an alternating minimization graph direct push algorithm, and the like.

[0018] In an optional design of the second aspect, the supervised learning model is a decision tree model, a support vector machine model or a deep learning model.

[0019] In an optional design of the second aspect, the online learning algorithm is a stochastic gradient descent algorithm or a small batch gradient descent algorithm.

[0020] A third aspect of an embodiment of the present application provides a server, which can execute the method described in the first aspect.

[0021] A fourth aspect of an embodiment of the present application provides a server, which can execute the method described in the second aspect above.

[0022] A fifth aspect of an embodiment of the present application provides a server comprising at least one connected processor, memory and transceiver, wherein the memory is used to store program code, and the processor is used to call the program code in the memory to execute the methods described in the above aspects.

[0023] In a sixth aspect, the present application provides a computer storage medium, which includes instructions, and when the instructions are executed on a computer, the computer executes the methods described in the above aspects.

[0024] A seventh aspect of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the methods described in the above aspects.

[0025] It can be seen from the above technical solutions that this application has the following advantages:

[0026] The embodiment of the present application provides a sample classification method for online learning, wherein the server first obtains a target sample set, wherein the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label, and then the server determines the pairwise constraints of the multiple training samples according to the first category label, and then the server determines the semi-positive definite matrix that satisfies the pairwise constraints, and then the server determines the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and finally the server determines the second category label of the prediction sample according to the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm. In the above manner, the Mahalanobis distance is used to represent the similarity between samples, and the pairwise constraints are used to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraints can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance formed by the semi-positive definite matrix that satisfies the pairwise constraints can accurately represent the similarity between samples, thereby improving the classification accuracy of semi-supervised learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A schematic diagram of a distance metric;

[0028] Figure 2 A schematic diagram of an embodiment of a sample classification method for online learning in an embodiment of the present application;

[0029] Figure 3 A schematic diagram of an embodiment of a model updating method in an embodiment of the present application;

[0030] Figure 4 A schematic diagram of a system framework provided for an embodiment of the present application;

[0031] Figure 5 A schematic diagram of an embodiment of a server in an embodiment of the present application;

[0032] Figure 6 A schematic diagram of an embodiment of a server in an embodiment of the present application;

[0033] Figure 7 A schematic diagram of the structure of a server in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The embodiment of the present invention provides a sample classification method for online learning, which uses the Mahalanobis distance to represent the similarity between samples, and uses the pairwise constraint to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraint can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance formed by the semi-positive definite matrix that satisfies the pairwise constraint can accurately represent the similarity between samples, thereby improving the classification accuracy of semi-supervised learning.

[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0036] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present 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 data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0037] In traditional graph-based semi-supervised learning, a weight graph is constructed, each sample (including samples with category labels and samples without category labels) is used as a node in the graph, and the similarity between samples is used as the weight of the edge in the weight graph. The label information in the weight graph is gradually transferred from samples with category labels to samples without category labels through a graph-based semi-supervised learning algorithm, so that samples without category labels are labeled, thereby achieving sample classification. However, the Euclidean distance between sample feature values ​​is usually used as the similarity between samples in the prior art. Since the Euclidean distance between sample feature values ​​can only reflect the distance between feature values, there are often cases where the Euclidean distance between feature values ​​is small and the samples belong to different categories, or the Euclidean distance between feature values ​​is large and the samples belong to the same category. Therefore, the Euclidean distance cannot accurately represent the similarity between samples, thereby reducing the classification accuracy of semi-supervised learning.

[0038] Please refer to Figure 1 , Figure 1 A schematic diagram of a distance metric. Figure 1 In the example, the Euclidean distance between point B and point C is relatively close. However, in reality, point A and point B belong to the same category, that is, point A and point B are more similar. However, the Euclidean distance measurement method cannot accurately reflect the Figure 1 The distance distribution in .

[0039] To solve the above problems, the following example illustrates a sample classification method for online learning provided by this application. Figure 2 , the method mainly comprises:

[0040] 201. The server obtains a target sample set, where the target sample set includes multiple training samples and prediction samples, wherein each training sample corresponds to a first category label.

[0041] In an embodiment of the present application, the server first obtains a target sample set, wherein the target sample set includes multiple training samples and prediction samples. It should be noted that this embodiment does not limit the order in which the training samples and prediction samples are obtained. For example, the server may pre-store multiple training samples. After receiving the input prediction sample, it is equivalent to obtaining a target sample set including multiple training samples and prediction samples. For another example, the server may not pre-store multiple training samples, but may simultaneously obtain multiple training samples and prediction samples when performing sample classification.

[0042] In the embodiment of the present application, the target sample set includes multiple training samples and prediction samples, wherein the training samples and prediction samples can be images in image recognition, speech signals in speech recognition, etc. The training samples and prediction samples can be represented by digital features, which are composed of multiple variables to describe the characteristics of the sample. For example, in image recognition, the feature can be the color value of each pixel in the image, the texture feature vector of the image, the color histogram of the image, etc.; in speaker recognition, the feature can be the cepstral coefficients and fundamental frequency obtained from the speech signal. For the convenience of description, "feature value" is used below to represent the digital features of the training samples and prediction samples.

[0043] In an embodiment of the present application, the training samples in the target sample set are labeled samples. Specifically, each training sample corresponds to a first category label. In this embodiment, when the server obtains the target sample set, in addition to obtaining multiple training samples, it can also obtain the first category label corresponding to the training sample. It should be noted that the first category label can be a target value. For example, in two-category image recognition, for the first category of images, the first category label can be 1, and for the second category of images, the first category label can be -1; in speaker recognition, the first category label can be the speaker's number, etc.

[0044] In the embodiment of the present application, the prediction samples in the target sample set are unlabeled samples. Specifically, each training sample has no corresponding category label. When the server obtains the target sample set, it only needs to obtain the prediction samples. In one scenario, the server can obtain one or more prediction samples at the same time, or can obtain multiple prediction samples in sequence, which is not limited here.

[0045] In the embodiment of the present application, illustratively, the server may obtain the following target sample set:

[0046] X={X L ,X U};

[0047] Among them, X L ={(x1,y1),…,(x m ,y m )} are multiple training samples and the corresponding first category labels, x1,…,x m are training samples, m is the number of training samples, m is a positive integer greater than 1, y1,…,y m are the first category labels corresponding to the training samples, for example, y1 is the first category label of x1; U ={x m+1 ,…,x n} is a prediction sample, there are nm prediction samples in total, and n is a positive integer greater than m.

[0048] In the embodiment of the present application, after the server obtains the target sample set, it is equivalent to completing the preparation work for sample acquisition. In the scenario of graph-based semi-supervised learning, the server then needs to construct a graph G = (V, E) based on multiple training samples and prediction samples. G can be an undirected graph, where the node set V = x1, ..., x m , x m+1 ,…,x n represents all samples in the target sample set, each node corresponds to a training sample or a prediction sample, and the weight of any edge in the edge set E represents the similarity between two samples in the target sample set. How to measure the similarity between two samples will be described in the following embodiments.

[0049] Next, the connection of the edges in the graph G is explained. The graph G can be a fully connected graph, a k-nearest neighbor graph, or an εNN graph. Among them, there are edges between any two nodes in the fully connected graph. The k-nearest neighbor graph needs to first determine the nearest k neighbor nodes of any node, and connect the node with the nearest k neighbor nodes. In the εNN graph, there are edges between nodes that satisfy the node distance less than ε. Since the k-nearest neighbor graph and the εNN graph require the server to search for the neighbors of any node, which has a high time complexity, the graph G in this embodiment is a fully connected graph.

[0050] 202. The server determines pairwise constraints of the plurality of training samples according to the first category labels.

[0051] 203. The server determines a semi-positive definite matrix that satisfies the pairwise constraints.

[0052] 204. The server determines a Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix.

[0053] In this embodiment, in the scenario of graph-based semi-supervised learning, the server usually needs to measure the distance between every two samples in the graph G, for example, using a fixed metric such as Euclidean distance to represent the distance between every two samples in the graph G. Since the Euclidean distance between samples can only reflect the distance between their eigenvalues, but there are often cases where the Euclidean distance between eigenvalues ​​is small and the samples belong to different categories, or the Euclidean distance between eigenvalues ​​is large and the samples belong to the same category, fixed metrics such as Euclidean distance cannot accurately represent the distance between samples. It should be noted that the distance between two samples in the embodiment of the present application can be understood as the distance between the eigenvalues ​​corresponding to the two samples.

[0054] In the embodiment of the present application, the Euclidean distance between each sample is not directly determined by multiple training samples and prediction samples, but the pairwise constraints of the multiple training samples are determined according to the first category label, and the pairwise constraints can be used to constrain the semi-positive definite matrix in the Mahalanobis distance between every two samples. Since the pairwise constraints can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance including the semi-positive definite matrix that satisfies the pairwise constraints can accurately represent the similarity between samples.

[0055] In an embodiment of the present application, the server may first train the training samples and the first category labels, determine the pairwise constraints of the multiple training samples, then determine a semi-positive definite matrix that satisfies the pairwise constraints, and finally determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix.

[0056] In one embodiment, the pairwise constraint may include: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

[0057] In this embodiment, the server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can minimize the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance of any two training samples with different first category labels is greater than or equal to a first non-negative value. The pairwise constraints are obtained through training with training samples and first category labels. While minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, by constraining the Mahalanobis distance of any two training samples with different first category labels to be greater than or equal to the first non-negative value, samples belonging to the same category are clustered most closely, and the intervals between samples belonging to different categories are kept at a certain distance.

[0058] In this embodiment, the semi-positive definite matrix can satisfy the following pairwise constraints:

[0059]

[0060] std(x i ,x j )≥T h1 (i,j)∈D

[0061] Where (i, j)∈S means that the first category labels of sample i and sample j are the same, (i, j)∈D means that the first category labels of sample i and sample j are the same or different, W is a semi-positive definite matrix, is the sum of squared Mahalanobis distances between sample i and sample j, st is the constraint condition, T h1 is the first non-negative value, and T represents transpose.

[0062] In one embodiment, the pairwise constraint may include: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels.

[0063] In this embodiment, the server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can minimize the sum of squares of Mahalanobis distances between the training samples with the same first category label, and maximize the sum of squares of Mahalanobis distances between the training samples with different first category labels. The pairwise constraints are obtained through training with training samples and first category labels. While minimizing the sum of squares of Mahalanobis distances between the training samples with the same first category label, the sum of squares of Mahalanobis distances between the training samples with different first category labels is maximized, so that samples belonging to the same category are clustered most closely and samples belonging to the same category are kept in the sparsest state.

[0064] In this embodiment, the semi-positive definite matrix can satisfy the following pairwise constraints:

[0065]

[0066]

[0067] Where (i, j)∈S means that the first category labels of sample i and sample j are the same, (i, j)∈D means that the first category labels of sample i and sample j are the same or different, W is a semi-positive definite matrix, is the sum of squared Mahalanobis distances between sample i and sample j, and st is the constraint condition.

[0068] In one embodiment, the pairwise constraint may include: maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

[0069] In this embodiment, the server determines the pairwise constraints of multiple training samples through multiple training samples and corresponding first category labels. Specifically, the server can maximize the sum of squares of Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance of any two training samples with the same first category label is less than or equal to a second non-negative value. The pairwise constraints are obtained through training with training samples and first category labels. While maximizing the sum of squares of Mahalanobis distances between the training samples with different first category labels, by constraining the Mahalanobis distance of any two training samples with the same first category label to be less than or equal to the second non-negative value, the closeness between samples of the same category is within a certain range, and samples of different categories remain in the sparsest state.

[0070] In this embodiment, the semi-positive definite matrix can satisfy the following pairwise constraints:

[0071]

[0072] std(x i ,x j )≤T h2 (i,j)∈S.

[0073] Where (i, j)∈S means that the first category labels of sample i and sample j are the same, (i, j)∈D means that the first category labels of sample i and sample j are the same or different, W is a semi-positive definite matrix, is the sum of squared Mahalanobis distances between sample i and sample j, st is the constraint condition, T h2 is the second non-negative value.

[0074] In the embodiment of the present application, after training the training samples and the first category labels and determining the pairwise constraints of the multiple training samples, the server may determine a semi-positive definite matrix W that satisfies the pairwise constraints.

[0075] In the embodiment of the present application, after determining the semi-positive definite matrix W that satisfies the pairwise constraint, the Mahalanobis distance between every two samples in the target sample set may be determined according to the semi-positive definite matrix W.

[0076] In the embodiment of the present application, the server measures the distance between each two samples in the graph G by the Mahalanobis distance, where the Mahalanobis distance can be defined as follows:

[0077] d ij =(x i -x j ) T W(x i -x j );

[0078] Among them, dij is the Mahalanobis distance between sample i and sample j, W is the semi-positive definite matrix in the Mahalanobis distance, optionally, W is a semi-positive definite symmetric matrix, x i is sample i, x j For example, if sample i is a training sample and sample j is a prediction sample, then d ij represents the Mahalanobis distance between a training sample and a prediction sample. For another example, if sample i is a training sample and sample j is a training sample, then d ij represents the Mahalanobis distance between a training sample and a training sample. For another example, when the number of prediction samples is greater than 1, sample i is the prediction sample, and sample j is the prediction sample, then d ij Represents the Mahalanobis distance between a prediction sample and a prediction sample.

[0079] In the embodiment of the present application, since the semi-positive definite matrix W satisfies the pairwise constraint, the Mahalanobis distance determined by the semi-positive definite matrix can accurately reflect the distance between samples.

[0080] 205. The server determines the second category label of the predicted sample by using a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between every two samples.

[0081] In an embodiment of the present application, after determining the Mahalanobis distance between each two sample nodes in the graph G, the server can determine the similarity between each two sample nodes in the graph G based on the Mahalanobis distance, and then use the similarity as the weight of the edge between each two sample nodes in the graph G.

[0082] In one embodiment, the similarity between each two samples may be determined according to a Gaussian kernel function and the Mahalanobis distance. Specifically, the weight of the edge between each two sample nodes in the graph G may be calculated by a Gauss radial basis function (RBF). For example, the weight of the edge between each two sample nodes in the graph G may be calculated by the following formula:

[0083]

[0084] Among them, α is the control parameter.

[0085] In an embodiment of the present application, after obtaining the weight (similarity) of the edge between each two sample nodes in the graph G, the server can determine the second category label of the predicted sample through a graph-based semi-supervised learning algorithm, wherein the graph-based semi-supervised learning algorithm can be a label propagation algorithm (LPA), a semi-supervised learning algorithm based on Gaussian fields and harmonic functions (SLG), a local and global consistency semi-supervised learning algorithm (LGC), a manifold regularization algorithm (MR), a graph transduction via alternative minimization (GTAM), and the like.

[0086] In one embodiment, the server may diffuse the first category labels of multiple training samples in the graph G to the prediction samples through a label expansion algorithm according to the similarity, and then determine the second category labels of the prediction samples.

[0087] In one embodiment of the label expansion algorithm, let x1,…,x m is the training sample, x m+1 ,…,x n is the prediction sample, m is the number of training samples, and n is the total number of training samples and prediction samples. In this embodiment, the server can first determine the label transfer probability between each two samples according to the similarity to obtain a probability transfer matrix P:

[0088]

[0089] Among them, P ij It represents the probability of class i transferring to class j.

[0090] In this embodiment, for m training samples, a label matrix y is defined as l , the dimension is m×C. For training samples and prediction samples, define a label matrix f=[f l ,f u ] T , the dimension is n×C, where C is the number of labels, f l is the category label of the training sample, f u is the category label of the predicted sample to be requested.

[0091] In this embodiment, spreading the first category labels of multiple training samples in the graph G to the prediction samples by using the label expansion algorithm may include the following steps:

[0092] Input: probability transfer matrix P, label matrix y l and label matrix f.

[0093] (1) Initialize the label matrix f, let f l =y l .

[0094] (2) Label matrix transfer: f t+1 =Pf t .

[0095] (3) f t+1 The category label of the corresponding training sample is fixed to y l .

[0096] Repeat (2) and (3) until convergence.

[0097] Output: predicted class label f ​​of the sample u is the second category label.

[0098] It should be noted that in the above algorithm, the initialization value of f can be random, and f can converge to a fixed value through iteration.

[0099] In another embodiment of the label extension algorithm, let Y(Y L , Y U ) and Y′=(Y L ′,Y U ′) represent the initial given category labels and the final category labels on the training samples and prediction samples, respectively.

[0100] In this embodiment, spreading the first category labels of multiple training samples in the graph G to the prediction samples by using the label expansion algorithm may include the following steps:

[0101] Input: weight matrix S of the edge between each two sample nodes, initial label Y.

[0102] (1) Define the diagonal matrix D = (D ij ) n×c , where D ii =∑ j S ij ,D ij =0(i≠j).

[0103] (2) Initialize Y′ (0) =Y, given β∈(0,1) and a number close to 0 ε>0, let

[0104] (3) Let A be a diagonal matrix, where A ii =I [L] (i)+uD ii +uε, where I [L] It is a deformation of the identity matrix, where the row and column labels of the diagonal elements are 0 if they correspond to unlabeled data.

[0105] (4) Iterative calculation of Y′ (t+1) =A -1 (uSY′ (t) +Y′ (0) ) until convergence.

[0106] Output: predicted sample category label Y U ' is the second category label.

[0107] In another embodiment of the label extension algorithm, Y=(Y L , Y U ) and Y′=(Y L ′,Y U ′) represent the initial given category labels and the final category labels on the training samples and prediction samples, respectively.

[0108] In this embodiment, spreading the first category labels of multiple training samples in the graph G to the prediction samples by using the label expansion algorithm may include the following steps:

[0109] Input: weight matrix S of the edge between each two sample nodes, initial label Y.

[0110] (1) Define the diagonal matrix D = (D ij ) n×c , where D ii =∑ j S ij ,D ij =0(i≠j).

[0111] (2) Order Initialize Y′ (0) =Y, given γ∈[0,1).

[0112] (3) Iterative calculation Until convergence.

[0113] Output: predicted sample category label Y U ' is the second category label.

[0114] In this embodiment, the semi-positive definite matrix W used to measure the Mahalanobis distance between samples satisfies the pairwise constraint, so the Mahalanobis distance can accurately reflect the distance between samples. Correspondingly, the second category label of the predicted sample is determined relatively accurately according to the Mahalanobis distance between each two samples through a graph-based semi-supervised learning algorithm.

[0115] Secondly, in an embodiment of the present application, the server first obtains a target sample set, the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label, the server then determines the pairwise constraints of the multiple training samples according to the first category label, the server then determines a semi-positive definite matrix that satisfies the pairwise constraints, the server then determines the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and the server finally determines the second category label of the prediction sample according to the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm. In the above manner, the Mahalanobis distance is used to represent the similarity between samples, and the pairwise constraints are used to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraints can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance composed of the semi-positive definite matrix that satisfies the pairwise constraints can accurately represent the similarity between samples, thereby improving the classification accuracy of semi-supervised learning.

[0116] It should be noted that the sample classification method for online learning in the embodiment of the present application can be applied but not limited to scenarios such as model updating, image classification, and speech recognition that require high-precision classification performance.

[0117] The above is a description of a sample classification method for online learning. The following is a description of a model updating method.

[0118] The existing online learning algorithm compares the predicted label obtained by the supervision model with the correct label obtained in real time, and determines a loss value through the correct label and the predicted label. The loss value can be used to measure the gap between the predicted label and the correct label, and the loss value is used to update the supervision model.

[0119] Since it is necessary to obtain the correct labels in real time, the existing online learning algorithms are mainly used in some systems that can obtain data labels in real time. In one scenario, online learning algorithms can be used in online recommendation systems. In such systems, category labels can be obtained online through user feedback and other methods. In another scenario, online learning algorithms can be used in social network analysis tasks, such as automatic annotation of social images. Users can continuously upload new pictures, find similar pictures based on the existing model, and give recommended labels based on the label information of similar pictures. Users will give feedback on the recommended labels, and finally update the model based on the feedback.

[0120] However, in some systems without user feedback, how to obtain the correct category labels in real time is a problem that needs to be solved.

[0121] To solve the above problems, the embodiment of the present application marks the newly acquired prediction samples through a semi-supervised learning module, and replaces the manual labeling method with the semi-supervised learning module. After the semi-supervised learning module marks the samples, the model is updated using an online learning algorithm.

[0122] The following is an example of a model updating method provided by this application. Please refer to Figure 3 , the method mainly comprises:

[0123] 301. The server obtains a target sample set, where the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label.

[0124] The specific details of step 301 can be found in the description of step 201 and will not be repeated here.

[0125] 302. The server determines a third category label of the predicted sample according to the supervised learning model.

[0126] In this embodiment, the server may determine the third category label of the predicted sample based on a supervised learning model, wherein the supervised learning model may be a decision tree model, a support vector machine model, a deep learning model, or the like.

[0127] In this embodiment, in the offline learning stage, the supervised learning model is trained by a sample library. The sample set included in the sample library needs to cover comprehensive scenarios, and each scenario requires a large number of samples. The semi-supervised learning model also needs to maintain a sample library, which includes the above-mentioned multiple training samples. The embodiment of the present application replaces the manual labeling method with a semi-supervised learning module. Since the output of the semi-supervised learning module needs to be used as the input of the online learning algorithm in real time, the labeling efficiency of the semi-supervised learning module is required to be high. In order to improve the processing efficiency of the semi-supervised learning module, the multiple training samples in the sample library maintained by the semi-supervised learning model contain more comprehensive scenarios, and only a small number of training samples are required in each scenario.

[0128] This embodiment improves the processing efficiency of the semi-supervised learning model by setting the scenarios included in the multiple training samples to be relatively comprehensive and requiring only a small number of training samples in each scenario.

[0129] It should be noted that, since the number of samples in the sample library for training the supervised learning model is large, the sample library for training the supervised learning model in this application can be an offline sample library, and the server is not maintained online. However, the number of samples in the sample library for training the semi-supervised learning model is small, and the sample library for training the semi-supervised learning model in this application can be an online database, and the server can be maintained online.

[0130] In one embodiment, the server may also obtain data without category labels for testing the classification effect of the semi-supervised learning model.

[0131] 303. The server determines pairwise constraints of the multiple training samples according to the first category labels.

[0132] The specific details of step 303 can be found in the description of step 202 and will not be repeated here.

[0133] 304. The server determines a semi-positive definite matrix that satisfies the pairwise constraints.

[0134] The specific details of step 304 can be found in the description of step 203 and will not be repeated here.

[0135] 305. The server determines a Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix.

[0136] The specific details of step 305 can be found in the description of step 204 and will not be repeated here.

[0137] 306. The server determines a second category label of the predicted sample by using a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between every two samples.

[0138] The specific details of step 306 can be found in the description of step 205 and will not be repeated here.

[0139] 307. The server determines a loss value of the supervised learning model according to the second category label and the third category label.

[0140] In an embodiment of the present application, the server determines the third category label of the predicted sample based on the supervised learning model, and determines the second category label of the predicted sample through a graph-based semi-supervised learning algorithm. The server is equivalent to obtaining the predicted label and the correct label of the predicted sample. The server can calculate the loss value of the supervised learning model based on the predicted label and the correct label. It should be noted that the loss value in this embodiment can also be understood as a loss function.

[0141] 308. The server updates the supervised learning model through an online learning algorithm according to the loss value.

[0142] In this embodiment, the online update algorithm of the supervised model can be implemented using a stochastic gradient descent (SGD) method suitable for small batch learning or a mini-batch gradient descent (MBGD) algorithm. The specific processes of the two algorithms are described below.

[0143] 1. Stochastic gradient descent method.

[0144] In one embodiment, the loss function J(θ) may be a squared loss function, then Taking partial derivative of the loss function Jθ we get:

[0145]

[0146] Among them, h θ Represents the gradient of the model, that is, the update formula of the stochastic gradient descent method is:

[0147] θ t+1 =θ t +η(y (i) -h θ (x (i) ))x (i) ;

[0148] Among them, η is the preset learning step size.

[0149] In this embodiment, updating the supervised learning model by stochastic gradient descent method according to the loss value may include the following steps:

[0150] Input: supervised model parameters θ, n prediction samples (x(i) ,y (i) , i=1,2,…n).

[0151] (1)For t=1,2,…,T Do.

[0152] (2) Randomly select i from {1,,2,…n}.

[0153] (3)θ t+1 =θ t +η(y (i) -h θ (x (i) ))x (i) , where η is the preset learning step size.

[0154] (4)END For.

[0155] Output θ t+1 .

[0156] 2. Mini-batch gradient descent algorithm.

[0157] In one embodiment, taking the mini-batch gradient descent algorithm MSGD as an example, the loss function J(θ) may be a square loss function, then Taking the partial derivative of the loss function J(θ) yields:

[0158]

[0159] Among them, h θ Represents the gradient of the model, and the update formula of the mini-batch gradient descent algorithm is:

[0160]

[0161] Among them, η is the preset learning step size.

[0162] Please refer to Figure 4 , Figure 4 A schematic diagram of a system framework provided for an embodiment of the present application. In this embodiment, a supervised model for prediction needs to be obtained in the offline learning stage. The training method of the supervised model is consistent with the traditional machine learning method, and can be obtained by training using labeled samples. The supervised learning model can be a decision tree model, a support vector machine model, or a deep learning model.

[0163] In this embodiment, a semi-supervised learning model for marking prediction samples needs to be obtained in the online learning stage. The semi-supervised learning model needs to be trained using a pre-stored sample library.

[0164] During the online learning phase, the process is as follows Figure 4As shown in the figure. Each time the server obtains a prediction sample, it sends the prediction sample to the two models. After sending it to the supervised model, the third category label of the prediction sample is obtained as the result of this prediction. In addition, it is sent to the semi-supervised learning model, which combines the pre-stored sample library to give the second category label. After obtaining the second category label predicted by the semi-supervised learning model, the supervised model is updated online using the online learning algorithm.

[0165] It should be noted that in the embodiment of the present application, in the semi-supervised learning model, the Mahalanobis distance is used to represent the similarity between samples, and the pairwise constraint is used to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraint can ensure that the distance between training samples with the same category labels in the training samples is small, and the distance between training samples with different category labels in the training samples is large, the Mahalanobis distance composed of the semi-positive definite matrix that satisfies the pairwise constraint can accurately represent the similarity between samples, thereby improving the classification accuracy of the semi-supervised learning model, so that the confidence of the second category label obtained by the semi-supervised learning model is higher, and can be used as the correct label of the online learning algorithm to update the supervised model.

[0166] Secondly, in an embodiment of the present application, the server first obtains a target sample set, wherein the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label, and the server then determines the third category label of the prediction sample based on the supervised learning model, and the server then determines the pairwise constraints of the multiple training samples based on the first category label, and the server then determines a semi-positive definite matrix that satisfies the pairwise constraints, and the server then determines the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and the server then determines the second category label of the prediction sample based on the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm, and the server then determines the loss value of the supervised learning model based on the second category label and the third category label, and the server finally updates the supervised learning model through an online learning algorithm based on the loss value. Through the above method, on the one hand, in the semi-supervised learning model, the Mahalanobis distance is used to represent the similarity between samples, and the pairwise constraint is used to constrain the semi-positive definite matrix in the Mahalanobis distance. Since the pairwise constraint can ensure that the distance between training samples with the same category label in the training sample is small, and the distance between training samples with different category labels in the training sample is large, the Mahalanobis distance composed of the semi-positive definite matrix that satisfies the pairwise constraint can accurately represent the similarity between samples, thereby improving the classification accuracy of the semi-supervised learning model, so that the confidence of the second category label obtained by the semi-supervised learning model is high, and it can be used as the correct label of the online learning algorithm to update the supervision model; on the other hand, in this implementation, each time a predicted sample is obtained, the predicted sample is sent to the two models respectively. After being sent to the supervision model, the third category label of the predicted sample is obtained as the result of this prediction. In addition, it is sent to the semi-supervised learning model, and the semi-supervised learning model combines the pre-stored sample library to give the second category label. After the second category label predicted by the semi-supervised learning model, the supervision model is updated online using the online learning algorithm, so that the online learning algorithm can be applied in a system without manual calibration.

[0167] Optional, in Figure 3 On the basis of the corresponding embodiments, in a first optional embodiment provided by the present application, updating the supervised learning model through an online learning algorithm according to the loss value includes:

[0168] Determining the sample size of the prediction sample;

[0169] If the number of samples is equal to a preset value, the supervised learning model is updated through an online learning algorithm according to the loss value.

[0170] In this embodiment, the update rate of the online learning algorithm for updating the supervision model can be controlled by setting the sample number of the input prediction samples. When the number of prediction samples reaches a preset value, the supervision model is updated once.

[0171] In this embodiment, by adjusting the update rate of the supervision model, the update of the supervision model can be adapted to scenarios with different sample change rates.

[0172] Secondly, in this embodiment, the sample number of the predicted sample is determined. If the sample number is equal to a preset value, the supervised learning model is updated through an online learning algorithm according to the loss value. The application flexibility of this embodiment is improved by adjusting the update rate of the supervised model.

[0173] The following describes a server that executes the above-mentioned sample classification method for online learning. The server can execute the above-mentioned Figure 2 The technical solution shown. Figure 5 , the server includes:

[0174] The transceiver module 501 is used to obtain a target sample set, where the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label;

[0175] A processing module 502 is used to determine the pairwise constraints of the plurality of training samples according to the first category labels;

[0176] determining a semi-positive definite matrix that satisfies the pairwise constraints;

[0177] Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix;

[0178] The second category label of the predicted sample is determined by a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between each two samples.

[0179] In this embodiment, the transceiver module 501 obtains a target sample set, wherein the target sample set includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label; the processing module 502 is used to determine the pairwise constraints of the multiple training samples according to the first category label; determine a semi-positive definite matrix that satisfies the pairwise constraints; determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix; and determine the second category label of the prediction sample according to the Mahalanobis distance between every two samples through a graph-based semi-supervised learning algorithm.

[0180] Optionally, in some embodiments, the pairwise constraints include:

[0181] The sum of squares of Mahalanobis distances between the training samples with the same first category labels is minimized, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

[0182] Optionally, in some embodiments, the pairwise constraints include:

[0183] The sum of squared Mahalanobis distances between the training samples with the same first category label is minimized, and the sum of squared Mahalanobis distances between the training samples with different first category labels is maximized.

[0184] Optionally, in some embodiments, the pairwise constraints include:

[0185] The sum of squares of Mahalanobis distances between the training samples with different first category labels is maximized, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

[0186] Optionally, in some embodiments, the processing module 502 is further configured to determine the similarity between every two samples according to the Gaussian kernel function and the Mahalanobis distance;

[0187] Determine the label transfer probability between every two samples according to the similarity;

[0188] The second category label of the predicted sample is determined by a label expansion algorithm according to the label transition probability.

[0189] The following describes a server that executes the above model classification method. The server can execute the above Figure 3 The technical solution shown. Figure 6 , the server includes:

[0190] The transceiver module 601 is used to obtain a target sample set, where the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label;

[0191] A processing module 602 is used to determine a third category label of the predicted sample according to a supervised learning model;

[0192] Determining pairwise constraints of the plurality of training samples according to the first category labels;

[0193] determining a semi-positive definite matrix that satisfies the pairwise constraints;

[0194] Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix;

[0195] Determine a second category label of the predicted sample by a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between each two samples;

[0196] Determining a loss value of the supervised learning model according to the second category label and the third category label;

[0197] The supervised learning model is updated through an online learning algorithm according to the loss value.

[0198] Optionally, in some embodiments, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

[0199] Optionally, in some embodiments, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels.

[0200] Optionally, in some embodiments, the pairwise constraint includes: maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

[0201] Optionally, in some embodiments, determining the second category label of the predicted sample according to the Mahalanobis distance between each two samples through a graph-based semi-supervised learning algorithm includes: determining the similarity between each two samples according to a Gaussian kernel function and the Mahalanobis distance; determining the label transfer probability between each two samples according to the similarity; and determining the second category label of the predicted sample through a label expansion algorithm according to the label transfer probability.

[0202] Optionally, in some embodiments, the processing module is further used to determine the sample quantity of the predicted sample;

[0203] If the number of samples is equal to a preset value, the supervised learning model is updated through an online learning algorithm according to the loss value.

[0204] Optionally, in some embodiments, the supervised learning model is a decision tree model, a support vector machine model or a deep learning model.

[0205] Optionally, in some embodiments, the online learning algorithm is a stochastic gradient descent algorithm or a mini-batch gradient descent algorithm.

[0206] In this embodiment, the transceiver module 601 obtains a target sample set, which includes multiple training samples and prediction samples, wherein each of the training samples corresponds to a first category label; the processing module 602 determines the third category label of the prediction sample according to the supervised learning model; determines the pairwise constraints of the multiple training samples according to the first category label; determines a semi-positive definite matrix that satisfies the pairwise constraints; determines the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix; determines the second category label of the prediction sample through a graph-based semi-supervised learning algorithm based on the Mahalanobis distance between every two samples; determines the loss value of the supervised learning model according to the second category label and the third category label; and updates the supervised learning model through an online learning algorithm according to the loss value.

[0207] Figure 7 : is a schematic diagram of a server structure provided by an embodiment of the present invention. The server 700 may have relatively large differences due to different configurations or performances. It may include one or more central processing units (full name in English: central processing units, abbreviated in English: CPU) 722 (for example, one or more processors) and a memory 732, and one or more storage media 730 (for example, one or more mass storage devices) storing application programs 742 or data 744. Among them, the memory 732 and the storage medium 730 can be short-term storage or permanent storage. The program stored in the storage medium 730 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 722 can be configured to communicate with the storage medium 730 to execute a series of instruction operations in the storage medium 730 on the server 700.

[0208] The server 700 may also include one or more power supplies 726, one or more wired or wireless network interfaces 750, one or more input and output interfaces 758, and / or one or more operating systems 741, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0209] The steps performed by the server in the above embodiment can be based on the Figure 7 Specifically, the central processor 722 performs the following operations by calling program instructions:

[0210] Acquire a target sample set, wherein the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label;

[0211] Determining pairwise constraints of the plurality of training samples according to the first category labels;

[0212] determining a semi-positive definite matrix that satisfies the pairwise constraints;

[0213] Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix;

[0214] The second category label of the predicted sample is determined by a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between each two samples.

[0215] Optionally, the pairwise constraints include:

[0216] The sum of squares of Mahalanobis distances between the training samples with the same first category labels is minimized, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

[0217] Optionally, the pairwise constraints include:

[0218] The sum of squared Mahalanobis distances between the training samples with the same first category label is minimized, and the sum of squared Mahalanobis distances between the training samples with different first category labels is maximized.

[0219] Optionally, the pairwise constraints include:

[0220] The sum of squares of Mahalanobis distances between the training samples with different first category labels is maximized, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

[0221] Optionally, the central processor 722 specifically performs the following operations:

[0222] Determine the similarity between each two samples according to the Gaussian kernel function and the Mahalanobis distance;

[0223] Determine the label transfer probability between every two samples according to the similarity;

[0224] The second category label of the predicted sample is determined by a label expansion algorithm according to the label transition probability.

[0225] The CPU 722 can also perform the following operations by calling program instructions:

[0226] Acquire a target sample set, wherein the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label;

[0227] Determine a third category label of the predicted sample according to a supervised learning model;

[0228] Determining pairwise constraints of the plurality of training samples according to the first category labels;

[0229] determining a semi-positive definite matrix that satisfies the pairwise constraints;

[0230] Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix;

[0231] Determine a second category label of the predicted sample by a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between each two samples;

[0232] Determining a loss value of the supervised learning model according to the second category label and the third category label;

[0233] The supervised learning model is updated through an online learning algorithm according to the loss value.

[0234] Optionally, the pairwise constraint includes: minimizing the sum of squares of Mahalanobis distances between the training samples with the same first category labels, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

[0235] Optionally, the pairwise constraint includes: minimizing the sum of squared Mahalanobis distances between the training samples with the same first category label, and maximizing the sum of squared Mahalanobis distances between the training samples with different first category labels.

[0236] Optionally, the pairwise constraint includes: maximizing the sum of squares of Mahalanobis distances between the training samples with different first category labels, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

[0237] Optionally, the central processor 722 specifically performs the following operations:

[0238] The similarity between each two samples is determined according to the Gaussian kernel function and the Mahalanobis distance; the label transfer probability between each two samples is determined according to the similarity; and the second category label of the predicted sample is determined by a label expansion algorithm according to the label transfer probability.

[0239] Optionally, updating the supervised learning model through an online learning algorithm according to the loss value includes: determining the sample size of the prediction sample; if the sample size is equal to a preset value, updating the supervised learning model through an online learning algorithm according to the loss value.

[0240] Optionally, the supervised learning model is a decision tree model, a support vector machine model or a deep learning model.

[0241] Optionally, the online learning algorithm is a stochastic gradient descent algorithm or a small batch gradient descent algorithm.

[0242] The present application also provides a computer storage medium storing a program, which, when executed, includes the apparatus for processing crowdsourced test data executing part or all of the steps in the method for processing crowdsourced test data.

[0243] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0244] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0245] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0246] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0247] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0248] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0249] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center to another website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0250] The technical solution provided by the present application is introduced in detail above. The principles and implementation methods of the present application are explained by using specific examples in the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A sample classification method for online learning, characterized in that: include: Acquire a target sample set, wherein the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label; Determining pairwise constraints of the plurality of training samples according to the first category labels; determining a semi-positive definite matrix that satisfies the pairwise constraints; Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and the Mahalanobis distance between every two samples includes the Mahalanobis distance between every two training samples, the Mahalanobis distance between every two prediction samples, and the Mahalanobis distance between each training sample and each prediction sample; According to the Mahalanobis distance between every two samples, a graph-based semi-supervised learning algorithm is used to diffuse the first category labels of the multiple training samples in the fully connected graph constructed based on the semi-supervised learning algorithm to the predicted samples, so as to determine the second category labels of the predicted samples.

2. The method according to claim 1, characterized in that The pairwise constraints include: The sum of squares of Mahalanobis distances between the training samples with the same first category labels is minimized, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

3. The method according to claim 1, characterized in that The pairwise constraints include: The sum of squared Mahalanobis distances between the training samples with the same first category label is minimized, and the sum of squared Mahalanobis distances between the training samples with different first category labels is maximized.

4. The method according to claim 1, characterized in that: The pairwise constraints include: The sum of squares of Mahalanobis distances between the training samples with different first category labels is maximized, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

5. The method according to any one of claims 1 to 4, characterized in that: The method of diffusing the first category labels of the plurality of training samples in the fully connected graph constructed based on the semi-supervised learning algorithm to the prediction sample by using a graph-based semi-supervised learning algorithm according to the Mahalanobis distance between each two samples to determine the second category label of the prediction sample includes: Determine the similarity between each two samples according to the Gaussian kernel function and the Mahalanobis distance; Determine the label transfer probability between every two samples according to the similarity; The second category label of the predicted sample is determined by a label expansion algorithm according to the label transition probability.

6. A model updating method, characterized in that: include: Acquire a target sample set, wherein the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label; Determine a third category label of the predicted sample according to a supervised learning model; Determining pairwise constraints of the plurality of training samples according to the first category labels; determining a semi-positive definite matrix that satisfies the pairwise constraints; Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and the Mahalanobis distance between every two samples includes the Mahalanobis distance between every two training samples, the Mahalanobis distance between every two prediction samples, and the Mahalanobis distance between each training sample and each prediction sample; According to the Mahalanobis distance between each two samples, a graph-based semi-supervised learning algorithm is used to diffuse the first category labels of the plurality of training samples in the fully connected graph constructed based on the semi-supervised learning algorithm to the prediction sample, so as to determine the second category label of the prediction sample; Determining a loss value of the supervised learning model according to the second category label and the third category label; The supervised learning model is updated through an online learning algorithm according to the loss value.

7. The method according to claim 6, characterized in that The updating of the supervised learning model by an online learning algorithm according to the loss value includes: Determining the sample size of the prediction sample; If the number of samples is equal to a preset value, the supervised learning model is updated through an online learning algorithm according to the loss value.

8. The method according to claim 6, characterized in that The supervised learning model is a decision tree model, a support vector machine model or a deep learning model.

9. The method according to any one of claims 6 to 8, characterized in that: The online learning algorithm is a stochastic gradient descent algorithm or a small batch gradient descent algorithm.

10. A server, characterized in that: include: A transceiver module, used to obtain a target sample set, wherein the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label; A processing module, configured to determine pairwise constraints of the plurality of training samples according to the first category labels; determining a semi-positive definite matrix that satisfies the pairwise constraints; Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and the Mahalanobis distance between every two samples includes the Mahalanobis distance between every two training samples, the Mahalanobis distance between every two prediction samples, and the Mahalanobis distance between each training sample and each prediction sample; According to the Mahalanobis distance between every two samples, a graph-based semi-supervised learning algorithm is used to diffuse the first category labels of the multiple training samples in the fully connected graph constructed based on the semi-supervised learning algorithm to the predicted samples, so as to determine the second category labels of the predicted samples.

11. The server according to claim 10, characterized in that: The pairwise constraints include: The sum of squares of Mahalanobis distances between the training samples with the same first category labels is minimized, and the Mahalanobis distance between any two training samples with different first category labels is greater than or equal to a first non-negative value.

12. The server according to claim 10, characterized in that: The pairwise constraints include: The sum of squared Mahalanobis distances between the training samples with the same first category label is minimized, and the sum of squared Mahalanobis distances between the training samples with different first category labels is maximized.

13. The server according to claim 10, characterized in that: The pairwise constraints include: The sum of squares of Mahalanobis distances between the training samples with different first category labels is maximized, and the Mahalanobis distance between any two training samples with the same first category label is less than or equal to a second non-negative value.

14. The server according to any one of claims 10 to 13, characterized in that: The processing module is further used to determine the similarity between every two samples according to the Gaussian kernel function and the Mahalanobis distance; Determine the label transfer probability between every two samples according to the similarity; The second category label of the predicted sample is determined by a label expansion algorithm according to the label transition probability.

15. A server, characterized in that: include: A transceiver module, used to obtain a target sample set, wherein the target sample set includes a plurality of training samples and prediction samples, wherein each of the training samples corresponds to a first category label; A processing module, used to determine a third category label of the predicted sample according to a supervised learning model; Determining pairwise constraints of the plurality of training samples according to the first category labels; determining a semi-positive definite matrix that satisfies the pairwise constraints; Determine the Mahalanobis distance between every two samples in the target sample set, wherein the Mahalanobis distance includes the semi-positive definite matrix, and the Mahalanobis distance between every two samples includes the Mahalanobis distance between every two training samples, the Mahalanobis distance between every two prediction samples, and the Mahalanobis distance between each training sample and each prediction sample; According to the Mahalanobis distance between each two samples, a graph-based semi-supervised learning algorithm is used to diffuse the first category labels of the plurality of training samples in the fully connected graph constructed based on the semi-supervised learning algorithm to the prediction sample, so as to determine the second category label of the prediction sample; Determining a loss value of the supervised learning model according to the second category label and the third category label; The supervised learning model is updated through an online learning algorithm according to the loss value.

16. The server according to claim 15, characterized in that The processing module is further used to determine the sample quantity of the predicted sample; If the number of samples is equal to a preset value, the supervised learning model is updated through an online learning algorithm according to the loss value.

17. The server according to claim 15, characterized in that The supervised learning model is a decision tree model, a support vector machine model or a deep learning model.

18. The server according to any one of claims 15 to 17, characterized in that: The online learning algorithm is a stochastic gradient descent algorithm or a small batch gradient descent algorithm.