Method for determining uncertainty measures of classification models
By calculating the prediction loss and calibration error of the classification model, the uncertainty measurement of the model is determined based on these indicators, and the problem of single angle evaluation of uncertainty measurement methods in the prior art is solved, achieving a more accurate and reliable model uncertainty evaluation.
Patent Information
- Application Number
- CN202411823804.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, model uncertainty measurement methods are only evaluated from a single perspective and cannot ensure accuracy in different application scenarios, increasing potential risks.
By obtaining the sample dataset, inputting it into the classification model to obtain prediction results, calculating prediction losses and calibration errors, the uncertainty measure of the model is determined based on these metrics.
The uncertainty of the classification model is achieved from a multi-angle perspective, which significantly reduces the potential risks caused by inaccurate model uncertainty estimates, and improves the accuracy of model optimization and improvement.
Smart Images

Figure CN119782764A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically to a method and apparatus for determining uncertainty measures of a classification model, a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of computer technology and artificial intelligence technology, machine learning has been widely studied and applied in many fields, resulting in the emergence of various machine learning models (or neural network models). Machine learning models are widely used in various fields, such as natural language processing, image processing, computer vision, speech recognition, intelligent control, etc. However, due to the uncertainty of machine learning models, this needs to be taken into account when using models for analysis and prediction. Model uncertainty refers to the degree of uncertainty in the output of the model, that is, the possible errors or deviations in the output of the model under given input conditions, which reflects the reliability and credibility of the model's prediction of new data. This uncertainty may come from many aspects, such as the estimation error of model parameters, the uncertainty of input data, the limitations of the model structure, etc. Therefore, it is very important to evaluate and analyze the uncertainty of the model, for example, it can improve the reliability of the model, optimize the model decision, and promote model improvement and optimization.
[0003] In the model uncertainty measurement determination methods of related technologies, there are only indicators that evaluate model uncertainty from a single perspective for specific scenarios, which cannot guarantee the accuracy of the uncertainty (or reliability) assessment of the model in different application scenarios, thereby increasing the potential risks caused by inaccurate model uncertainty estimation (such as being unable to better guide (or even incorrectly guide) model optimization and improvement). Summary of the invention
[0004] The present application provides a classification model uncertainty metric determination method and apparatus, computing equipment, computer-readable storage medium, and computer program product, which are expected to alleviate, mitigate, or even eliminate some or all of the above-mentioned problems and other possible problems.
[0005] According to one aspect of the present application, a method for determining an uncertainty measure of a classification model is proposed, comprising: obtaining a sample data set for evaluating the uncertainty of a classification model, each sample data in the sample data set comprising an original evaluation sample and a corresponding classification label; for each sample data in the sample data set, inputting the original evaluation sample into a classification model to obtain a first predicted classification result, the first predicted classification result comprising a first predicted category and a first predicted probability corresponding to the original evaluation sample; calculating a first prediction loss of the classification model based on the difference between the first predicted probability and the classification label corresponding to each sample data in the sample data set to obtain a first uncertainty estimate; calculating a first calibration error of the classification model based on the difference between the first predicted category and the classification label and the first predicted probability corresponding to each sample data in the sample data set to obtain a second uncertainty estimate; and determining the uncertainty measure of the classification model based at least on the first uncertainty estimate and the second uncertainty estimate.
[0006] In some embodiments of the present application, an uncertainty measure of the classification model is determined based on at least a first uncertainty estimate and a second uncertainty estimate, including: calculating a first classification effect indicator of the classification model according to the classification label corresponding to each sample data in the sample data set and the first prediction probability to obtain a third uncertainty estimate; determining the uncertainty measure of the classification model based on the first uncertainty estimate, the second uncertainty estimate and the third uncertainty estimate.
[0007] In some embodiments of the present application, a first prediction loss of a classification model is calculated based on the difference between a first prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a first uncertainty estimate, including: calculating the negative log-likelihood loss of the classification model based on the difference between the first prediction probability corresponding to each sample data and the classification label; calculating the Bell score loss of the classification model based on the difference between the first prediction probability corresponding to each sample data and the classification label; and determining the first uncertainty estimate based on at least one of the negative log-likelihood loss and the Bell score loss.
[0008] In some embodiments of the present application, a first calibration error of the classification model is calculated based on the difference between the first predicted category and the classification label and the first predicted probability corresponding to each sample data in the sample data set to obtain a second uncertainty estimate, including: calculating the expected calibration error of the classification model based on the difference between the first predicted category and the classification label and the first predicted probability corresponding to each sample data; calculating the adaptive expected calibration error of the classification model based on the difference between the first predicted category and the classification label and the first predicted probability corresponding to each sample data; and determining the second uncertainty estimate based on at least one of the expected calibration error and the adaptive expected calibration error.
[0009] In some embodiments of the present application, a first classification effect indicator of the classification model is calculated according to the classification label corresponding to each sample data in the sample data set and the first predicted probability to obtain a third uncertainty estimate, including: calculating the area under the receiver operating characteristic curve according to the classification label corresponding to each sample data, the first predicted probability and multiple preset classification probability thresholds; calculating the area under the precision-recall curve according to the classification label corresponding to each sample data, the first predicted probability and multiple preset classification probability thresholds; determining the third uncertainty estimate according to at least one of the area under the receiver operating characteristic curve and the area under the precision-recall curve.
[0010] In some embodiments of the present application, the area under the receiver operating characteristic curve is calculated according to the classification label, the first predicted probability and multiple preset classification probability thresholds corresponding to each sample data, including: determining the true positive rate and the false positive rate under the multiple preset classification probability thresholds according to the classification label, the first predicted probability and multiple preset classification probability thresholds corresponding to each sample data; constructing a receiver operating characteristic curve corresponding to the classification model in a plane rectangular coordinate system based on the true positive rate and the false positive rate under the multiple preset classification probability thresholds; calculating the area of the region enclosed by the receiver operating characteristic curve corresponding to the classification model and the horizontal axis and vertical axis of the plane rectangular coordinate system.
[0011] In some embodiments of the present application, the area under the precision-recall curve is calculated according to the classification label, the first prediction probability and multiple preset classification probability thresholds corresponding to each sample data, including: determining the precision and recall under the multiple preset classification probability thresholds according to the classification label, the first prediction probability and multiple preset classification probability thresholds corresponding to each sample data; constructing a precision-recall curve corresponding to the classification model in a plane rectangular coordinate system based on the precision and recall under the multiple preset classification probability thresholds; calculating the area of the region enclosed by the precision-recall curve corresponding to the classification model and the horizontal axis and vertical axis of the plane rectangular coordinate system.
[0012] In some embodiments of the present application, an uncertainty measure of a classification model is determined based on a first uncertainty estimate, a second uncertainty estimate, and a third uncertainty estimate, including: taking the inverse of the first uncertainty estimate to obtain a first index; taking the inverse of the second uncertainty estimate to obtain a second index; and calculating the product of the first index, the second index, and the third uncertainty estimate to determine the uncertainty score of the classification model.
[0013] In the classification model uncertainty measure determination method according to some embodiments of the present application, it further includes: for each sample data in the sample data set, applying perturbation to the original evaluation sample to obtain a perturbation evaluation sample; for each sample data in the sample data set, inputting the perturbation evaluation sample into the classification model to obtain a second prediction classification result, the second prediction classification result includes a second prediction category and a second prediction probability corresponding to the perturbation evaluation sample; calculating the second prediction loss of the classification model according to the difference between the second prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a fourth uncertainty estimate; calculating the second calibration error of the classification model according to the difference between the second prediction category corresponding to each sample data in the sample data set and the classification label and the second prediction probability to obtain a fifth uncertainty estimate; determining the robustness measure of the uncertainty measure of the classification model based on at least the difference between the fourth uncertainty estimate and the first uncertainty estimate and the difference between the fifth uncertainty estimate and the second uncertainty estimate.
[0014] In some embodiments of the present application, a robustness measure of the uncertainty metric of the classification model is determined based at least on the difference between the fourth uncertainty estimate and the first uncertainty estimate and the difference between the fifth uncertainty estimate and the second uncertainty estimate, including: calculating the second classification effect indicator of the classification model according to the classification label corresponding to each sample data in the sample data set, the second prediction probability, and multiple preset classification probability thresholds to obtain a sixth uncertainty estimate; determining the robustness measure of the uncertainty metric of the classification model based on the difference between the fourth uncertainty estimate and the first uncertainty estimate, the difference between the fifth uncertainty estimate and the second uncertainty estimate, and the difference between the sixth uncertainty estimate and the third uncertainty estimate.
[0015] In some embodiments of the present application, for each sample data in the sample data set, a disturbance is applied to the original evaluation sample to obtain a disturbed evaluation sample, including: for each sample data in the sample data set, in response to the original evaluation sample of the sample data being a picture sample, rain, snow or fog noise is applied to the original evaluation sample to obtain a disturbed evaluation sample; for each sample data in the sample data set, in response to the original evaluation sample of the sample data being a non-picture sample, Gaussian noise is applied to the original evaluation sample to obtain a disturbed evaluation sample.
[0016] In some embodiments of the present application, the classification model includes an integrated classification model composed of at least one classification sub-model, and for each sample data in the sample data set, the original evaluation sample is input into the classification model to obtain a first predicted classification result, including: for each classification sub-model in the integrated classification model, the original evaluation sample of each sample data in the sample data set is input into the classification sub-model respectively to obtain the predicted classification probability of each sample data under the classification sub-model; for each sample data, the arithmetic mean of the predicted classification probabilities of the sample data under each classification sub-model is calculated to obtain the first predicted classification result of the sample data under the integrated model, and the first predicted classification result includes the first predicted category and the first predicted probability corresponding to the original evaluation sample.
[0017] According to another aspect of the present application, a classification model uncertainty measure determination device is provided, comprising: a sample data acquisition module, configured to acquire a sample data set for evaluating the uncertainty of the classification model, each sample data in the sample data set comprising an original evaluation sample and a corresponding classification label; a classification model prediction module, configured to input the original evaluation sample into the classification model for each sample data in the sample data set to obtain a first predicted classification result, the first predicted classification result comprising a first predicted category and a first predicted probability corresponding to the original evaluation sample; a prediction loss calculation module, configured to calculate a first prediction loss of the classification model according to the difference between the first predicted probability corresponding to each sample data in the sample data set and the classification label to obtain a first uncertainty estimate; a calibration error calculation module, configured to calculate a first calibration error of the classification model according to the difference between the first predicted category corresponding to each sample data in the sample data set and the classification label and the first predicted probability to obtain a second uncertainty estimate; an evaluation result determination module, configured to determine the uncertainty measure of the classification model based at least on the first uncertainty estimate and the second uncertainty estimate.
[0018] According to another aspect of the present application, a computing device is proposed, comprising: a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is prompted to execute a method for determining a classification model uncertainty measure according to some embodiments of the present application.
[0019] According to another aspect of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed, the methods according to some embodiments of the present application are implemented.
[0020] According to another aspect of the present application, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the steps of the method according to some embodiments of the present application are implemented.
[0021] In the classification model uncertainty metric determination method and device according to some embodiments of the present application, first, the uncertainty metric determination process of the classification model is divided into a calculation process of multi-dimensional indicators (such as a first uncertainty estimate or a sample-level uncertainty estimate and a second uncertainty estimate or a task-level uncertainty estimate) for different types of application scenarios, thereby achieving a reliable and accurate evaluation of the uncertainty of the classification model from multiple angles and in an all-round manner, significantly reducing the potential risks caused by inaccurate model uncertainty estimates, and thus better guiding the optimization and improvement of the model to improve the model's prediction accuracy and computational efficiency; secondly, the calculated multi-dimensional uncertainty estimation indicators are comprehensively considered to obtain the final Uncertainty metrics (such as uncertainty estimation scores) are provided, thereby providing researchers or engineers with a unified and reliable standard for determining model uncertainty metrics, ensuring the accuracy of uncertainty or reliability assessment of the model in various application scenarios, and achieving applicability to a wider range of application scenarios; in addition, the classification model uncertainty metric determination method and device according to some embodiments of the present application can be used to determine the uncertainty metric of an integrated classification model composed of multiple classification (sub) models with the same task, thereby achieving combined optimization of multiple classification models that complete the same overall task, taking into account the reliability or accuracy of model prediction and the high efficiency of model prediction, saving computing resources, optimizing resource scheduling, and reducing business costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The various aspects, features and advantages of the present application will be readily understood from the following detailed description and accompanying drawings, in which:
[0023] Figure 1 An exemplary application scenario of a classification model uncertainty metric determination method according to some embodiments of the present application is shown;
[0024] Figure 2 An exemplary principle block diagram of a classification model uncertainty measure determination method according to some embodiments of the present application is shown;
[0025] Figure 3 A flowchart of a method for determining uncertainty measure of a classification model according to some embodiments of the present application is schematically shown;
[0026] Figure 4 Schematically illustrating an example process of predicted loss calculation steps according to some embodiments of the present application;
[0027] Figure 5 Schematically illustrating an example process of calibration error calculation steps according to some embodiments of the present application;
[0028] Figure 6Schematically illustrating an example process of an evaluation result determination step according to some embodiments of the present application;
[0029] Figure 7 Schematically illustrating an example process of an evaluation result determination step according to some embodiments of the present application;
[0030] Figure 8 An example radar chart of uncertainty measures obtained by the classification model uncertainty measure determination method according to some embodiments of the present application is schematically shown;
[0031] Fig. 9 Schematically illustrates an example application of a classification model uncertainty measure determination method according to some implementations of the present application - combined optimization of multiple classification models with the same task;
[0032] Fig.10 An example flowchart of a classification model uncertainty metric determination method in an image recognition scenario according to some embodiments of the present application is shown;
[0033] Fig.11 A flowchart of a method for determining uncertainty measure of a classification model according to some embodiments of the present application is schematically shown;
[0034] Fig.12 An example block diagram schematically shows an apparatus for determining uncertainty measure of a classification model according to some embodiments of the present application; and
[0035] Fig.13 An example block diagram of a computing device according to some embodiments of the present application is schematically shown.
[0036] It should be noted that the above drawings are merely schematic and illustrative and are not necessarily drawn to scale. DETAILED DESCRIPTION
[0037] Several embodiments of the present application will be described in more detail below with reference to the accompanying drawings so that those skilled in the art can implement the present application. The present application can be embodied in many different forms and purposes and should not be limited to the embodiments described herein. These embodiments are provided to make the present application comprehensive and complete, and to fully convey the scope of the present application to those skilled in the art. The embodiments do not limit the present application.
[0038] It will be understood that, although the terms first, second, third, etc. may be used to describe various elements, components and / or parts in this article, these elements, components and / or parts should not be limited by these terms. These terms are only used to distinguish one element, component or part from another element, component or part. Therefore, the first element, component or part discussed below may be referred to as the second element, component or part without departing from the teaching of the application.
[0039] The terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the application. As used herein, the singular forms "one", "one" and "the" are intended to also include plural forms, unless the context clearly indicates otherwise. It will be further understood that the terms "include" and / or "comprise" specify the existence of the features, integral bodies, steps, operations, elements and / or parts when used in this specification, but do not exclude the existence of one or more other features, integral bodies, steps, operations, elements, parts and / or their groups or add one or more other features, integral bodies, steps, operations, elements, parts and / or their groups. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0040] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meanings as those commonly understood by those skilled in the art to which this application belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having meanings consistent with their meanings in the relevant field and / or the context of this specification, and will not be interpreted in an idealized or overly formal sense, unless explicitly defined as such herein.
[0041] Before describing the embodiments of the present application in detail, some related concepts are first explained for the sake of clarity.
[0042] 1. Model uncertainty: refers to the degree of uncertainty in the model output, that is, the errors or deviations that may exist in the model output under given input conditions. This uncertainty may come from many aspects, such as estimation errors of model parameters, uncertainty of input data, limitations of model structure, etc. Determination of model uncertainty measurement is an important means to improve model reliability and optimize decision-making. In this application, for the classification model, various uncertainty measurement determination methods and / or evaluation indicators (such as the first uncertainty estimate and the second uncertainty estimate) are comprehensively considered to obtain a more comprehensive and accurate uncertainty measurement determination result.
[0043] 2. Prediction loss of classification model: refers to the method used to evaluate the difference or consistency between the prediction result of the classification model and the true label, which indicates the closeness of the model's prediction result to the actual situation. The smaller the prediction loss, the closer the model's prediction result is to the true label, and the better the model performance. Common classification prediction losses include: cross entropy loss, mean square error loss, logarithmic loss, Brier score loss, classification cross entropy loss, etc.
[0044] 3. Calibration error of classification model: It is a method to evaluate the difference between the overall prediction probability of the classification model (e.g., multiple probability intervals) and the overall classification accuracy (e.g., the average value of the classification labels over multiple probability intervals). A well-calibrated model should be able to accurately predict the probability that a sample belongs to each category. Classification calibration error can include: expected calibration error (ECE) and adaptive expected calibration error (AECE).
[0045] 4. Classification effect indicators of classification models: used to evaluate the classification performance of classification models for unknown samples. Common classification effect indicators include: accuracy, precision, recall, F1-score (harmonic mean of precision and recall), ROC (receiver operating characteristic curve), AUROC (area under the ROC curve), AUPRC (area under the precision-recall curve), etc.
[0046] 5. Uncertainty measure of classification model: refers to the evaluation result of the uncertainty of the classification model, that is, one or more numerical values used to quantify the uncertainty of the classification model, such as the uncertainty estimation score obtained based on various uncertainty estimates.
[0047] 6. Robustness of model uncertainty measurement: refers to the degree to which the model maintains the stability of uncertainty performance (i.e., uncertainty estimation measurement) (e.g., model output or prediction results) when facing various changes and interferences (e.g., input data). It can usually be characterized by the changes in uncertainty estimation measurement or various evaluation indicators when the model is subjected to data interference from input noise (i.e., perturbed data).
[0048] In view of the problem that there are only indicators for evaluating the uncertainty of (classification) models from a single perspective for specific scenarios in related technologies, which makes it impossible to guarantee the accuracy of the uncertainty (or reliability) evaluation of the model in different application scenarios (i.e., the problem of the lack of a unified evaluation standard for uncertainty estimation of classification models in related technologies), this application proposes an end-to-end classification model uncertainty measurement determination strategy. This strategy evaluates the uncertainty of the model from multiple perspectives and returns an uncertainty measurement (such as an uncertainty estimation score or a radar chart composed of multiple uncertainty estimation indicators) for quantifying the uncertainty or reliability of the model to be evaluated, achieving the goal of defining the model credibility from the perspective of uncertainty measurement determination.
[0049] Specifically, in the classification model uncertainty metric determination strategy according to some embodiments of the present application, first, a sample data set for calculating a multidimensional indicator for evaluating the uncertainty of the classification model is obtained, which includes input samples and classification labels; secondly, the classification model is used to obtain the predicted classification results (including predicted classifications and predicted probabilities) corresponding to the sample data set; thirdly, the comparison or difference between the predicted classification results and the classification labels is used to calculate the multidimensional (at least two temperatures) uncertainty estimation indicators, that is, the sample-level uncertainty estimate (that is, the first uncertainty estimate) is obtained by calculating the prediction loss of the classification model and the task-level uncertainty estimate (that is, the second uncertainty estimate) is obtained by calculating the calibration error of the classification model; finally, the calculated multidimensional uncertainty estimation indicators are comprehensively processed (for example, positive correlation processing and combination) to obtain the final uncertainty metric. The innovative conception of the classification model uncertainty metric determination strategy according to the present application is as follows: the uncertainty metric determination process of the classification model is divided into a calculation process of multi-dimensional (at least two dimensions) indicators (i.e., a first uncertainty estimate or a sample-level uncertainty estimate and a second uncertainty estimate or a task-level uncertainty estimate, optionally including a third uncertainty estimate or a sorting-level uncertainty estimate) for different types of application scenarios, and the calculated multi-dimensional uncertainty estimation indicators are comprehensively considered (for example, indicators are added or multiplied) to obtain the final uncertainty metric (for example, an uncertainty estimation score), thereby achieving the applicability of uncertainty assessment to a wider range of application scenarios and significantly improving the accuracy and reliability of uncertainty metric determination.
[0050] First, the classification model uncertainty measurement determination strategy according to the present application can provide researchers and engineers with a unified evaluation standard, so that in the process of model development and tuning, the uncertainty of the model can be measured more accurately, so as to better guide the optimization and improvement of the model. This will help improve the performance of the model and its reliability in practical application scenarios, and reduce the potential risks caused by inaccurate model uncertainty estimation. Secondly, the classification model uncertainty measurement determination strategy according to the present application can help enterprises and institutions provide decision makers with a new measurement standard from the perspective of uncertainty measurement determination when facing multiple model choices. By comparing the uncertainty estimation metrics of different models (such as uncertainty scores and radar charts), enterprises and institutions can be assisted to understand the advantages and disadvantages of each model more comprehensively, so as to make more informed decisions in the process of product development and deployment. In summary, the classification model uncertainty measurement determination strategy proposed in this application plays an important role in product development, model selection, applicability of a wide range of application scenarios, model interpretability, and robustness, which helps to promote the development of artificial intelligence products and improve the quality and credibility of products.
[0051] Figure 1 FIG. 1 shows an exemplary application scenario 100 of a classification model uncertainty metric determination method according to some embodiments of the present application. Figure 1 As shown, the application scenario 100 may include a server 110 , and may optionally include an external database 120 , a network 130 , and a terminal device 140 , wherein the terminal device 140 may be controlled by a user 150 .
[0052] According to some embodiments of the present application, the classification model uncertainty metric determination method can be deployed on the server 110 and implemented by the server 110. The server 110 can be configured to: first, obtain a sample data set for evaluating the uncertainty of the classification model (for example, from the external database 120), wherein each sample data includes an original evaluation sample and a corresponding classification label; second, for each sample data in the sample data set, input the original evaluation sample into the classification model to obtain a first prediction classification result, and the first prediction classification result includes a first prediction category and a first prediction probability corresponding to the original evaluation sample; third, calculate the first prediction loss of the classification model according to the difference between the first prediction probability and the classification label corresponding to each sample data in the sample data set to obtain a first uncertainty estimate; then, calculate the first calibration error of the classification model according to the difference between the first prediction category and the classification label corresponding to each sample data in the sample data set and the first prediction probability to obtain a second uncertainty estimate; finally, determine the uncertainty metric of the classification model based on at least the first uncertainty estimate and the second uncertainty estimate.
[0053] Exemplarily, the server 110 can store and run instructions that can execute the various methods described herein (e.g., classification model uncertainty metric determination method). The server 110 can be a single server or a server cluster, or can be a cloud server or cloud server cluster that can provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. It should be understood that the server mentioned herein can typically be a server computer with a large amount of memory and processor resources, but other embodiments are also possible. In addition, the server 110 is shown only as an example. In fact, other devices or combinations of devices with computing power and storage capacity can also be used alternatively or additionally to provide corresponding services.
[0054] like Figure 1As shown, optionally, the application scenario 100 may further include an external database 120 and a network 130. The server 110 may be connected to the external database 120 via the network 130, so as to obtain, for example, a sample data set for determining uncertainty metrics from the database 120, including the original evaluation samples and the corresponding classification labels, and, for example, store the uncertainty metrics of the classification model finally obtained in the database 120, etc. Exemplarily, the database 120 may be an independent data storage device or device group, or may also be a backend data storage device or device group related to other online services (such as online services that provide functions such as intelligent customer service and voice assistants).
[0055] like Figure 1 As shown, optionally, the application scenario 100 may further include a terminal device 140, which may be connected to the server 110 via the network 130. Figure 1 As shown, the user 150 of the terminal device 140 can access the server 110 through the terminal device 140 via the network 130 to obtain the services provided by the server 110. For example, the user 150 can input instructions through the user interface provided by the terminal device 140, such as through a physical input device (such as a keyboard and / or a mouse, etc.) or a virtual key (such as a touch screen), through voice or gesture instructions, etc., so as to, for example, start a classification model uncertainty metric determination strategy or scheme deployed on the server 110, send classification model information to be evaluated and / or a sample data set for determining the uncertainty metric for the classification model to be evaluated, receive the obtained uncertainty metric determination result (i.e., uncertainty metric), etc.
[0056] Exemplarily, examples of the network 130 include a local area network (LAN), a wide area network (WAN), a personal area network (PAN), and / or a combination of communication networks such as the Internet. Each of the server 110, the database 120, and the terminal device 140 may include at least one communication interface (not shown) capable of communicating through the network 130. Such a communication interface may be one or more of the following: any type of network interface (e.g., a network interface card (NIC)), a wired or wireless (such as an IEEE 802.11 wireless LAN (WLAN)) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, etc.
[0057] like Figure 1As shown, the terminal device 140 can be any type of mobile computing device, including a mobile computer (e.g., a personal digital assistant (PDA), a laptop computer, a notebook computer, a tablet computer, a netbook, etc.), a mobile phone (e.g., a cellular phone, a smart phone, etc.), a wearable computing device (e.g., a smart watch, a head-mounted device, including smart glasses, etc.) or other types of mobile devices. In some embodiments, the terminal device 140 can also be a fixed computing device, such as a desktop computer, a game console, a smart TV, etc. In addition, when the application scenario 100 includes multiple terminal devices 140, the multiple terminal devices 140 can be computing devices of the same or different types.
[0058] Exemplarily, the terminal device 140 may include a display screen and a terminal application that can interact with the terminal user via the display screen. The terminal application may be a local application, a web page (Web) application, or a small program as a lightweight application. In the case where the terminal application is a local application that needs to be installed, the terminal application can be installed in the user terminal. In the case where the terminal application is a Web application, the terminal application can be accessed through a browser. In the case where the terminal application is a small program, the terminal application can be directly opened on the terminal device 140 by searching for relevant information of the terminal application (such as the name of the terminal application, etc.), scanning a graphic code of the terminal application (such as a barcode, a QR code, etc.), etc., without installing the terminal application.
[0059] It should be understood that, although the server 110, database 120 and terminal device 140 are shown and described as separate structures in this document, any two or all of them may also be different components of the same computing device. For example, the server 110 may provide background computing functions, the database 120 may provide data exchange, storage, and acquisition functions, and the terminal device 140 may provide foreground functions for interacting with users, such as receiving user input and providing output to users through terminal applications. Optionally, the classification model uncertainty metric determination method according to some embodiments of the present application is not limited to Figure 1 The illustrated implementation is on the server 110 side, but may also be implemented on the terminal 140 side, or may also be implemented on both the terminal 140 side and the server 110 side.
[0060] Figure 2 An exemplary principle block diagram of a classification model uncertainty metric determination method according to some embodiments of the present application is shown. It should be noted that Figure 2 The rounded boxes in the figure represent various data information, such as the sample data set obtained, each of which includes an original sample 210 (referred to as the original sample 210) for inputting the classification model and a corresponding classification label 220; the square rectangular boxes represent processing operations for various data information, such as Figure 2 The “classification prediction of the classification model” for predicting the classification result of the input sample, the “prediction loss calculation” of the classification model, the “calibration error calculation” of the classification model, and the “comprehensive processing” of the first and second uncertainty estimates are shown. Figure 2 As shown, in the method for determining the uncertainty measure of a classification model according to some embodiments of the present application, in addition to the sample data set acquisition process, a "four-stage" data processing operation (i.e., "classification prediction of the classification model I", "prediction loss calculation II", "calibration error calculation III" and "comprehensive processing IV") can be used to finally determine the uncertainty measure of the classification model.
[0061] like Figure 2 As shown, in the classification model uncertainty metric determination method according to some embodiments of the present application, after obtaining a sample data set (each sample data includes an original evaluation sample (referred to as the original sample) 210 and a corresponding classification label 220), first, in the first stage data processing operation (i.e., "classification prediction I of the classification model"), each original sample 210 can be input into the classification model (to be evaluated) to predict its classification result, that is, the first predicted classification result is output from the classification model, including a first predicted classification 230 and a first predicted probability 240; secondly, in the second stage data processing operation (i.e., "prediction loss calculation II"), the first difference 250 between the first predicted probability 240 and the classification label 220 and the first predicted classification 230 are used to calculate the prediction of the classification model. loss, thereby obtaining a first uncertainty estimate 260 for sample-level uncertainty estimation; again, in the third stage data processing operation (i.e., "calibration error calculation III"), the calibration error of the classification model is calculated using the second difference 270 between the first predicted classification 230 and the classification label 220 and the first predicted probability 240, thereby obtaining a second uncertainty estimate 280 for task-level uncertainty estimation; finally, in the fourth stage data processing operation (i.e., "comprehensive processing IV"), the final uncertainty measure 290 (e.g., uncertainty estimation score) of the classification model is determined by numerical operations (e.g., multiplication or weighted sum, etc.) based on at least the first and second uncertainty estimates 260 and 280 for different levels of uncertainty estimation.
[0062] Figure 3 is a flowchart of a method for determining uncertainty measures of a classification model according to some embodiments of the present application. Figure 3 The uncertainty measure determination method for the classification model shown can be found in Figure 1 The application scenario shown in the figure can be implemented by the execution subject Figure 1 Optionally, the classification model uncertainty metric determination method according to some embodiments of the present application may also be performed in Figure 1The process may be executed on the terminal device 140 as shown, or may be implemented jointly by the server 110 and the terminal device 140.
[0063] like Figure 3 As shown, the classification model uncertainty metric determination method according to some embodiments of the present application may include the following steps:
[0064] S310, sample data acquisition step;
[0065] S320, classification model prediction step;
[0066] S330, prediction loss calculation step;
[0067] S340, calibration error calculation step;
[0068] S350, evaluation result determination step.
[0069] Combine the following Figure 1 and Figure 2 The execution process of each of the above steps S310-S350 is described in detail.
[0070] At S310 (sample data acquisition step), a sample data set for evaluating the uncertainty of the classification model is acquired, and each sample data in the sample data set includes an original evaluation sample and a corresponding classification label.
[0071] In this article, a sample data set refers to a collection of sample data used to evaluate the uncertainty of a classification model. Each element in the sample data set (i.e., each sample data) can be a data pair consisting of two data, namely, an original evaluation sample for input into the classification model and a classification label corresponding to the original evaluation sample. The sample data set used for uncertainty measurement determination in this article is similar to the training sample data set used for supervised training of the classification model, that is, both are sample data composed of input samples and corresponding sample labels; the purposes of the two are different, the purpose of the former is to evaluate the uncertainty of the classification model, while the purpose of the latter is to train the classification model to iteratively optimize the model parameters until the preset conditions are met. Therefore, the sample data set in this article can directly use the training sample data set used for supervised training of the classification model.
[0072] The classification model is an important model in machine learning. It is used to solve classification problems, that is, to classify the input variable x into one of K discrete categories Ck. The goal of the classification model is to divide the input space into different decision regions, each corresponding to a category. Common classification models include logistic regression, decision tree, random forest, AdaBoost, K-nearest neighbor (KNN), naive Bayes, neural network (its core idea is to map data to a higher dimensional space through multiple layers of nonlinear transformations, and use the softmax function to map it to a probability space).
[0073] In the process of determining the uncertainty measure of the classification model according to some embodiments of the present application, the sample data set acquisition step S310 can be initiated in the following two ways: one is a passive way, that is, the server (for example Figure 1 The server 110 shown passively receives the target device (e.g. Figure 1 The first embodiment is a method for determining the uncertainty metric of a classification model by sending a classification model uncertainty metric determination request to a terminal device 140 (shown in FIG. 1 ), thereby triggering an evaluation process (e.g., starting a sample data set acquisition process). For example, the evaluation request can be triggered by the target device requesting to evaluate a newly trained classification model or enabling the classification model; the second embodiment is an active method, that is, the server 110 actively initiates the classification model uncertainty metric determination, for example, the server can periodically or in real time sense the new classification model training process and automatically start the evaluation instruction at the end of the training to initiate the classification model uncertainty metric determination process.
[0074] The sample data set to be obtained for evaluating the uncertainty of the classification model can be pre-stored in various data sources, such as Figure 1 The data may be stored in the external database 120 shown, or may be stored in the terminal device 140 or the server 110 itself. Therefore, the data acquisition step S310 may receive a sample data set corresponding to the classification model from various data sources to start the uncertainty measurement determination of the classification model.
[0075] In some embodiments, it is assumed that the classification model to be evaluated is a model for identifying the category of the subject in the picture. In this case, the original evaluation samples are various pictures containing the subject, and the corresponding sample labels are the category of the subject. Exemplarily, in a two-classification model for identifying whether the subject in the image is a "cat", the sample label corresponding to each collected original evaluation sample (i.e., picture) can be represented by a number 1 or 0, where 1 indicates that the category of the subject in the picture is "cat", and 0 indicates that the category of the subject is "non-cat". Exemplarily, in an email classification problem, the classification model can be used to predict whether an email is "spam" or "non-spam", where the original evaluation sample is the input email, and the sample label or classification label is "spam" or "non-spam", or can also be represented by a number 1 or 0, respectively.
[0076] In step S320 (classification model prediction step), for each sample data in the sample data set, the original evaluation sample is input into the classification model to obtain a first predicted classification result, and the first predicted classification result includes a first predicted category and a first predicted probability corresponding to the original evaluation sample.
[0077] Based on the concept of the present invention, after acquiring or receiving a sample data set for evaluating the uncertainty of a classification model, it is necessary to first obtain the classification prediction results of the classification model to be evaluated for the original evaluation sample in each sample data, so that these classification prediction results can be compared with the corresponding classification labels to estimate the reliability or uncertainty of the classification model (for example, through prediction loss and / or calibration error, etc.).
[0078] In some embodiments, the original evaluation samples of each sample data in the sample data set can be input into the classification model in sequence to obtain the predicted classification results corresponding to each sample data (i.e., each original evaluation sample), which can be referred to as the first predicted classification results in this article (to distinguish it from the second predicted classification results corresponding to the perturbation evaluation sample in the following text).
[0079] Generally, the prediction result of a classification model is a predicted value of the target variable (also called a classification label or category). In classification problems, the target variable is discrete and usually represents different categories or groups. The prediction results of a classification model usually have the following forms:
[0080] Predicted class: This is the most common form of prediction. For example, in an email classification problem, a classification model might predict whether an email is “spam” or “not spam”.
[0081] Predicted class probabilities (or simply predicted probabilities): Classification models sometimes give not only the final predicted class, but also the probability of belonging to each class. For example, an image classification model might predict that the subject of a picture has an 80% probability of being a "cat" and a 20% probability of being a "dog".
[0082] Predicted classification scores: In some cases, the model will output a score or confidence, which is not a probability, but can be used to indicate the confidence of the model for each category. These scores usually require post-processing (such as softmax function) to be converted into probabilities.
[0083] Predicting multi-label classification: In some multi-label classification problems, a sample may belong to multiple categories. In this case, the model's prediction result will be a set of category labels. For example, a news article classification model may predict that an article belongs to the three categories of "culture", "economy" and "technology" at the same time.
[0084] In some embodiments of the present application, in order to facilitate the subsequent determination of the uncertainty measure of the classification model, especially to calculate (see steps S330 and 340) the prediction loss and calibration error of the classification model, the first predicted classification result (i.e., the predicted classification result corresponding to the original evaluation sample of each sample data in the acquired sample data set) may include the predicted classification (i.e., the predicted category) and the predicted classification probability (i.e., the probability of belonging to the predicted category) corresponding to the original evaluation sample, which are referred to as the first predicted classification and the first predicted probability in this article.
[0085] At S330 (prediction loss calculation step), the first prediction loss of the classification model is calculated according to the difference between the first prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a first uncertainty estimate.
[0086] According to the concept of the present application, in order to enhance the applicability of the classification model uncertainty estimation to a wide range of application scenarios, the reliability of the uncertainty estimation and the accuracy of the uncertainty estimation, the uncertainty estimation (or measurement) of the classification model can be divided into multiple (at least two) dimensions, namely, sample-level uncertainty estimation (i.e., first uncertainty estimation value) and task-level uncertainty estimation (i.e., second uncertainty estimation value) (and optionally sorting-level uncertainty estimation, i.e., third uncertainty estimation value), and the uncertainty estimates of these different dimensions are comprehensively processed to obtain a final, more comprehensive and accurate uncertainty measurement result for the classification model.
[0087] The prediction loss calculation step S330 is mainly used to determine the sample-level uncertainty estimate (i.e., the first uncertainty estimate). As described in S330, the sample-level uncertainty estimate can be based on the difference between the first prediction probability corresponding to each sample data in the sample data set and the classification label (e.g., Figure 2 As mentioned above, the prediction loss of the classification model is used to evaluate the difference or consistency between the prediction result of the classification model (ie, the first prediction probability) and the true classification label, indicating the degree of closeness of the prediction result of the model to the actual situation. The smaller the prediction loss, the closer the prediction result of the model is to the true label, the better the performance of the model, and the lower the uncertainty. Therefore, the sample-level uncertainty estimate (ie, the first uncertainty estimate) can be determined based on the prediction loss of the model. Common classification prediction losses (ie, the first prediction loss) may include negative log-likelihood loss (NLL) and Bell score loss (BSL), and may optionally include cross entropy loss, mean square error loss, classification cross entropy loss, and the like.
[0088] In this way, the prediction loss calculation step S330 (i.e., the first uncertainty estimate calculation process) can be divided into three steps: first, selecting at least one from the above-mentioned classification prediction losses to determine the first uncertainty estimate; second, using the difference between the first prediction probability corresponding to each sample data in the acquired sample data set and the classification label (such as Figure 2 3. determining a first uncertainty estimate based on at least one selected predicted loss.
[0089] In some embodiments, the first uncertainty estimate can be determined based on at least one of the various different types of classification prediction losses. Exemplarily, the first uncertainty estimate can be defined as a multidimensional vector composed of at least two of the above-mentioned commonly used classification prediction losses, wherein the components of each dimension represent the corresponding classification prediction losses; for example, the first uncertainty estimate can include two sub-estimates, namely the negative log-likelihood loss and the Bell score loss. Exemplarily, the first uncertainty estimate can also be defined as the product or weighted sum of the negative log-likelihood loss and the Bell score loss. Optionally, the first uncertainty estimate can also be defined as the average of at least two of the above-mentioned commonly used classification prediction losses, such as the arithmetic mean or geometric mean of the negative log-likelihood loss and the Bell score loss.
[0090] The first uncertainty estimate (such as the vector, product, or average of different types of classification prediction losses) belongs to the sample-level uncertainty estimate, which is a relatively strict uncertainty estimation indicator. The main principle is to calculate the prediction loss of the classification model sample by sample in the sample data set (the difference between the prediction probability corresponding to each sample and the classification label) to extract the wrongly predicted samples, thereby achieving a more fine-grained (sample-level) uncertainty estimate.
[0091] In step S340 (calibration error calculation step), the first calibration error of the classification model is calculated according to the difference between the first predicted category and the classification label corresponding to each sample data in the sample data set and the first predicted probability to obtain a second uncertainty estimate.
[0092] As described above, according to the concept of the present application, in order to enhance the applicability of the uncertainty estimation of the classification model to a wide range of application scenarios, the reliability of the uncertainty estimation, and the accuracy of the uncertainty estimation, the uncertainty estimation (or measurement) of the classification model can be divided into multiple (at least two) dimensions, and the uncertainty estimates of these different dimensions are processed comprehensively to obtain the final more comprehensive and accurate uncertainty measurement results of the classification model. As described in S330, the first uncertainty estimation value belongs to the uncertainty estimation at the sample level, and the second uncertainty estimation value belongs to the uncertainty estimation at the task level, and optionally the third uncertainty estimation value belongs to the uncertainty estimation at the sorting level.
[0093] The calibration error calculation step S340 is mainly used to determine the task-level uncertainty estimate (i.e., the first uncertainty estimate). As described in S340, the task-level uncertainty estimate can be based on the difference between the first predicted category and the classification label corresponding to each sample data in the sample data set (e.g., Figure 2 As described above, the calibration error of the classification model is a method for evaluating the difference between the overall prediction probability of the classification model (for example, on multiple probability intervals) and the overall classification accuracy (for example, the average value of the classification labels on multiple probability intervals). The smaller the calibration error, the closer the overall prediction result of the model is to the true overall classification result, the better the performance of the model, and the lower the uncertainty. Therefore, the uncertainty estimate at the task level (that is, the second uncertainty estimate) can be determined based on the calibration error of the model. The calibration error of the model (that is, the first calibration error) may include: expected calibration error (ECE) and adaptive expected calibration error (AECE), etc.
[0094] Thus, the calibration error calculation step S340 (i.e., the second uncertainty estimate calculation process) can be divided into two steps: first, selecting at least one of the calibration errors (ECE or AECE) to determine the second uncertainty estimate; second, using the difference between the first predicted category and the classification label corresponding to each sample data in the acquired sample data set (e.g., Figure 2 The invention relates to a method of determining a first uncertainty estimate based on the calculated calibration error value and a second difference shown in the figure and at least one selected calibration error value of the first predicted probability calculation.
[0095] Exemplarily, the first uncertainty estimate may be defined as a multidimensional vector consisting of at least two of different types of calibration errors, wherein the components of each dimension represent the corresponding calibration errors; for example, the second uncertainty estimate may include two sub-estimates, namely the expected calibration error (ECE) and the adaptive expected calibration error (AECE). Exemplarily, the second uncertainty estimate may also be defined as the product or weighted sum of the expected calibration error (ECE) and the adaptive expected calibration error (AECE). Optionally, the second uncertainty estimate may also be defined as the average of the expected calibration error (ECE) and the adaptive expected calibration error (AECE), such as the arithmetic mean or geometric mean.
[0096] The second uncertainty estimate (e.g., a vector, product, or average value of different types of calibration errors) belongs to the task-level uncertainty estimate, which is a relatively less stringent uncertainty estimate indicator compared to the sample-level uncertainty estimate. The main principle of task-level uncertainty estimation is to calculate the calibration error of the classification model (the difference between the average prediction accuracy corresponding to each sample subset (i.e., the average difference between the predicted category and the classification label in the interval) and the average prediction probability of each sample in the interval) for each sample subset in the sample data set (e.g., the sample set in each probability interval), and the number of samples with incorrect predictions can be extracted from it, thereby realizing the uncertainty estimate of the classification model as a whole (task level) in each probability interval. Compared with the sample-level uncertainty estimate, the task-level uncertainty estimate may have better discrimination and can more clearly distinguish the uncertainties of different classification models.
[0097] In step S350 (evaluation result determination step), an uncertainty measure of the classification model is determined based on at least the first uncertainty estimate and the second uncertainty estimate.
[0098] According to the concept of the present application, after obtaining the sample-level uncertainty estimate (i.e., the first uncertainty estimate) by calculating the prediction loss of the classification model and obtaining the task-level uncertainty estimate (i.e., the second uncertainty estimate) by calculating the calibration error of the classification model, at least the calculated two-dimensional uncertainty estimation indicators (the first and second uncertainty estimates) can be combined (for example, multiplication or weighted sum or average, etc., or directly combined into a multidimensional vector) to obtain the final uncertainty measure (such as an uncertainty estimation score and / or a radar chart).
[0099] In some embodiments, the final uncertainty metric determination result (i.e., uncertainty metric) of the classification model can be quantified as an uncertainty score, so that the higher the uncertainty score, the lower the degree of uncertainty of the classification model and the higher the reliability of the prediction result. Therefore, when the first certainty estimate is a prediction loss or a combination of multiple prediction losses (product or weighted sum) and the second uncertainty estimate is a calibration error or a combination of multiple calibration errors (product or weighted sum), it is necessary to take the reciprocal of the first uncertainty estimate and the second uncertainty estimate, and then combine (for example, multiply or add) them together to obtain the uncertainty score. This is because the prediction loss and calibration error are essentially the difference between the prediction result and the true result. In other words, the larger the absolute value, the higher the degree of uncertainty of the prediction result and the less reliable the model prediction result. This is contrary to the preset meaning of the uncertainty score, so it is necessary to take the reciprocal to make the uncertainty score obtained thereby positively correlated with the model prediction or classification effect.
[0100] More specifically, in some embodiments, the uncertainty score of the classification model may be determined by the following formula (1):
[0101] USC=(1 / EV1)*(1 / EV2) (1)
[0102] Wherein, USC represents the uncertainty score, EV1 represents the first uncertainty estimate, EV2 represents the second uncertainty estimate, NLL represents the negative logarithmic loss of the classification model, and BSL represents the Bell score loss of the classification model. In formula (1), for example, EV1 = NLL*BSL, EV2 = ECE*AECE, and ECE represents the expected calibration error of the classification model, and AECE represents the adaptive expected calibration error.
[0103] It should be noted that formula (1) is only an example method for calculating the uncertainty score of the classification model. In fact, the uncertainty score of the classification model can also be calculated by other methods, as long as it can be guaranteed that the final uncertainty score is positively correlated with the reliability of the model's classification prediction (or negatively correlated with the degree of uncertainty of the model's prediction results).
[0104] In the classification model uncertainty metric determination method according to some embodiments of the present application, first, the uncertainty metric determination process of the classification model is divided into a calculation process of multi-dimensional (at least two dimensions) indicators (i.e., a first uncertainty estimate or sample-level uncertainty estimate and a second uncertainty estimate or task-level uncertainty estimate) for different types of application scenarios, thereby achieving a reliable assessment of the uncertainty of the classification model from multiple angles and in an all-round manner, significantly reducing the potential risks caused by inaccurate model uncertainty estimates, and thus assisting enterprises or institutions to more comprehensively and accurately understand the advantages and disadvantages of model uncertainty, and better guide the optimization and improvement of the model to improve the model's prediction accuracy and computational efficiency; secondly, the calculated multi-dimensional uncertainty estimation indicators are comprehensively considered to obtain the final uncertainty metric (e.g., uncertainty estimation score), thereby providing researchers or engineers with a unified and reliable model uncertainty metric determination standard, ensuring the accuracy of the uncertainty (or reliability) assessment of the model in various application scenarios, and achieving a wider range of application scenario applicability, thereby making more informed decisions in the research and development and deployment of artificial intelligence products.
[0105] Figure 4 The following schematically illustrates an example process of the predicted loss calculation step according to some embodiments of the present application. Figure 4 As shown, in some embodiments, the prediction loss calculation step S330 (calculating the first prediction loss of the classification model according to the difference between the first prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a first uncertainty estimate) may include:
[0106] S331, calculating the negative log-likelihood loss of the classification model according to the difference between the first prediction probability corresponding to each sample data and the classification label;
[0107] S332, calculating the Bell score loss of the classification model according to the difference between the first prediction probability corresponding to each sample data and the classification label;
[0108] S333, determine a first uncertainty estimate based on at least one of a negative log-likelihood loss and a Bell fractional loss.
[0109] In some embodiments, the negative log-likelihood loss NLL may be calculated by the following formula (2):
[0110]
[0111] Where N represents the number of original evaluation samples, p i Represents the predicted probability of the true category in the classification label corresponding to the i-th original evaluation sample.
[0112] Formula (2) is essentially the loss obtained by summing the logarithmic difference between the predicted probability of the true classification corresponding to each sample and the true label, because log(p i ) can be seen as log(p i )-log1. Therefore, S331 can be implemented by the above formula (2).
[0113] Table 1 shows an example of the calculation process of negative log-likelihood loss (NLL). As shown in Table 1, in a multi-classification problem (the number of categories is greater than or equal to 3), the classification model can predict 3 categories, the number of original evaluation samples is 3 (ie, N = 3), and there are 3 samples in total, of which the classification label corresponding to the first sample is (0, 1, 0) (indicating that the true category of the sample is the second category) and the first prediction probability is (0.1, 0.5, 0.4); the classification label corresponding to the second sample is (0, 0, 1) (indicating that the true category of the sample is the third category) and the first prediction probability is (0.1, 0.2, 0.7); the classification label corresponding to the third sample is (1, 0, 0) (indicating that the true category of the sample is the first category) and the first prediction probability is (0.4, 0.3, 0.3). Thus, as shown in Table 1, it can be known from the first prediction probability (vector) corresponding to each sample that the prediction probability p1=0.5 of the first sample for the true category (i.e., the second category), the prediction probability p2=0.7 of the second sample for the true category (i.e., the third category), and the prediction probability p3=0.4 of the third sample for the true category (i.e., the first category). Therefore, the above values N=2, p1=0.5, p2=0.7, p3=0.4 can be substituted into formula (2) to obtain the value of NLL loss.
[0114] Table 1 - Example calculation process of negative log-likelihood loss
[0115]
[0116] In some embodiments, the Bell fractional loss BSL can be calculated by the following formula (3):
[0117]
[0118] Where N represents the number of original evaluation samples, p i represents the predicted probability of the true category in the classification label corresponding to the i-th original evaluation sample, o i The numeric representation of the true classification in the classification label of the i-th original evaluation sample (for example, the number 1).
[0119] As can be seen from formula (3), the Bell score loss is mainly used to measure the difference between the predicted probability of each sample of the classification model and the actual label. It not only considers the accuracy of the classification, but also the reliability of the predicted probability. Therefore, S332 can be implemented by formula (3). Generally, the value range of the Bell score loss is [0,1], and the higher the Bell score, the worse the prediction result of the surface model. Therefore, the closer the Bell score is to 0 (or the smaller it is), the better. Since the parameters of formulas (2) and (3) are basically the same, the calculation process of BSL can refer to the calculation process example of NLL in Table 2.
[0120] Regarding step S333, in some embodiments, the first uncertainty estimate EV1 can be obtained by multiplying the negative log-likelihood loss NLL and the Bell fraction loss BSL, that is, the third uncertainty estimate can be calculated by the following formula (4):
[0121] EV1=NLL*BSL (4).
[0122] Optionally, the first uncertainty estimate EV1 may also be defined as the sum or weighted sum of the negative log-likelihood loss NLL and the Bell score loss BSL, where the weight may be determined according to the specific application scenario. In addition, the first uncertainty estimate EV1 may also be defined as the arithmetic mean or geometric mean of the negative log-likelihood loss NLL and the Bell score loss BSL. In fact, in some implementations of step S333, the quantitative relationship between the first uncertainty estimate EV1 and the negative log-likelihood loss NLL and the Bell score loss BSL is not limited to the above-mentioned calculation process (such as product, mean, etc.), as long as it can be ensured that NLL and BSL can affect EV1 in the same direction (for example, both are negatively correlated with EV1).
[0123] Figure 5 The following schematically illustrates an example process of calculating the calibration error according to some embodiments of the present application. Figure 5 As shown, the calibration error calculation step S340 may include:
[0124] S341, calculating an expected calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data and the first predicted probability;
[0125] S342, calculating an adaptive expected calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data and the first predicted probability;
[0126] S343, determining a second uncertainty estimate according to at least one of the expected calibration error and the adaptive expected calibration error.
[0127] In some embodiments, step S341 can be implemented by calculating the expected calibration error using formula (5), that is, the expected calibration error ECE can be calculated using the following formula (5):
[0128]
[0129] Where N is the number of original evaluation samples, K is the number of preset probability intervals (i.e., the number of multiple probability subintervals obtained by pre-dividing the overall probability interval [0,1]), and B m represents the set of samples whose predicted probability corresponding to the predicted category falls into the mth probability interval, |B m | represents the number of samples whose predicted probability corresponding to the predicted category falls into the mth probability interval, acc(B m ) represents the average prediction accuracy of the sample set whose prediction probability corresponding to the prediction category falls into the mth probability interval (the average difference between the predicted classification and the classification label), conf(B m ) represents the average predicted probability of the sample set whose predicted probability corresponding to the predicted category falls into the mth probability interval.
[0130] In some embodiments, the calculation process of the expected calibration error ECE may include the following steps according to the calculation formula (5):
[0131] First, determine the preset number of probability intervals K and divide the probability intervals. For example, the probability intervals can be divided in a uniform manner, that is, first determine the predetermined number of probability intervals K, and then divide the overall probability interval [0,1] into K probability intervals. Secondly, use the first prediction category and the first prediction probability of each sample in the N samples to find the prediction probability corresponding to its prediction category, and thereby determine the probability interval that each sample falls into, so as to obtain the total number of samples in each probability interval, for example, the number of samples in the mth probability interval |B m |. Again, for each probability interval, the difference between the predicted category of each sample and the true category in the classification label is used to determine the average prediction accuracy of the sample set in the probability interval, for example, acc(B m ). Then, for each probability interval, the first prediction probability of each sample is used to calculate the average prediction probability corresponding to the prediction category of each sample in the probability interval, for example, conf(B m ). Finally, the specific values obtained in the above steps are substituted into formula (5) to obtain the expected calibration error ECE.
[0132] Table 2 - Example sample data set used to calculate expected calibration error
[0133]
[0134] Table 3 - Example calculation of expected calibration error
[0135]
[0136] Table 2 schematically shows an example sample data set for calculating the expected calibration error. As shown in Table 2, the number of original evaluation samples in the example sample data set for calculating the expected calibration error is N=5, and Table 2 shows the true category (i.e., category label) corresponding to each sample, the (first) predicted category, and the predicted probability corresponding to the predicted category (in the first predicted probability). As shown in Table 2, for each sample, most of the predicted categories are the same as the true category, indicating that the prediction is accurate; only the predicted category (category 1) of sample 4 is different from the true category (category 2), indicating that the prediction is wrong.
[0137] Table 3 schematically shows an example calculation process of the expected calibration error based on the example sample data set in Table 2. As shown in Table 3, firstly, the number of probability intervals K=5 is preset, that is, the overall probability interval [0,1] is evenly divided into 5 probability intervals according to the interval length, namely, interval 1 [0,0.2], interval 2 [0.2,0,4], interval 3 [0.4,0,6], interval 4 [0.6,0,8], and interval 5 [0.8,0,1].
[0138] Secondly, the predicted probability corresponding to the predicted category of each sample shown in Table 2 is used to determine the probability interval that each sample falls into. As shown in Table 2, samples 3 and 4 fall into interval 3, sample 5 falls into interval 4, samples 1 and 2 fall into interval 5, and there are no samples in intervals 1 and 2. Therefore, the total number of samples in each probability interval can be obtained. m |, that is, |B1|=|B2|=0, |B3|=|B5|=2, |B4|=1.
[0139] Again, for each probability interval, the difference between the predicted category of each sample and the true category in the classification label is used to determine the average prediction accuracy acc(B m ). As shown in Table 2, since B1=B2=0, acc(B1)=acc(B2)=0; Based on the difference between the predicted category and the true category in Table 2, it can be seen that only sample 4 is predicted incorrectly (as shown in Table 2), so its corresponding prediction accuracy is 0, and the prediction accuracy of other samples is 1. Therefore, as shown in Table 3, the average prediction accuracy of interval 3 is:
[0140]
[0141] Similarly, as shown in Table 3, the average prediction accuracy of intervals 4 and 5 is 1.
[0142] Then, for each probability interval, the first predicted probability of each sample is used to calculate the average predicted probability corresponding to the predicted category of each sample in the probability interval. As shown in Table 3, since the predicted probabilities of samples 3 and 4 shown in Table 2 are 0.4 and 0.5 respectively, the average predicted probability of probability interval No. 3 is:
[0143]
[0144] Similarly, as shown in Table 3, the average predicted probabilities for intervals 4 and 5 are 0.7 and 0.85, respectively.
[0145] Finally, the specific values obtained in the above steps (number of probability intervals K, total number of samples N, number of samples in each probability interval | B m |、Average prediction accuracy acc(B m ), average prediction probability conf(B m Substituting into formula (5) we can get the expected calibration error ECE as follows:
[0146]
[0147] Expected calibration error (ECE) is a measure of how well a machine learning model predicts probabilities and matches actual results. ECE evaluates the calibration of a model by calculating the expectation of the difference between the average prediction accuracy or average confidence (i.e., the difference between the predicted classification and the true classification label) of samples in each pre-defined probability interval (confidence interval) and the average prediction probability. Therefore, the expected calibration error can be considered as a task-level uncertainty estimate for the classification model, which reflects the average prediction confidence of the classification model for sample data in each probability interval.
[0148] In some embodiments, the calculation step S342 of the adaptive expected calibration error AECE is similar to the calculation step S341 of the ECE, except that the calculation process of the adaptive expected calibration error does not pre-divide multiple fixed probability intervals (e.g., uniformly according to the interval length) in terms of the probability interval division, but can dynamically divide or adjust the probability interval size according to the predicted probability distribution of each original evaluation sample according to the classification model to obtain a more accurate calibration error estimate. The "adaptive" in AECE is mainly reflected in the dynamic division of probability intervals.
[0149] Exemplarily, the step of adaptively (dynamically) dividing the probability interval in the process of calculating the adaptive expected calibration error can be performed based on the probability distribution of each original evaluation sample in the sample data set, so that the number of samples whose prediction probability corresponding to the prediction category falls into each probability interval after division is roughly the same, so that each probability interval and its corresponding sample data can participate in the calculation process of the difference expectation (average prediction accuracy and average prediction probability), effectively avoiding the existence of redundant empty sample set probability intervals (such as intervals 1 and 2 shown in Table 3) caused by pre-fixed (uniformly divided according to length) probability intervals, saving data storage space and data processing efficiency; at the same time, due to the refinement of the interval division, the accuracy of the calibration error estimation is improved.
[0150] In some embodiments, in the adaptive expected calibration error calculation step S342, formula (5) can still be used; and except for the probability interval division process and the step of determining the number of probability intervals K, the remaining steps (such as the number of samples in each probability interval | B m |、Average prediction accuracy acc(B m ), average prediction probability conf(B m ) is basically the same as the calculation process of the expected calibration error ECE (ie, the implementation method of S341), and will not be repeated here.
[0151] In some embodiments, regarding step S343, the second uncertainty estimate EV2 may be obtained by multiplying the expected calibration error ECE by the adaptive expected calibration error AECE, that is, the second uncertainty estimate may be calculated by the following formula (6):
[0152] EV2=ECE*AECE (6).
[0153] Optionally, the first uncertainty estimate EV1 may also be defined as the sum or weighted sum of the expected calibration error ECE and the adaptive expected calibration error AECE, wherein the weight may be determined according to the specific application scenario. In addition, the second uncertainty estimate EV2 may also be defined as the arithmetic mean or geometric mean of the expected calibration error ECE and the adaptive expected calibration error AECE. In some implementations of step S343, the second uncertainty estimate EV2 is not limited to the above-mentioned calculation method (e.g., the product, mean, etc. of the expected calibration error ECE and the adaptive expected calibration error AECE).
[0154] Figure 6 The following schematically illustrates an example process of determining the evaluation result according to some embodiments of the present application. Figure 6 As shown, the evaluation result determination step S350 (determining the uncertainty measure of the classification model based at least on the first uncertainty estimate and the second uncertainty estimate) may include:
[0155] S351, calculating a first classification effect index of the classification model according to the classification label corresponding to each sample data in the sample data set and the first prediction probability to obtain a third uncertainty estimation value;
[0156] S352, determining an uncertainty measure of the classification model based on the first uncertainty estimate, the second uncertainty estimate, and the third uncertainty estimate.
[0157] As described above, according to the concept of the present application, in order to enhance the applicability of the classification model uncertainty estimation to a wide range of application scenarios, the reliability of the uncertainty estimation and the accuracy of the uncertainty estimation, the uncertainty estimation (or measurement) of the classification model can be divided into multiple dimensions, and the uncertainty estimates of these different dimensions are comprehensively processed to obtain the final more comprehensive and accurate uncertainty measurement results of the classification model. As shown in S330, the first uncertainty estimate belongs to the uncertainty estimation at the sample level, and as shown in S340, the second uncertainty estimate belongs to the uncertainty estimation at the task level. In addition to the above two dimensions, the uncertainty estimation of the third dimension, that is, the uncertainty estimation at the sorting level (for example, the third uncertainty estimate obtained based on the first classification effect indicator of the model) can also be included.
[0158] The classification effect index calculation step S351 is mainly used to determine the uncertainty estimate (i.e., the third uncertainty estimate) of the sorting level according to the calculation of the classification effect index (i.e., the first classification effect index). Generally, the classification effect index is used to evaluate the classification performance of the classification model for unknown samples. The classification effect index of the model (i.e., the first classification effect index) may include: accuracy, precision (precision), recall (recall), F1-score (harmonic mean of precision and recall), ROC (receiver operating characteristic curve), AUROC (area under ROC), AUPRC (area under the precision-recall curve), etc.
[0159] In some embodiments, accuracy refers to the ratio of the number of correctly classified samples to the total number of samples, Accuracy = (TP + TN) / (TP + FP + TN + FN), where TP is a true positive example, TN is a true negative example, FP is a false positive example, and FN is a false negative example. Precision (Precision, also known as the precision rate) refers to the proportion of samples predicted as positive samples that are truly positive samples, Precision = TP / (TP + FP). Recall (Recall, also known as the recall rate) refers to the proportion of samples that are correctly predicted as positive samples among all truly positive samples. Recall = TP / (TP + FN). F1 score (F1-Score) refers to the harmonic mean of precision and recall, which is used to comprehensively evaluate the performance of the model. F1 = 2*Precision*Recall / (Precision + Recall).
[0160] In some embodiments, ROC refers to: a curve drawn with the false positive rate (FPR) as the horizontal axis and the true positive rate (TPR) as the vertical axis, where FPR = FP / (FP+TN), TPR = TP / (TP+FN). AUROC refers to the area under ROC; AUROC reflects the ability of the classifier to distinguish between positive and negative samples. The larger the value, the better the classification effect. AUROC = 1 indicates that the model has perfect classification ability. AUROC focuses on the ranking ability of the classifier, and does not directly reflect the calibration performance of the model or the accuracy of the predicted probability.
[0161] In some embodiments, AUPRC refers to the area under the precision-recall curve (PRC), which is an indicator for measuring the performance of a model on an imbalanced data set. Compared with the area under the ROC curve (AUROC), AUPRC pays more attention to the prediction accuracy of positive samples, so it may be a better choice when the number of positive samples is much smaller than that of negative samples. The PRC curve is a curve drawn with recall as the horizontal axis and precision as the vertical axis. The PRC curve pays more attention to the classification effect of positive samples and is suitable for application scenarios with high recall.
[0162] As described in S351, in some embodiments, the uncertainty estimate of the sorting level (i.e., the third uncertainty estimate) can be obtained based on calculating the classification effect index (i.e., the first classification effect index) of the classification model according to the first prediction probability and classification label corresponding to each sample data in the sample data set. The classification effect index calculation step S351 (i.e., the third uncertainty estimate calculation process) can be divided into three sub-steps: 1. Select at least one of the above classification effect indicators (especially AUROC and AUPRC) to determine the third uncertainty estimate; 2. Calculate the selected at least one classification effect index value using the first prediction probability and classification label corresponding to each sample data in the obtained sample data set; 3. Determine the first uncertainty estimate value according to the selected at least one classification effect index value.
[0163] In the three sub-steps of the classification effect index calculation step S351, the first sub-step (i.e., classification index selection) can be performed in advance, for example, AUROC and AUPRC that can better reflect the model classification effect ranking ability can be selected; and the second sub-step can use the definition and / or calculation formula of the selected classification effect index to obtain the corresponding classification effect index value through simple calculation (for example, through the classification label corresponding to each sample and the first prediction probability), which will not be repeated here. Exemplarily, with respect to the third sub-step of S351, the third uncertainty estimate can be defined as a vector composed of the selected classification effect index (such as AUROC and AUPRC), wherein the components of each dimension represent the corresponding classification effect index respectively; for example, the third uncertainty estimate can include two sub-estimates, namely AUROC and AUPRC. Exemplarily, the third uncertainty estimate can also be defined as the product or weighted sum of AUROC and AUPRC. Optionally, the third uncertainty estimate can also be defined as the average of AUROC and AUPRC, such as the arithmetic mean or geometric mean.
[0164] In some embodiments, the third uncertainty estimate may be calculated by the following formula (7):
[0165] EV3=AUROC*AUPRC (7)
[0166] Where EV3 represents the third uncertainty estimate, AUROC represents the area under the ROC curve, and AUPRC represents the area under the PRC curve.
[0167] The third uncertainty estimate (e.g., a vector, product, or average value of different types of classification effect indicators) belongs to the uncertainty estimate at the ranking level, so it focuses more on the ability of the classification model to rank the classification prediction effects of each sample (e.g., which sample has the highest uncertainty in the classification result, and which sample's classification result is more prone to error compared to the other two samples). Generally speaking, unlike the first and second uncertainty estimates, the third uncertainty estimate and the corresponding classification effect indicator are positively correlated with the reliability of the classification model or the quality of the classification effect, that is, the larger the third uncertainty estimate, the higher the reliability of the classification result and the better the classification effect.
[0168] In step S352, considering the difference in the correlation between the first and second uncertainty estimates and the third uncertainty estimate and the classification effect or the reliability of the classification result (where the magnitude of the first and second uncertainty estimates is negatively correlated with the quality of the classification effect, while the third uncertainty estimate is positively correlated with the quality of the classification effect), it is necessary to perform reverse processing on the first and second uncertainty estimates before combining the three values (e.g., multiplying or adding, etc.) (i.e., making the processed index positively correlated with the classification effect and changing in the same direction). Exemplarily, the first and second uncertainty estimates can be firstly taken inversely, and then multiplied by the third uncertainty estimate, so as to obtain the final uncertainty estimation score of the classification model (the score is positively correlated with the classification effect or the classification reliability).
[0169] Figure 7 The following schematically illustrates an example process of determining the evaluation result according to some embodiments of the present application. Figure 7 As shown, Figure 6 The step S351 shown (calculating the first classification effect index of the classification model according to the classification label corresponding to each sample data in the sample data set and the first prediction probability to obtain a third uncertainty estimation value) may include:
[0170] S351a, calculating the area under the receiver operating characteristic curve according to the classification label corresponding to each sample data, the first prediction probability, and a plurality of preset classification probability thresholds;
[0171] S351b, calculating the area under the precision-recall curve according to the classification label corresponding to each sample data, the first prediction probability, and a plurality of preset classification probability thresholds;
[0172] S351c, determining a third uncertainty estimate based on at least one of the area under the receiver operating characteristic curve and the area under the precision-recall curve.
[0173] In some embodiments, as shown in S351a and S351b, first, AUROC and AUPRC that can better reflect the model's classification effect ranking ability can be selected from a variety of classification effect indicators as the basis for calculating the third uncertainty estimate; then, the classification labels and the first prediction probabilities corresponding to each original evaluation sample in the sample data set are used to calculate the values of AUROC and AUPRC according to their definitions, and finally, the two values are appropriately combined (for example, weighted sum, product, average, etc.) to obtain the third uncertainty value.
[0174] In some embodiments, Figure 7 The AUROC calculation step S351a shown may include: determining the true positive rate and the false positive rate under multiple preset classification probability thresholds according to the classification label corresponding to each sample data, the first predicted probability and multiple preset classification probability thresholds; constructing a receiver operating characteristic curve corresponding to the classification model in a plane rectangular coordinate system based on the true positive rate and the false positive rate under the multiple preset classification probability thresholds; calculating the area of the region enclosed by the receiver operating characteristic curve corresponding to the classification model and the horizontal axis and vertical axis of the plane rectangular coordinate system.
[0175] Here, the multiple preset classification probability thresholds refer to multiple pre-set probability values for limiting the predicted classification results. Because the ROC (receiver operating characteristic curve) is a false positive rate (FPR)-true positive rate (TPR) curve drawn based on different classification probability thresholds, it is necessary to first give multiple preset classification probability thresholds when constructing AUROC to determine multiple different FPR and TPR pairs (i.e., coordinate points constituting the ROC curve).
[0176] In some embodiments, the AUPRC calculation step S351b (calculating the area under the precision-recall curve based on the classification label corresponding to each sample data, the first prediction probability and multiple preset classification probability thresholds) may include: determining the precision and recall under the multiple preset classification probability thresholds based on the classification label corresponding to each sample data, the first prediction probability and multiple preset classification probability thresholds; constructing a precision-recall curve corresponding to the classification model in a plane rectangular coordinate system based on the precision and recall under the multiple preset classification probability thresholds; calculating the area of the region enclosed by the precision-recall curve corresponding to the classification model and the horizontal and vertical axes of the plane rectangular coordinate system.
[0177] like Figure 7 As shown, Figure 6 Step S352 (determining an uncertainty measure for the classification model based on the first uncertainty estimate, the second uncertainty estimate, and the third uncertainty estimate) may include:
[0178] S352a, taking the inverse of the first uncertainty estimate to obtain a first index;
[0179] S352b, taking the inverse of the second uncertainty estimate to obtain a second index;
[0180] S352c, calculating the product of the first indicator, the second indicator and the third uncertainty estimate to determine the uncertainty score of the classification model.
[0181] In some embodiments, the final uncertainty measure of the classification model can be quantified as an uncertainty score, so that the higher the uncertainty score, the higher the reliability of the classification model prediction result. Taking into account the difference in the correlation between the first and second uncertainty estimates and the third uncertainty estimate and the classification effect or the reliability of the classification result (where the size of the first and second uncertainty estimates is negatively correlated with the quality of the classification effect, while the third uncertainty estimate is positively correlated with the quality of the classification effect), in order to ensure the consistency of the change direction and the positive correlation between the obtained uncertainty score and the classification reliability or effect, it is necessary to reversely process the first and second uncertainty estimates before combining the three values (for example, multiplying or adding, etc.) (that is, making the processed indicators positively correlated with the classification effect and changing in the same direction).
[0182] As shown in S352a and S352b, the first and second uncertainty estimates can be first reciprocated respectively; as shown in S352c, they are then multiplied with the third uncertainty estimate to obtain the final uncertainty estimation score of the classification model (this score is positively correlated with the classification effect or classification reliability).
[0183] Specifically, in some embodiments, the uncertainty score USC of the classification model can be determined by the following formula (8):
[0184] USC=EV1_inv*EV2_inv*EV3 (8)
[0185] Among them, EV1 represents the first uncertainty estimate, EV2 represents the second uncertainty estimate, EV3 represents the third uncertainty estimate, EV1_inv represents the first indicator (i.e. the inverse of the first uncertainty estimate, EV1_inv=1 / EV1), and EV2_inv represents the second indicator (i.e. the inverse of the second uncertainty estimate, EV2_inv=1 / EV2).
[0186] It should be noted that formula (5) is only an example method for calculating the uncertainty score of the classification model. In fact, the uncertainty score of the classification model can also be calculated by other methods, as long as it can be guaranteed that the final uncertainty score is positively correlated with the reliability of the model's classification prediction (or negatively correlated with the degree of uncertainty of the model's prediction results).
[0187] More specifically, in some embodiments, according to formulas (4), (6) and (7), EV1 = NLL*BSL, EV2 = ECE*AECE, EV3 = AUROC*AUPRC, which are substituted into formula (8) to obtain the following calculation formula (9) for the uncertainty score:
[0188] USC=(1 / NLL)*(1 / BSL)*(1 / ECE)*(1 / AECE)*AUROC*AUPRC (9)
[0189] Figure 8 An example radar chart of uncertainty metrics obtained by a classification model uncertainty metric determination method according to some embodiments of the present application is schematically shown.
[0190] In some embodiments, the uncertainty measure of the classification model obtained by the classification model uncertainty measure determination method according to some embodiments of the present application can be expressed as a combination of multiple model uncertainty measure indicators (or a multidimensional vector composed of these indicators). For example, USC can be expressed in vector form as follows: USC = (NLL, BSL, ECE, AECE, AUROC, AUPRC). Figure 8 As shown, the values of each component of the uncertainty measurement (ie, each uncertainty measurement index) can be represented in the form of a radar chart. Figure 8 The range of values of each indicator in the radar chart shown is normalized to [0,1], which can unify the dimensions of different indicators and facilitate the comparison of the size of different types of indicators. Figure 8 Only the uncertainty metric values of a classification model and the area enclosed by the lines connecting the value points are shown in the figure, from which it can be clearly seen whether the model has good or bad prediction ability or high or low uncertainty in terms of various types of evaluation indicators. Figure 8 The radar chart shown can also simultaneously show the (component) values of the uncertainty metrics of multiple classification models, so that the macro and micro differences in the uncertainty metrics of different classification models can be analyzed through intuitive comparison of the image value positions and the size of the enclosed area (for example, the differences in the value positions of each indicator intuitively reflect the specific differences in uncertainty for different evaluation indicators or in different application scenarios, and the comparison of the areas enclosed by the value positions reflects the overall differences in the uncertainty metrics of different classification models).
[0191] Fig. 9 The schematic diagram shows the combined optimization based on multiple classification models with the same task according to some implementations of the present application.
[0192] Generally, when the reliability or accuracy of the prediction results of a single model is not ideal or low, the prediction results of multiple models with the same task can be combined or integrated to form the prediction results of the integrated model. The prediction results obtained in this way may be more reliable or more accurate than the results of a single model, and the more different models that constitute the integrated model, the more accurate the prediction results may be. On the other hand, compared with a single model, the integrated model formed by the combination of multiple different models has higher computational complexity and greater cost in the classification prediction process. Therefore, for efficiency and cost considerations, the number of different models contained in the integrated model cannot be too large, for example, it should be as small as possible while ensuring a certain degree of prediction reliability or accuracy.
[0193] In some embodiments, the uncertainty measure of the integrated classification model composed of at least one classification sub-model can be determined by referring to Figure 3 The method shown in the figure, wherein the classification model can be an integrated classification model and Figure 3 The classification model prediction step S320 shown may include:
[0194] For each classification sub-model in the integrated classification model, the original evaluation sample of each sample data in the sample data set is input into the classification sub-model to obtain the predicted classification probability of each sample data under the classification sub-model;
[0195] For each sample data, the arithmetic mean of the predicted classification probabilities of the sample data under each classification sub-model is calculated to obtain the first predicted classification result of the sample data under the integrated model. The first predicted classification result includes the first predicted category and the first predicted probability corresponding to the original evaluation sample.
[0196] Based on the above embodiment, the uncertainty measurement process of the integrated classification model is basically the same as that of a single ordinary classification model, and the special feature is that the prediction result of the integrated classification model for the input original evaluation sample is obtained by the operation processing (for example, taking the arithmetic mean) of the prediction results of each classification sub-model constituting the integrated model. For the convenience of calculation, the prediction results of each classification sub-model can be limited to the predicted classification probability, so the first predicted classification result of the integrated model can be obtained based on the arithmetic mean of the predicted classification probabilities of each sub-model, for example, the first predicted probability in the first predicted classification result is the arithmetic mean of the predicted classification probabilities of each sub-model, and the first predicted category can be obtained based on the first predicted probability (and the preset classification probability threshold). Since the prediction result of the integrated classification model is formed by combining the prediction results of each classification sub-model (for example, taking the arithmetic mean or geometric mean, or weighted sum), the prediction result of the integrated model absorbs the performance advantages of the classification prediction of multiple sub-models, so that the reliability and accuracy of its classification prediction result are higher than that of a single classification model, and thus the uncertainty estimate and uncertainty measurement (or score) obtained thereby may be higher.
[0197] In this way, according to some embodiments of the present application, the classification model uncertainty metric determination method can be used to determine the uncertainty metric (e.g., uncertainty score) of the integrated classification model, so as to quantify the reliability (i.e., uncertainty) of the prediction result of the integrated classification model, for example, quantifying the reliability as an uncertainty score. In this way, the optimal integrated model composed of different classification models can be found through the uncertainty score. For example, the higher the uncertainty score, the higher the reliability of the corresponding integrated model. On the other hand, in order to consider efficiency and cost, the threshold of the uncertainty score of the integrated model can also be pre-set, and then the combination with the smallest number of classification models constituting the integrated model is selected from the integrated model that reaches or exceeds the threshold as the optimal integrated model (i.e., the optimal model that takes into account reliability and cost efficiency). Therefore, based on the uncertainty metric determination process of the integrated classification model, the combined optimization problem of multiple classification models with the same task (i.e., multiple classification models for the same classification problem) for the same application scenario can be solved, that is, how to combine multiple classification models to obtain the optimal integrated model (for example, both high reliability (e.g., uncertainty score higher than the threshold) and the number of models in the integrated model can be made as small as possible to reduce costs and increase efficiency).
[0198] like Fig. 9 As shown, an example of a combinatorial optimization problem where multiple classification models work together to complete the same task is as follows:
[0199] Condition: Assume that there are M classification models for the same task (e.g., determination of a disease, binary classification problem), namely, model 1, model 2, ..., model M, where M is a positive integer greater than or equal to 2;
[0200] Goal: Select K models from these M classification models (i.e., model S1, model S2, ..., model S K ) constitutes an integrated model to complete the same task as each classification model (such as the problem of determining a certain disease), where K is a natural number, so that the uncertainty measure or score of the integrated model (which is used to indicate that the reliability or uncertainty of the prediction result meets the minimum business scenario requirements) is greater than a preset threshold t (where t is a real number between 0 and 1), and K is as small as possible.
[0201] against Fig. 9 The multi-model combination optimization problem shown can be solved by the following steps:
[0202] First, extract all non-empty subsets from the set of M models. The number of non-empty subsets is 2. M -1. For example, when M=2, there are 3 non-empty subsets: {model 1}, {model 2}, {model 1, model 2}.
[0203] Secondly, according to the uncertainty measurement determination method of the classification model (especially the integrated classification model) of some embodiments of the present application (for example Figure 5 The method shown in Figure 2) determines the uncertainty scores of the ensemble classification models corresponding to all non-empty subsets.
[0204] Again, the uncertainty scores of the ensemble classification models corresponding to all non-empty subsets are normalized to obtain normalized uncertainty scores. Normalization is a way to simplify calculations, that is, to transform dimensional expressions into dimensionless expressions and make them scalars. It can also be understood as limiting the data to be processed to a specific range (for example, [0,1]) after processing. Regarding the normalization process, the minimum-maximum normalization method can be used, that is, the range of each data in the data sequence is limited to [0,1] through the formula: (X-Xmin) / (Xmax-Xmin), where X is any original data in the data sequence, Xmin is the minimum value in the data sequence, and Xmax is the maximum value in the data sequence.
[0205] Next, the normalized uncertainty scores corresponding to each non-empty subset are compared with a preset threshold t, so as to select at least one candidate classification model subset from all non-empty subsets, that is, at least one non-empty subset whose normalized score is greater than t;
[0206] Finally, a classification model subset with the least number of models (i.e., the number of elements) is selected from at least one candidate classification model subset to obtain the optimal classification model combination for constituting the optimal integrated classification model. When there are two or more candidate classification model subsets with the least number of models, the optimal classification model combination can be determined according to the normalized uncertainty score, that is, the classification model combination with the highest score is selected as the optimal combination.
[0207] In some embodiments, the preset threshold t used for comparison with the normalized uncertainty score can be predetermined according to the specific application or business scenario. In general, the determination of the preset threshold t can depend on the risk sensitivity of misjudgment in the current business scenario, that is, the higher the risk sensitivity, the higher the value of t. For example, in the medical scenario, for the binary classification problem of disease determination, the risk sensitivity of misjudgment is relatively high (the consequences of misjudgment are relatively serious), so a higher prediction reliability model prediction is required, so the threshold t is preset to be relatively large (for example, 0.9). For example, for game account ban detection (i.e., the binary classification problem of account quality determination), it may not be so sensitive to the risk of misjudgment, so the requirements for model prediction reliability may be relatively less strict, and the threshold t can be preset to be smaller (for example, 0.5).
[0208] Table 4 - Example process of combined optimization of multiple classification models with the same task
[0209]
[0210] Table 4 schematically illustrates an example process of optimizing a combination of multiple classification models with the same task. As shown in Table 4, for the purpose of illustration, in this example, M=3, that is, the multi-model combination optimization problem is simplified to selecting the best model combination from three models to complete the same task as each model's respective task. As shown in Table 4, first, the set consisting of three models (i.e., Model 1, Model 2, and Model 3) has a total of 7 non-empty subsets, i.e., 7 non-empty model combinations, i.e., combinations No. 1-7 in Table 4, which are all model combinations of the three models. Secondly, the uncertainty metric determination method of the integrated classification model according to some embodiments of the present application can be used to calculate the uncertainty scores of the basic models corresponding to each combination and normalize them for ease of calculation and comparison. As shown in Table 4, the normalized scores corresponding to combinations No. 1-7 are 0.62, 0.69, 0.60, 0.76, 0.68, 0.74, and 0.85, respectively. Then, the normalized scores are compared with the preset threshold of 0.7, and the model combinations greater than 0.7 are screened, as shown in Table 4. Obviously, the scores corresponding to the combinations of No. 4, No. 6 and No. 7 are greater than 0.7, so they can be used as three candidate model classification combinations. Finally, as shown in Table 4, among the candidate classification combinations (i.e., combinations of No. 4, No. 6 and No. 7), the number of elements (i.e., models) of the combinations of No. 4 and No. 6 is the least, i.e., 2; at this time, No. 4 with a higher normalized score (No. 4 scores 0.76, which is greater than No. 6 scores 0.74) can be selected from the two as the optimal combination. After the above process, in the model set composed of 3 models, the combination of model 1 and model 3 can be selected to form an integrated model, which can not only ensure that its prediction reliability or accuracy meets the business requirements, but also make the number of models relatively small, thereby saving computing resources, optimizing resource scheduling, improving model computing efficiency, and reducing business costs.
[0211] Fig.10 An example process of a classification model uncertainty metric determination method in an image recognition scenario according to some embodiments of the present application is shown.
[0212] exist Fig.10 In the picture recognition scenario shown, the classification model is concretized as a picture classification model. The picture classification model is an important model in the field of computer vision, and its goal is to automatically classify the input image into predefined categories. Picture classification models are widely used in daily life and industrial production, such as medical image analysis, face recognition, object detection, and traffic sign recognition in autonomous driving. The following are common picture classification models: convolutional neural network (CNN), lightweight model, decision tree, and random forest.
[0213] like Fig.10 As shown, in the image recognition application scenario, the metric determination method for determining the image classification model includes the following steps:
[0214] First, obtain a picture sample data set, where each picture sample data includes a picture sample and a corresponding picture classification label. For example, when the picture classification model is a binary classification model for identifying cats, the picture classification label may include two category labels: "cat" or "non-cat".
[0215] Secondly, if Fig.10 As shown, each image sample is input into the image classification model to output a predicted image classification result, which may include a predicted image category and a predicted classification probability.
[0216] Again, if Fig.10 As shown, the predicted image classification result of each image sample is compared with the corresponding image classification label previously obtained (for example, based on the difference between the two) to calculate the inverse of the first uncertainty estimate (for example Fig.10 1 / NLL and 1 / BSL in ), the inverse of the second uncertainty estimate (e.g. Fig.10 1 / ECE and 1 / AECE in ) and a third uncertainty estimate (e.g. Fig.10 AUROC and AUPRC in .
[0217] Finally, if Fig.10 As shown, the above indicators are multiplied to obtain the final uncertainty score of the image classification model.
[0218] That is, USC=(1 / NLL)*(1 / BSL)*(1 / ECE)*(1 / AECE)*AUROC*AUPRC.
[0219] exist Fig.10 In the uncertainty determination method of the image classification model shown, the uncertainty degree of the model's prediction result or the prediction reliability degree is determined by comprehensively considering the model reliability or prediction effect indicators from multiple different angles (such as NLL, BSL, ECE, etc.), and the recognition ability of the image classification model for specific categories of objects and the accuracy and reliability of the recognition results are quantified relatively comprehensively and accurately.
[0220] In some embodiments, Fig.10 The uncertainty determination method of the classification model in the picture recognition scenario shown can also be used to solve Fig. 9In other words, for multiple image recognition or classification models with the same task to jointly complete the same image recognition problem, a certain number of models can be selected from these image classification models according to the method shown in Table 4 above to form an integrated image classification model for implementing the corresponding image recognition task, so that the prediction reliability or accuracy of the integrated image classification model meets the minimum business requirements, and the number of selected models is as small as possible, thereby saving computing resources, optimizing resource scheduling, improving model computing efficiency, and reducing business costs while ensuring accurate and reliable prediction results.
[0221] Fig.11 The flowchart of the method for determining the uncertainty measure of a classification model according to some embodiments of the present application is schematically shown.
[0222] According to the concept of the present application, after determining different types of uncertainty estimates (e.g., first and second uncertainty estimates) for different application scenarios, in addition to determining the uncertainty measure of the classification model, the robustness of the classification model in terms of uncertainty measure can also be determined based on the changes in the calculation of each uncertainty estimate when a disturbance is applied to the input sample. Specifically, if the uncertainty estimate changes less when a disturbance is applied to the input sample compared to the original evaluation sample, it indicates that the uncertainty measure determination result of the model is insensitive to or less affected by noise or disturbance, and has high robustness. Fig.11 The computation process of the robustness of the uncertainty measure with respect to the classification model is shown.
[0223] like Fig.11 As shown, except Figure 3 In addition to steps S310-350 shown, the classification model uncertainty measure determination method according to the present application may further include:
[0224] S1110, for each sample data in the sample data set, applying a disturbance to the original evaluation sample to obtain a perturbed evaluation sample;
[0225] S1120, for each sample data in the sample data set, input the disturbance assessment sample into the classification model to obtain a second prediction classification result, the second prediction classification result including a second prediction category and a second prediction probability corresponding to the disturbance assessment sample;
[0226] S1130, calculating a second prediction loss of the classification model according to a difference between a second prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a fourth uncertainty estimation value;
[0227] S1140, calculating a second calibration error of the classification model according to the difference between the second predicted category and the classification label corresponding to each sample data in the sample data set and the second predicted probability to obtain a fifth uncertainty estimate;
[0228] S1150, determining a robustness measure of the uncertainty measure of the classification model based at least on a difference between the fourth uncertainty estimate and the first uncertainty estimate and a difference between the fifth uncertainty estimate and the second uncertainty estimate.
[0229] In some embodiments, when determining the robustness metric, in addition to considering the changes in the first and second uncertainty estimates caused by the disturbance of the input sample, the changes in the third uncertainty estimate may be further considered, so that different types of uncertainty estimation indicators can be integrated more comprehensively and from more angles, and the calculation of the appropriate robustness metric is more reliable and accurate. Fig.11 The robustness metric determination step S1150 shown may include: calculating the second classification effect indicator of the classification model according to the classification label corresponding to each sample data in the sample data set and the second prediction probability to obtain a sixth uncertainty estimate; based on the difference between the fourth uncertainty estimate and the first uncertainty estimate, the difference between the fifth uncertainty estimate and the second uncertainty estimate, and the difference between the sixth uncertainty estimate and the third uncertainty estimate, determining the robustness metric of the uncertainty metric of the classification model.
[0230] In some embodiments, in the process of determining the robustness of the uncertainty metric, such as S1110, the original evaluation sample may first be subjected to disturbance to obtain a disturbance evaluation sample, that is, the disturbance evaluation sample is calculated by the following formula (10):
[0231] X'=X+ε (10)
[0232] Where X represents the original evaluation sample, X' represents the perturbation evaluation sample, and ε represents the applied perturbation or noise. Generally, ε obeys Gaussian distribution (i.e. normal distribution), or even N(0,1), i.e. standard normal distribution (Gaussian distribution with mean 0 and variance 1).
[0233] Secondly, as shown in S1120-S1140, the fourth uncertainty estimate EV'1 and the fifth uncertainty estimate EV'2 (optionally including the sixth uncertainty estimate EV'3) corresponding to the disturbance evaluation sample X' can be calculated in a similar calculation method to the first uncertainty estimate EV1 and the second uncertainty estimate EV2 (optionally including the third certainty estimate EV3) corresponding to the original evaluation sample.
[0234] Finally, as shown in S1150, the final robustness metric is obtained by calculating the difference between the original estimated value and the estimated value under disturbance. Specifically, the robustness metric can be directly determined as a combination of three differences (or a three-dimensional vector), that is, the robustness metric RM is expressed as the following formula (11):
[0235]
[0236] In some embodiments, in S1150, the robustness metric RM of the uncertainty metric of the classification model can also be expressed as the product of the above three differences, that is, determined by the following formula (12):
[0237] RM=ΔEV1*ΔEV2*ΔEV3 (12)
[0238] In some embodiments, when the first to sixth uncertainty estimation values are respectively defined as two-dimensional vectors, that is, EV1=(NLL, BSL), EV2=(ECE, AECE), EV3=(AUROC, AUPRC) and EV'1=(NLL', BSL'), EV'2=(ECE', AECE'), EV'3=(AUROC', AUPRC'), then the robustness measure RM of the uncertainty estimation of the classification model can be expressed by the changes in each specific indicator (that is, the following formula):
[0239]
[0240] Among them, NLL', BSL', ECE', AECE', AUROC', AUPRC' respectively represent the negative logarithmic loss, Bell score loss, expected calibration error, adaptive expected calibration error, ROC area, and PRC area corresponding to the perturbed evaluation samples. It can be seen from formula (13) that the change value or decrease value of each uncertainty estimation index (relative to the estimation index NLL, BSL, ECE, AECE, AUROC, AUPRC corresponding to the original evaluation sample) when the model applies perturbations to the input samples can be used to characterize the robustness measure of the uncertainty measure of the model. Optionally, the robustness measure of the uncertainty measure of the model can also be expressed as the weighted average or product of the change values of these indicators shown in formula (13).
[0241] In some embodiments, Fig.11The step S1110 shown (for each sample data in the sample data set, applying a disturbance to the original evaluation sample to obtain a disturbed evaluation sample) may include, for each sample data in the sample data set, performing the following steps: in response to the original evaluation sample of the sample data being a picture sample, applying rain, snow and fog noise to the original evaluation sample to obtain a disturbed evaluation sample; in response to the original evaluation sample of the sample data being a non-picture sample, applying Gaussian noise to the original evaluation sample to obtain a disturbed evaluation sample. Here, Gaussian noise refers to a type of noise whose probability density function obeys a Gaussian distribution (i.e., a normal distribution). Common Gaussian noises include fluctuation noise, cosmic noise, thermal noise, shot noise, and the like.
[0242] Fig.12 An example block diagram of a classification model uncertainty measure determination device 1200 according to some embodiments of the present application is schematically shown.
[0243] like Fig.12 As shown, the classification model uncertainty measure determination device 1200 includes a sample data acquisition module 1210, a classification model prediction module 1220, a prediction loss calculation module 1230, a calibration error calculation module 1240, and an evaluation result determination module 1250.
[0244] The sample data acquisition module 1210 may be configured to acquire a sample data set for evaluating the uncertainty of a classification model, wherein each sample data in the sample data set includes an original evaluation sample and a corresponding classification label.
[0245] The classification model prediction module 1220 can be configured to input the original evaluation sample into the classification model for each sample data in the sample data set to obtain a first predicted classification result, wherein the first predicted classification result includes a first predicted category and a first predicted probability corresponding to the original evaluation sample.
[0246] The prediction loss calculation module 1230 can be configured to calculate the first prediction loss of the classification model according to the difference between the first prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a first uncertainty estimate.
[0247] The calibration error calculation module 1240 may be configured to calculate a first calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data in the sample data set and the first predicted probability to obtain a second uncertainty estimate.
[0248] The evaluation result determination module 1250 may be configured to determine an uncertainty metric for the classification model based at least on the first uncertainty estimate and the second uncertainty estimate.
[0249] It should be noted that the various modules described above can be implemented in software or hardware or a combination of the two. Multiple different modules can be implemented in the same software or hardware structure, or one module can be implemented by multiple different software or hardware structures.
[0250] In a classification model uncertainty metric determination device according to some embodiments of the present application, first, the uncertainty metric determination process of the classification model is divided into a calculation process of multi-dimensional (at least two dimensions) indicators (i.e., a first uncertainty estimate or sample-level uncertainty estimate and a second uncertainty estimate or task-level uncertainty estimate) for different types of application scenarios, thereby achieving a reliable assessment of the uncertainty of the classification model from multiple angles and in an all-round manner, significantly reducing the potential risks caused by inaccurate model uncertainty estimates, and thus assisting enterprises or institutions to more comprehensively and accurately understand the advantages and disadvantages of model uncertainty, and better guide the optimization and improvement of the model to improve the model's prediction accuracy and computational efficiency; secondly, the calculated multi-dimensional uncertainty estimation indicators are comprehensively considered to obtain the final uncertainty metric (e.g., an uncertainty estimation score), thereby providing researchers or engineers with a unified and reliable model uncertainty metric determination standard, ensuring the accuracy of the uncertainty (or reliability) assessment of the model in various application scenarios, and achieving a wider range of application scenario applicability, thereby making more informed decisions in the research and development and deployment of artificial intelligence products.
[0251] Fig.13 An example block diagram of a computing device 1300 according to some embodiments of the present application is schematically shown. The computing device 1300 may represent a device for implementing the various means or modules described herein and / or performing the various methods described herein. The computing device 1300 may be, for example, a server, a desktop computer, a laptop computer, a tablet, a smart phone, a smart watch, a wearable device, or any other suitable computing device or computing system, which may include various levels of devices ranging from full-resource devices with a large amount of storage and processing resources to low-resource devices with limited storage and / or processing resources. In some embodiments, the above description of the computing device 1300 may be a computer system that can be used to implement the various means or modules described herein and / or perform the various methods described herein. Fig.12 The described classification model uncertainty measure determination apparatus 1200 may be implemented in one or more computing devices 1300 , respectively.
[0252] like Fig.13As shown, the example computing device 1300 includes a processing system 1301, one or more computer-readable media 1302, and one or more I / O interfaces 1303 that are communicatively coupled to each other. Although not shown, the computing device 1300 may also include a system bus or other data and command transmission system that couples various components to each other. The system bus may include any one or combination of different bus structures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and / or a processor or local bus that utilizes any of a variety of bus architectures. Alternatively, other components such as control and data lines may also be included.
[0253] Processing system 1301 represents the functionality of performing one or more operations using hardware. Thus, processing system 1301 is illustrated as including hardware elements 1304 that may be configured as processors, functional blocks, and the like. This may include other logic devices implemented in hardware as application specific integrated circuits or formed using one or more semiconductors. Hardware elements 1304 are not limited by the materials from which they are formed or the processing mechanisms employed therein. For example, a processor may be composed of (multiple) semiconductors and / or transistors (e.g., electronic integrated circuits (ICs)). In such a context, processor executable instructions may be electronic executable instructions.
[0254] Computer-readable medium 1302 is illustrated as including memory / storage 1305. Memory / storage 1305 represents a memory / storage associated with one or more computer-readable media. Memory / storage 1305 may include volatile media (such as random access memory (RAM)) and / or non-volatile media (such as read-only memory (ROM), flash memory, optical disk, magnetic disk, etc.). Memory / storage 1305 may include fixed media (e.g., RAM, ROM, fixed hard drive, etc.) and removable media (e.g., flash memory, removable hard drive, optical disk, etc.). Exemplarily, memory / storage 1305 may be used to store sample data sets mentioned in the above embodiments, etc. Computer-readable medium 1302 may be configured in various other ways as further described below.
[0255] One or more I / O (input / output) interfaces 1303 represent functionality that allows a user to type commands and information into the computing device 1300 and also allows information to be displayed to the user and / or sent to other components or devices using various input / output devices. Examples of input devices include a keyboard, a cursor control device (e.g., a mouse), a microphone (e.g., for voice input), a scanner, touch functionality (e.g., a capacitive or other sensor configured to detect physical touch), a camera (e.g., that can use visible or invisible wavelengths (such as infrared frequencies) to detect motion that does not involve touch as gestures), a network card, a receiver, and the like. Examples of output devices include a display device, a speaker, a printer, a tactile response device, a network card, a transmitter, and the like. Exemplarily,
[0256] The computing device 1300 also includes a classification model uncertainty metric determination strategy 1306. The classification model uncertainty metric determination strategy 1306 can be stored as a computer program instruction in the memory / storage device 1305, or can be hardware or firmware. The classification model uncertainty metric determination strategy 1306 can be implemented together with the processing system 1301, etc. Fig.12 The described classification model uncertainty measure determines the overall functions of each module of the device 1200.
[0257] Various techniques may be described herein in the general context of software, hardware, elements, or program modules. Typically, these modules include routines, programs, objects, elements, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The terms "module," "function," etc., as used herein, generally represent software, firmware, hardware, or a combination thereof. The features of the techniques described herein are platform-independent, meaning that these techniques can be implemented on a variety of computing platforms with a variety of processors.
[0258] An implementation of the described modules and techniques may be stored on or transmitted across some form of computer-readable media. Computer-readable media may include various media accessible by computing device 1300. By way of example and not limitation, computer-readable media may include “computer-readable storage media” and “computer-readable signal media”.
[0259] In contrast to a simple signal transmission, carrier wave, or signal itself, "computer-readable storage medium" refers to a medium and / or device capable of persistently storing information, and / or a tangible storage device. Therefore, a computer-readable storage medium refers to a non-signal-bearing medium. Computer-readable storage media include hardware such as volatile and non-volatile, removable and non-removable media and / or storage devices implemented in a method or technology suitable for storing information (such as computer-readable instructions, data structures, program modules, logic elements / circuits, or other data). Examples of computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage device, hard disk, cassette, magnetic tape, magnetic disk storage device or other magnetic storage device, or other storage device, tangible medium, or article of manufacture suitable for storing desired information and accessible by a computer.
[0260] "Computer readable signal media" refers to signal bearing media that is configured to send instructions to the hardware of computing device 1300, such as via a network. Signal media typically can embody computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, data signal, or other transport mechanism. Signal media also includes any information transfer media. By way of example and not limitation, signal media include wired media such as a wired network or direct connection and wireless media such as acoustic, RF, infrared, and other wireless media.
[0261] As previously described, hardware elements 1304 and computer-readable media 1302 represent instructions, modules, programmable device logic, and / or fixed device logic implemented in hardware form, which in some embodiments can be used to implement at least some aspects of the technology described herein. Hardware elements can include integrated circuits or systems on a chip, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), complex programmable logic devices (CPLDs), and other implementations in silicon or components of other hardware devices. In this context, hardware elements can be used as processing devices for executing program tasks defined by instructions, modules, and / or logic embodied by hardware elements, as well as hardware devices for storing instructions for execution, such as the computer-readable storage media described previously.
[0262] The aforementioned combination may also be used to implement the various techniques and modules described herein. Therefore, software, hardware or program modules and other program modules may be implemented as one or more instructions and / or logic embodied on some form of computer-readable storage medium and / or by one or more hardware elements 1304. Computing device 1300 may be configured to implement specific instructions and / or functions corresponding to software and / or hardware modules. Therefore, for example, by using a computer-readable storage medium and / or hardware element 1304 of a processing system, a module may be implemented as a module executable by computing device 1300 as software, at least in part, in hardware. Instructions and / or functions may be executed / operable by, for example, one or more computing devices 1300 and / or processing system 1301 to implement the techniques, modules and examples described herein.
[0263] The techniques described herein may be supported by these various configurations of computing device 1300 and are not limited to the specific examples of the techniques described herein.
[0264] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer program. For example, an embodiment of the present application provides a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing at least one step in the method embodiment of the present application.
[0265] In some embodiments of the present application, one or more computer-readable storage media are provided, on which computer-readable instructions are stored, and when the computer-readable instructions are executed, the classification model uncertainty metric determination method according to some embodiments of the present application is implemented. The various steps of the classification model uncertainty metric determination method according to some embodiments of the present application can be converted into computer-readable instructions through programming, thereby storing them in a computer-readable storage medium. When such a computer-readable storage medium is read or accessed by a computing device or a computer, the computer-readable instructions therein are executed by a processor on the computing device or the computer to implement the method described in some embodiments of the present application.
[0266] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradicting each other.
[0267] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed in a sequence not shown or discussed (including in a substantially simultaneous manner or in reverse order depending on the functions involved), which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0268] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0269] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, it can be implemented by any one of the following technologies well known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combinational logic gate circuit, a programmable gate array (Programmable Gate Array), a field programmable gate array (FieldProgrammable Gate Array), etc.
[0270] A person skilled in the art may understand that all or part of the steps of the above-mentioned embodiment method may be completed by hardware associated with program instructions, and the program may be stored in a computer-readable storage medium, which, when executed, includes executing one or a combination of the steps of the method embodiment.
[0271] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may 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 may also be stored in a computer-readable storage medium.
[0272] It is understandable that in the specific implementation of the present application, sample data sets for evaluating the uncertainty of classification models are involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
Claims
1. A method for determining uncertainty measurement of a classification model, comprising: Acquire a sample data set for evaluating the uncertainty of a classification model, wherein each sample data in the sample data set includes an original evaluation sample and a corresponding classification label; For each sample data in the sample data set, inputting the original evaluation sample into the classification model to obtain a first prediction classification result, the first prediction classification result including a first prediction category and a first prediction probability corresponding to the original evaluation sample; Calculate a first prediction loss of the classification model according to the difference between the first prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a first uncertainty estimation value; Calculate a first calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data in the sample data set and the first predicted probability to obtain a second uncertainty estimate; An uncertainty measure for the classification model is determined based on at least the first uncertainty estimate and the second uncertainty estimate.
2. The method of claim 1 , wherein determining an uncertainty measure for the classification model based at least on the first uncertainty estimate and the second uncertainty estimate comprises: Calculate a first classification effect indicator of the classification model according to the classification label corresponding to each sample data in the sample data set and the first prediction probability to obtain a third uncertainty estimation value; An uncertainty measure for the classification model is determined based on the first uncertainty estimate, the second uncertainty estimate, and the third uncertainty estimate.
3. The method according to claim 1 or 2, wherein the first prediction loss of the classification model is calculated according to the difference between the first prediction probability corresponding to each sample data in the sample data set and the classification label to obtain the first uncertainty estimate, comprising: Calculate the negative log-likelihood loss of the classification model based on the difference between the first predicted probability and the classification label corresponding to each sample data; Calculate the Bell score loss of the classification model based on the difference between the first predicted probability and the classification label corresponding to each sample data; A first uncertainty estimate is determined based on at least one of a negative log-likelihood loss and a Bell fraction loss.
4. The method according to claim 1 or 2, wherein the calculating the first calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data in the sample data set and the first predicted probability to obtain the second uncertainty estimate comprises: Calculate the expected calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data and the first predicted probability; Calculate the adaptive expected calibration error of the classification model according to the difference between the first predicted category and the classification label corresponding to each sample data and the first predicted probability; A second uncertainty estimate is determined based on at least one of the expected calibration error and the adaptive expected calibration error.
5. The method according to claim 2, wherein the step of calculating the first classification effect index of the classification model according to the classification label corresponding to each sample data in the sample data set and the first prediction probability to obtain a third uncertainty estimation value comprises: Calculating the area under the receiver operating characteristic curve according to the classification label corresponding to each sample data, the first predicted probability, and multiple preset classification probability thresholds; Calculate the area under the precision-recall curve according to the classification label corresponding to each sample data, the first prediction probability, and multiple preset classification probability thresholds; A third uncertainty estimate is determined based on at least one of an area under a receiver operating characteristic curve and an area under a precision-recall curve.
6. The method according to claim 5, wherein the calculating the area under the receiver operating characteristic curve according to the classification label corresponding to each sample data, the first predicted probability and a plurality of preset classification probability thresholds comprises: Determine the true positive rate and the false positive rate under the multiple preset classification probability thresholds according to the classification label corresponding to each sample data, the first prediction probability and the multiple preset classification probability thresholds; Based on the true positive rate and the false positive rate under the plurality of preset classification probability thresholds, constructing a receiver operating characteristic curve corresponding to the classification model in a plane rectangular coordinate system; The area of the region enclosed by the receiver operating characteristic curve corresponding to the classification model and the horizontal and vertical axes of the plane rectangular coordinate system was calculated.
7. The method according to claim 5, wherein the step of calculating the area under the precision-recall curve according to the classification label corresponding to each sample data, the first prediction probability, and a plurality of preset classification probability thresholds comprises: According to the classification label corresponding to each sample data, the first prediction probability and a plurality of preset classification probability thresholds, determining the precision and recall under the plurality of preset classification probability thresholds; Based on the precision and recall under the plurality of preset classification probability thresholds, constructing a precision-recall curve corresponding to the classification model in a plane rectangular coordinate system; Calculate the area of the region enclosed by the precision-recall curve corresponding to the classification model and the horizontal and vertical axes of the plane rectangular coordinate system.
8. The method of claim 2, wherein determining an uncertainty measure for the classification model based on the first uncertainty estimate, the second uncertainty estimate, and the third uncertainty estimate comprises: Taking the inverse of the first uncertainty estimate to obtain a first indicator; Taking the inverse of the second uncertainty estimate to obtain a second indicator; The product of the first indicator, the second indicator, and the third uncertainty estimate is calculated to determine an uncertainty score for the classification model.
9. The method according to claim 2, characterized in that: The method further comprises: For each sample data in the sample data set, perturb the original evaluation sample to obtain a perturbed evaluation sample; For each sample data in the sample data set, input the disturbance evaluation sample into the classification model to obtain a second prediction classification result, where the second prediction classification result includes a second prediction category and a second prediction probability corresponding to the disturbance evaluation sample; Calculate the second prediction loss of the classification model according to the difference between the second prediction probability corresponding to each sample data in the sample data set and the classification label to obtain a fourth uncertainty estimation value; Calculate a second calibration error of the classification model according to the difference between the second predicted category and the classification label corresponding to each sample data in the sample data set and the second predicted probability to obtain a fifth uncertainty estimate; A robustness measure of the uncertainty measure of the classification model is determined based at least on a difference between the fourth uncertainty estimate and the first uncertainty estimate and a difference between the fifth uncertainty estimate and the second uncertainty estimate.
10. The method of claim 9, wherein determining a robustness measure of the uncertainty measure of the classification model based at least on a difference between the fourth uncertainty estimate and the first uncertainty estimate and a difference between the fifth uncertainty estimate and the second uncertainty estimate comprises: Calculating a second classification effect indicator of the classification model according to the classification label corresponding to each sample data in the sample data set, the second prediction probability, and a plurality of preset classification probability thresholds to obtain a sixth uncertainty estimation value; A robustness measure of the uncertainty measure of the classification model is determined based on a difference between the fourth uncertainty estimate and the first uncertainty estimate, a difference between the fifth uncertainty estimate and the second uncertainty estimate, and a difference between the sixth uncertainty estimate and the third uncertainty estimate.
11. The method according to claim 9, wherein for each sample data in the sample data set, applying a perturbation to the original evaluation sample to obtain a perturbed evaluation sample comprises: For each sample data in the sample data set, in response to the original evaluation sample of the sample data being a picture sample, rain, snow and fog noise is applied to the original evaluation sample to obtain a disturbance evaluation sample; For each sample data in the sample data set, in response to the original evaluation sample of the sample data being a non-image sample, Gaussian noise is applied to the original evaluation sample to obtain a disturbed evaluation sample.
12. The method according to claim 1, wherein the classification model comprises an integrated classification model composed of at least one classification sub-model, and wherein, For each sample data in the sample data set, the original evaluation sample is input into the classification model to obtain a first predicted classification result, including: For each classification sub-model in the integrated classification model, the original evaluation sample of each sample data in the sample data set is input into the classification sub-model to obtain the predicted classification probability of each sample data under the classification sub-model, For each sample data, the arithmetic mean of the predicted classification probabilities of the sample data under each classification sub-model is calculated to obtain the first predicted classification result of the sample data under the integrated model. The first predicted classification result includes the first predicted category and the first predicted probability corresponding to the original evaluation sample.
13. A classification model uncertainty measure determination device, comprising: A sample data acquisition module, configured to acquire a sample data set for evaluating the uncertainty of a classification model, wherein each sample data in the sample data set includes an original evaluation sample and a corresponding classification label; A classification model prediction module, configured to input the original evaluation sample into the classification model for each sample data in the sample data set to obtain a first prediction classification result, wherein the first prediction classification result includes a first prediction category and a first prediction probability corresponding to the original evaluation sample; A prediction loss calculation module, configured to calculate a first prediction loss of the classification model according to a difference between a first prediction probability and a classification label corresponding to each sample data in the sample data set to obtain a first uncertainty estimation value; a calibration error calculation module, configured to calculate a first calibration error of the classification model according to a difference between a first predicted category and a classification label corresponding to each sample data in the sample data set and a first predicted probability to obtain a second uncertainty estimate; An evaluation result determination module is configured to determine an uncertainty measure of the classification model based on at least the first uncertainty estimate and the second uncertainty estimate.
14. A computing device comprising: Memory and processor, A computer program is stored in the memory, and when the computer program is executed by the processor, the processor is prompted to perform the method according to any one of claims 1 to 12.
15. A computer-readable storage medium storing computer-readable instructions, wherein the computer-readable instructions implement the method of any one of claims 1 to 12 when executed.
16. A computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
Citation Information
Cited By
Large language model security assessment method and device and electronic equipment
CN120805149A
Large Language Model Security Assessment Methods, Devices and Electronic Equipment
CN120805149B
Prediction stability evaluation method and device of artificial intelligence model, equipment and product
CN121030282A