Neural network model prediction confidence calibration method, system and storage medium
By calculating the distribution consistency score and density adaptation factor in the neural network model and calibrating the prediction confidence, the problem of overconfidence in the prediction of out-of-distribution samples by the neural network in high-risk areas is solved, and the reliability and accuracy of the prediction results are improved. .
Patent Information
- Application Number
- CN202011242401.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-09
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-11-09
AI Technical Summary
In high-risk fields such as equipment failure detection and medical diagnosis, neural network models are prone to overconfidence when faced with out-of-distribution samples, resulting in prediction confidence that cannot accurately reflect the reliability of model prediction results, making it difficult to provide reliable decision-making basis.
By collecting and cleaning data, training the neural network model, calculating the distribution consistency score and combining it with the original prediction probability, using the density adaptive factor to correct the local distance, output the calibrated prediction confidence, reduce the confidence of out-of-distribution samples, and improve the prediction results. reliability.
It significantly improves the overconfidence problem of neural networks when predicting out-of-distribution samples, improves prediction accuracy, provides more accurate risk assessment, and is suitable for high-risk decision-making areas.
Smart Images

Figure CN112183751B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning technology, and in particular to a neural network model prediction confidence calibration method, system and storage medium. Background Art
[0002] With the development of computer and electronic technology, enterprises and industries have gradually accumulated a large amount of data, making data-driven machine learning technology landed in practical scenarios. In machine learning modeling, it is usually assumed that the collected data is distributed in the same way as the actual data. Therefore, the collected data is used to build a neural network model to predict new test data. However, in actual production scenarios, especially in some high-risk fields such as equipment fault detection, medical diagnosis, and autonomous driving, test data that is inconsistent with the distribution of collected data is often encountered, which is called out-of-distribution samples. Out-of-distribution samples mainly come from two situations: improper human operation introduces measurement errors, and there are parameter differences between application devices, resulting in the generation of abnormal data or data domain drift; insufficient diversity of collected samples, that is, the distribution of data samples collected for model training cannot represent the sample space of the real world. The model prediction confidence reflects the possibility that the model prediction result is correct, and is used to judge whether the result of the model itself is reliable. If the model is used to predict out-of-distribution samples, it is easy to predict wrongly and the prediction confidence is too high (the model prediction is overconfident). At this time, the prediction confidence cannot accurately measure the reliability of the model prediction result, so it is difficult to provide a reliable decision-making basis for the system. Therefore, a prediction confidence calibration method is needed so that the prediction confidence can accurately reflect the reliability of the model prediction results. When the model encounters the above-mentioned out-of-distribution data, its confidence should be appropriately lowered to indicate that the prediction results at this time have low reliability. Therefore, the prediction confidence can be used to conduct risk assessment on the prediction results. When the prediction risk is higher than the preset threshold, industry experts can make the final decision based on the model prediction results and their own experience and knowledge to avoid dangerous accidents caused by wrong decisions of the neural network model.
[0003] The existing confidence calculation methods mainly include: 1) Confidence estimation technology based on model posterior probability. The probabilistic classification model can output the probability that the sample belongs to each category, that is, the posterior probability, and make classification predictions based on the posterior probability. For example, the prediction confidence of the neural network model usually uses the Soft-max layer to output the probability. However, researchers have experimentally proved that when predicting samples outside the distribution, the neural network model often makes mistakes and gives a prediction probability of up to 99%. 2) Multi-model prediction confidence integration technology. This type of technology uses multiple classifiers to make predictions separately, and fuses the prediction probability of each classifier as the confidence after integration, and finally classifies the result according to the confidence after integration. 3) Model confidence calculation technology based on sample point distance measurement. This type of technology calculates the distance between the sample to be tested and the surrounding training samples, and then estimates the possibility that the sample to be tested belongs to each category as the prediction confidence. However, the existing technology has not yet considered the differences in the distribution density of sample points between clusters of each category. Therefore, for the common problem of imbalanced category distribution in applications such as disease diagnosis and fault detection, this type of technology still needs further improvement. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention discloses a method for calibrating the prediction confidence of a neural network model, which specifically comprises the following steps:
[0005] Collect sample data with category labels and perform data cleaning and normalization to obtain collected data;
[0006] Train the neural network model and save it;
[0007] Read the data to be tested and the collected data and input them into the trained neural network model respectively, and obtain the embedding vector of the feature to be tested and the embedding vector of the collected feature from the hidden layer of the neural network model;
[0008] According to the collected feature embedding vectors, the projection clusters of each category are obtained, the aliased collected samples are filtered, the density adaptive factor of each projection cluster and the local distance of the test sample belonging to each category of projection cluster are calculated, the local distance is corrected by the density adaptive factor and normalized to the preset interval to obtain the distribution consistency score of the test sample and the collected samples of each category, and the model prediction confidence of the calibrated neural network is obtained based on the distribution consistency score and the original prediction probability of the neural network model.
[0009] Furthermore, according to the K-nearest neighbor algorithm theory, the categories of the k nearest neighbor samples of the collected samples are queried to obtain the aliasing degree q of each sample neighborhood, and a filtering threshold is set to filter the collected samples corresponding to the aliasing degree q less than the filtering threshold so as to retain the collected samples corresponding to the aliasing degree greater than the filtering threshold.
[0010] Furthermore, when calculating the local distance between the test sample and each projection cluster: assume a multi-classification problem with C categories and calculate the test sample x test The average distance to the nearest k samples in the c-th category projection cluster is denoted by d c (x test ), where c = 0, 1, 2, ..., C-1
[0011]
[0012] Furthermore, when calculating the distribution consistency score: the density balance factor is used to balance the distribution density of clusters of different categories, and the average distance between the collected sample points of category C is estimated as the density adaptation factor γ of category C. c :
[0013]
[0014] Adopting the class density adaptive factor γ c The average distance d c (x test ) is modified to obtain the distribution consistency score d′ c (x test ):
[0015]
[0016] The distribution consistency score is normalized so that the value range of the distribution consistency score calculation result is distributed in the preset [0,1] interval, thereby obtaining the distribution consistency score of the test sample belonging to the cth category Consis (x test ,c).
[0017] Furthermore, based on the distribution consistency score of the test sample belonging to the cth category, test ,c) Use weighted summation to combine the consistency score Consis(x test ,c) and the model's original prediction probability P model (c|x test ) two parts of parameters, thereby outputting the model prediction confidence P(c|x test ):
[0018] P(c|x test )=α×Consis(x test ,c)+(1-α)×P model (c|x test ) (7)
[0019] Where α is the weight parameter of the distribution consistency score in the final prediction probability calculation, 0≤α≤1.
[0020] A neural network model prediction confidence calibration system, the system comprising:
[0021] A collection unit, used to collect sample data with category labels and perform data cleaning and normalization processing on the sample data to obtain collected data;
[0022] A training unit, which inputs the collected data into the neural network model for training and saves the trained neural network model;
[0023] The information retrieval unit reads the data to be tested and receives the collected data transmitted by the acquisition unit, and at the same time reads the neural network model transmitted by the training unit, inputs the collected data and the data to be tested into the trained neural network model, and obtains the corresponding feature embedding vector from the hidden layer of the neural network model;
[0024] A confidence acquisition unit receives the collected feature embedding vector information transmitted by the information retrieval unit to obtain projection clusters of each category. The confidence acquisition unit calculates the density adaptive factor of each projection cluster and the local distance between the feature vector to be tested and the projection cluster of each category, corrects the local distance using the density adaptive factor and normalizes it to a preset interval to obtain the distribution consistency score of the test sample and each category, and then obtains the model prediction confidence of the calibrated neural network based on the distribution consistency score and the original prediction probability of the neural network model.
[0025] A computer-readable storage medium stores a computer program, wherein when the computer program is run, the above-mentioned neural network model prediction confidence calibration method is executed.
[0026] Due to the adoption of the above technical scheme, the present invention provides a neural network model prediction confidence calibration method, which calibrates the output probability of the neural network model through the distribution consistency score. While ensuring the prediction accuracy, the method significantly improves the problem of overconfidence (confidence is too high) when the neural network predicts samples outside the distribution, and can be used for prediction risk assessment in the field of high-risk decision-making; the present invention adopts a method for calculating the local distance between samples in a low-dimensional embedding space, which maps the original data to a discriminative dense embedding space, and estimates the distribution consistency between the sample to be tested and the collected sample in the space. On the one hand, this method avoids sparse data distribution and improves the effectiveness of distance calculation. On the other hand, the feature vector extracted by this method has category discrimination, so that the sample points in the projection space have good category discrimination. Therefore, compared with the existing distance-based confidence calculation technology, the present invention proposes a density balance coefficient to solve the problem of category imbalance in real business scenarios and improve the accuracy of the confidence calibration method on category clusters of different densities. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 is a flow chart of the method of the present invention;
[0029] Figure 2 Schematic diagram of the confidence calibration method of the present invention;
[0030] Figure 3 This is a schematic diagram of the visualization results of the projection clusters of each category before and after filtering of the present invention;
[0031] Figure 4 (a) Uncalibrated neural network confidence distribution heat map;
[0032] FIG4( b ) is a heat map of confidence distribution after calibration using the method of the present invention;
[0033] Figure 5 The figure is a schematic diagram of the structure of the system disclosed in the present invention. DETAILED DESCRIPTION
[0034] In order to make the technical solutions and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention:
[0035] The labeled sample data in this application is collected based on the application problem. For medical diagnosis tasks, it can be collected electronic medical records and disease labels of patients, or image cases. For fault analysis, it can be some feature information records and corresponding labels collected from several devices, such as Figure 1 A neural network model prediction confidence calibration method shown in FIG. 1 specifically comprises the following steps:
[0036] S1: Collect sample data with category labels and perform data cleaning and normalization. Assuming that the characteristic dimension of the data is D and the number of samples collected is N, the collected data can be represented in matrix form, recorded as The corresponding category labels of the collected data are represented by N-dimensional vectors, denoted as
[0037] S2: Train the neural network model and save the model, using the labeled collection sample pairs (I train , Y train ), train a neural network classifier, complete the training and save it.
[0038] S3: Read the data to be tested. Assuming that the number of samples of the data to be tested is M, the data to be tested is expressed in matrix form, recorded as Load the neural network model, input the collected data and the data to be tested into the neural network model respectively, and obtain the corresponding feature embedding vector from the hidden layer of the neural network model. Assuming that the number of neurons in the hidden layer of the network is S, the feature embedding of the collected data and the data to be tested is expressed as:
[0039] S4: Figure 2 As shown: the projection clusters of each category are obtained according to the feature embedding vectors of the training samples, the aliased training samples are filtered, the density adaptive factor of each projection cluster and the local distance of the test sample belonging to each category of the projection cluster are calculated, the local distance is corrected by the density adaptive factor and normalized to the preset interval to obtain the distribution consistency score of the test sample and each category, and the model prediction confidence of the calibrated neural network is obtained based on the distribution consistency score and the original prediction probability of the neural network model.
[0040] S41: First, aliased samples are filtered. In the feature embedding space obtained by mapping, samples with similar features are mapped to the low-dimensional embedding space and clustered together to form a projection cluster. There may be overlaps between projection areas of different categories, so it is necessary to first filter out samples in areas with large aliasing. Then, according to the idea of the K-nearest neighbor algorithm, the categories of the nearest k neighbor samples of the sample are queried, and formula (1) is calculated to obtain the aliasing degree q of each sample neighborhood.
[0041]
[0042] In the formula is the feature embedding vector and sample category label of the i-th collected sample in the collected data, k m express The nearest k neighbors belong to the category The number of .
[0043] Next, the collected samples are sorted according to the result of formula (1), a filtering threshold m% is set, and the first m% of the collected samples are retained according to the sorting, thereby filtering out aliased samples.
[0044] S42: Calculate the local distance between the feature embedding vector of the sample to be tested and the projection cluster of each category
[0045] Assume a multi-classification problem with C categories. Calculate the test sample x test The average distance to the nearest k samples in the projection cluster of the c-th category (c = 0, 1, 2, ..., C-1), denoted as d c (x test ).
[0046]
[0047] S43: Calculate the density balance factor of each category, modify formula (2), and thus calculate the distribution consistency score, considering that the data in the real world is usually unevenly distributed, and the distribution density of different category clusters is different. In the present invention, we design a density balance factor to balance the distribution density of different category clusters. Intuitively, when the distribution of a category in the space is relatively sparse, the distance between the sample of this category and its nearest sample may also be relatively far. Specifically, first, the average distance between the collected sample points of category C is estimated as the density adaptive factor of category C, denoted as γ c , the calculation formula is shown in formula (3):
[0048]
[0049] Where d <x i ,x j > represents x i and x j The Euclidean distance is a distance measurement method between the two. The formula in brackets is calculated as the average distance from the i-th collected sample of category C to its nearest k neighbors of the same category, n c The number of samples collected for category C.
[0050] Next, the class density adaptation factor γ is used c The calculation result of formula (2) is modified to obtain the distribution consistency score, which is recorded as d′ c (x test ).
[0051]
[0052] Analyzing the above formula (4), when the numerator γ c When fixed, the distribution consistency score of the test sample belonging to category C and its local distance d to the c category cluster c (x test ). That is, when the local distance between the test sample and the projection cluster of category C is smaller, the consistency of the category to which the formula belongs is higher. When the distribution of category C cluster is sparser than that of other categories, its density factor γ c will be larger, so, from (4), we can see that the local distance d between the test sample and the C cluster is c (x test ) can be appropriately increased. And vice versa, which can balance the consistency scores under different category distribution densities.
[0053] S44: Normalize the distribution consistency score so that the value range of the distribution consistency score calculation result is distributed in the interval [0,1]:
[0054]
[0055] S45: Confidence of prediction for calibrated neural network: First, obtain the prediction posterior probability of the model, denoted as P model Taking the neural network model as an example, let C be the number of categories, which is also the number of neurons in the output layer. The output layer of the neural network is activated by the soft-max function to obtain x test The probability of category c is:
[0056]
[0057] Where o i (x) represents the output value of the i-th neuron in the output layer when x is input into the neural network model.
[0058] Next, the prediction probability of the result calibration model is calculated by formula (5), thereby obtaining the prediction confidence of the test sample, as shown in formula (6).
[0059] P(c|x test )=α×Consis(x test ,c)+(1-α)×P model (c|x test ) (7)
[0060] Where α is the weight parameter of the distribution consistency score in the final prediction probability calculation, 0≤α≤1.
[0061] S46: Output the predicted category and the calibrated prediction confidence, make a decision based on the prediction confidence, and predict the category to which the test sample belongs, denoted as y pred :
[0062]
[0063] Corresponding to the neural network model prediction confidence calibration method provided by the present invention, the present invention also provides a neural network model prediction confidence calibration system, referring to Figure 5 As shown, including:
[0064] A collection unit, used to collect sample data with category labels and perform data cleaning and normalization processing on the sample data to obtain collected data;
[0065] A training unit, which inputs the collected data into the neural network model for training and saves the trained neural network model;
[0066] The information retrieval unit reads the data to be tested and receives the collected data transmitted by the acquisition unit, and at the same time reads the neural network model transmitted by the training unit, inputs the collected data and the data to be tested into the trained neural network model, and obtains the corresponding feature embedding vector from the hidden layer of the neural network model;
[0067] A confidence acquisition unit receives the collected feature embedding vector information transmitted by the information retrieval unit to obtain projection clusters of each category. The confidence acquisition unit calculates the density adaptive factor of each projection cluster and the local distance between the feature vector to be tested and the projection cluster of each category, corrects the local distance using the density adaptive factor and normalizes it to a preset interval to obtain the distribution consistency score of the test sample and each category, and then obtains the model prediction confidence of the calibrated neural network based on the distribution consistency score and the original prediction probability of the neural network model.
[0068] Example: This example uses data collected from multiple hospitals for 2,340 patients with cerebral hemorrhage and cerebral infarction and normal people without the above two diseases. The prediction results and confidence levels of the diseases to which the patients belong output by the present invention enable doctors to formulate corresponding diagnosis and treatment plans.
[0069] The first step is data preprocessing. The cases are divided into training data set and test data set, and the data are normalized.
[0070] The second step is to train a neural network classifier based on the training data set. After network parameter mapping, the feature vector of each case is obtained.
[0071] The third step is to filter out cases in the category aliasing area in the embedding space. In this example, the filtering ratio threshold m is 80%. The distribution of the case data set before and after filtering in the embedding space is visualized as follows: Figure 3 shown. Figure 3 The dark dots represent the training sample points retained after filtering the aliasing area, and the light dots represent the sample points that are filtered out. Different colors are used to represent the categories to which the sample points belong, where the red area is the projection cluster of cerebral hemorrhage, the purple area is the projection cluster of cerebral infarction, and the brown area is the projection cluster of normal people. From the visualization results, it can be seen that the projection points of the same disease are close to each other and clustered into three category projection clusters. Therefore, this step method can effectively filter out the training samples of the aliasing area between cerebral hemorrhage and cerebral infarction.
[0072] The fourth step is to calculate the average K nearest neighbor distance of each training point cluster according to formula (3) for the collected cases. In this case, the number of nearest neighbors k is 5, and the density adaptive factors of cerebral infarction, cerebral hemorrhage, and normal human categories are: γ0 = 0.234, γ1 = 0.112, γ2 = 0.096.
[0073] The fifth step is to query the K closest training samples of the test case in each category cluster and calculate equations (4) to (7). Obtain the calibrated confidence that the test case belongs to each category. In this example, α is taken as 0.5. According to equation (8), the disease type discrimination result and the calibrated prediction confidence are output. When the prediction confidence is less than 80%, the doctor expert will diagnose the patient.
[0074] For example, the neural network model predicts that a patient case has cerebral hemorrhage with the highest confidence of 90%. The distribution consistency score between the case and the cerebral hemorrhage category calculated by the method of the present invention is 60%. Then the calibrated prediction confidence output by the method is calculated as 75% by formula (7), indicating that the probability that the neural network model predicts the sample correctly is 75%. Since the prediction confidence is lower than the threshold, the case is submitted to the doctor for review and the corresponding diagnosis and treatment plan is formulated.
[0075] In order to further verify the generalization and effectiveness of this method, according to formula (6), the corrected confidence that the samples at each coordinate point in the projection space may be three types of diseases is calculated, and the confidence distribution heat map is drawn as shown in Figure 4. Where (a) is the prediction confidence distribution heat map output by the neural network model for each sample point, and (b) is the prediction confidence distribution heat map after calibration using the method of the present invention. The left figure in Figure 4 (a) and (b) is the confidence level predicted as the cerebral hemorrhage category, the middle figure is the confidence level predicted as the normal human category, and the right figure is the confidence level predicted as cerebral hemorrhage. The color in the figure represents the confidence level of the sample points at each position. In Figure (a), the areas near each category cluster are all displayed in yellow, indicating that the sample points in this area are predicted by the model. The confidence level of this category is the same as 100%. It can be seen that for areas far beyond the distribution, a 100% model prediction confidence level will also be obtained. In Figure (b), the farther away from a certain category cluster, the color of the area gradually changes from yellow to blue, indicating that the confidence level of its prediction as this category decreases. It can be seen from the confidence heat map before and after calibration that the method of the present invention more accurately reflects the reliability of the model prediction results, effectively reduces the model confidence of out-of-distribution samples, and solves the problem of overconfidence in the prediction of out-of-distribution samples.
[0076] An embodiment of the present invention further discloses a computer-readable storage medium, in which a computer instruction set is stored. When the computer instruction set is executed by a processor, the method for automatically identifying medical image artifacts as provided in any of the above embodiments is implemented.
[0077] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0078] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0079] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0080] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0081] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0082] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0083] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A neural network model prediction confidence calibration method, characterized in that include: Collect sample data with category labels and perform data cleaning and normalization to obtain collected data, where the sample data is the real examination index record data of patients with cerebral hemorrhage, cerebral infarction and normal people who do not suffer from the above two diseases. The collected data is divided into a training data set and a test data set; Train the neural network model and save it, input the training data set into the neural network model to train its classifier, and obtain the feature vector of each case in the sample data based on the neural network model parameter mapping principle Read the data to be tested and the collected data and input them into the trained neural network model respectively, and obtain the embedding vector of the feature to be tested and the embedding vector of the collected feature from the hidden layer of the neural network model; According to the collected feature embedding vector, the projection clusters of each category are obtained, and the aliased collected samples are filtered, and the case information in the category aliasing area in the embedding space is filtered to obtain the distribution area of the case data set in the embedding space before and after filtering, where the distribution area includes the cerebral hemorrhage projection cluster area, the cerebral infarction projection cluster area and the normal person projection cluster area. Since the projection points of the same disease are close to each other, they are clustered into three category projection clusters, and the training samples in the aliasing area between the two categories of cerebral hemorrhage and cerebral infarction are filtered out; Calculate the density adaptive factor of each projection cluster and the local distance of the test sample belonging to each category of projection cluster, obtain the average nearest neighbor distance of each training point cluster, and obtain the density adaptive factor of cerebral infarction, cerebral hemorrhage, and normal human categories; The local distance is corrected using a density adaptive factor and normalized to a preset interval to obtain the distribution consistency score between the test sample and the collected samples of each category. The model prediction confidence of the calibrated neural network is obtained based on the distribution consistency score and the original prediction probability of the neural network model.
2. The method according to claim 1, further characterized in that: When filtering aliased collected samples: query the categories of the nearest k neighbor samples of the collected samples according to the K-nearest neighbor algorithm theory to obtain the aliasing degree q of each sample neighborhood, set the filtering threshold, filter the collected samples corresponding to the aliasing degree q less than the filtering threshold, and retain the collected samples corresponding to the aliasing degree greater than the filtering threshold.
3. The method according to claim 1, further characterized in that: When calculating the local distance between the test sample and each projection cluster: set a multi-classification problem with the number of categories C, calculate the test sample x test The average distance to the nearest k samples in the c-th category projection cluster is denoted by d c (x test ), where c = 0, 1, 2, ..., C-1 4. The method according to claim 3, further characterized in that: When calculating the distribution consistency score: the density balance factor is used to balance the distribution density of clusters of different categories, and the average distance between the collected sample points of category C is estimated as the density adaptation factor γ of category C. c : Adopting the class density adaptive factor γ c The average distance d c (x test ) is modified to obtain the distribution consistency score d c ′(x test ): The distribution consistency score is normalized so that the value range of the distribution consistency score calculation result is distributed in the preset [0,1] interval, thereby obtaining the distribution consistency score of the test sample belonging to the cth category Consis (x test ,c).
5. The method according to claim 4, further characterized in that: Based on the distribution consistency score of the test sample belonging to the cth category, Consis(x test ,c) Use weighted summation to combine the consistency score Consis(x test ,c) and the model's original prediction probability P model (c|x test ) two parts of parameters, thereby outputting the model prediction confidence P(c|x test ): P(c|x test )=α×Consis(x test ,c)+(1-α)×P model (c|x test ) Where α is the weight parameter of the distribution consistency score in the final prediction probability calculation, 0≤α≤1.
6. A neural network model prediction confidence calibration system, characterized in that: The system comprises: The collection unit is used to collect sample data with category labels and perform data cleaning and normalization processing on the sample data to obtain the collected data; wherein the sample data is the real examination index record data of patients with cerebral hemorrhage and cerebral infarction and normal people who do not suffer from the above two diseases, and the collected data is divided into a training data set and a test data set; A training unit, inputting the collected data into the neural network model for training and saving the trained neural network model; wherein the training data set is input into the neural network model to train its classifier, and the feature vector of the case in each sample data is obtained based on the neural network model parameter mapping principle; The information retrieval unit reads the data to be tested and receives the collected data transmitted by the acquisition unit, and reads the neural network model transmitted by the training unit at the same time, inputs the collected data and the data to be tested into the trained neural network model, and obtains the corresponding feature embedding vector from the hidden layer of the neural network model; the information retrieval unit also filters the case information in the category aliasing area in the embedding space, and obtains the distribution area of the case data set in the embedding space before and after filtering, wherein the distribution area includes the cerebral hemorrhage projection cluster area, the cerebral infarction projection cluster area and the normal person projection cluster area. Since the projection points of the same disease are close to each other, they are clustered into three category projection clusters, and the training samples in the aliasing area between the two categories of cerebral hemorrhage and cerebral infarction are filtered out. A confidence acquisition unit receives the collected feature embedding vector information transmitted by the information retrieval unit to obtain projection clusters of each category. The confidence acquisition unit calculates the density adaptive factor of each projection cluster and the local distance between the feature vector to be tested and the projection cluster of each category, obtains the average nearest neighbor distance of each training point cluster, obtains the density adaptive factor of cerebral infarction, cerebral hemorrhage, and normal human categories, uses the density adaptive factor to correct the local distance and normalizes it to a preset interval to obtain the distribution consistency score of the feature vector to be tested and each category, and then obtains the model prediction confidence of the calibrated neural network based on the distribution consistency score and the original prediction probability of the neural network model.
7. A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein: When the computer program is running, the neural network model prediction confidence calibration method described in any one of claims 1 to 5 is executed.
