{'fraction_non_alphanumeric': 0.02899601304820587, 'fraction_numerical': 0.013652289476863599, 'mean_word_length': 5.355086372360844, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Distribution-Free Federated Learning with Conformal Predictions

Federated learning has attracted considerable interest for collaborative machine learning in healthcare to leverage separate institutional datasets while maintaining patient privacy. However, additional challenges such as poor calibration and lack of interpretability may also hamper widespread deployment of federated models into clinical practice, leading to user distrust or misuse of ML tools in high-stakes clinical decision-making. In this paper, we propose to address these challenges by incorporating an adaptive conformal framework into federated learning to ensure distribution-free prediction sets that provide coverage guarantees. Importantly, these uncertainty estimates can be obtained without requiring any additional modifications to the model. Empirical results on the MedMNIST medical imaging benchmark demonstrate our federated method provides tighter coverage over local conformal predictions on 6 different medical imaging datasets for 2D and 3D multi-class classification tasks. Furthermore, we correlate class entropy with prediction set size to assess task uncertainty.


Introduction
Current machine learning techniques typically increase in predictive task performance when trained with more data. Because of their good predictive ability, convolutional neural networks (CNN) are often favored for many tasks in computer vision and medical imaging analysis. However, medical imaging datasets often have large dimensionality with a relatively limited number of labeled examples that make training CNNs more difficult (Singh et al. 2020;Lundervold and Lundervold 2019). For low prevalence diseases, too few annotated cases may be available from a single healthcare institution to train a high performance model. However, directly sharing private medical data with external institutions poses severe privacy and security risks. For this reason, federated learning (FL) has become an attractive paradigm to collaboratively develop CNN models while maintaining privacy of each institution's respective data (Xu and Wang 2019).
Another considerable challenge of most standard CNN models is their lack of uncertainty estimation and poor calibration (Guo et al. 2017). While powerful in predictive Copyright © 2022, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. capability, deep CNNs are not generally considered interpretable or well calibrated, which can lead to higher levels of user distrust or frustration during high-stakes decisionmaking (Bhatt et al. 2021). Having some way to guarantee statistical confidence of a prediction will be crucial in the adoption of ML tools into medical decision-making applications (Ghassemi et al. 2019).
Conformal predictions have been proposed as a general framework of providing distribution-free uncertainty in the form of prediction sets for classification and prediction intervals for regression (Vovk, Gammerman, and Shafer 2005;Vovk 2012). Additionally, prediction sets better match the intuition of clinical decision making by providing a set of possible conditions that may be used to rule in or rule out certain diseases similar to a differential diagnosis (Lu et al. 2021).
Our proposed method combines a federated training scheme with a adaptive conformal calibration during inference to combine the advantages of valid coverage with the increased performance and data privacy assurances of FL. To this end, we investigate the following three research questions (RQ): 1. How do conformal methods (adaptive prediction sets) compare to non-adaptive prediction sets for medical imaging classification tasks? 2. Do a federated quantile estimates provide tighter prediction sets than quantiles calibrated only on the local healthcare institution? 3. What is the relationship between conformal uncertainty (as measured by set size) and epistemic (model) uncertainty (as measured by class entropy)?

Related Work
Conformal inference was introduced by Vovk, Gammerman, and Shafer (2005) as a general framework to incorporate a rigorous notion of uncertainty into arbitrary machine learning models and have been adapted for prediction tasks including quantile regression, multi-label classification, and image segmentation (Romano, Patterson, and Candès 2019;Cauchois, Gupta, and Duchi 2020;Bates et al. 2021). Conformal prediction can be seen as a frequentist approach to confidence estimation that provides marginal coverage bounds without needing to specify a prior distribution.
Other approaches to confidence in CNN include Bayesian approximation and post-hoc probability calibration. Bayesian neural networks permit confidence estimates using posterior probabilities and model uncertainty but usually impose strict assumptions on the modeling distribution, such as assuming a Gaussian distributed likelihood in Monte Carlo dropout (Gal and Ghahramani 2015). Other uncertainty methods are either model specific (such as Mondrian forests (Lakshminarayanan, Roy, and Teh 2016)) or require modification of the loss function during training (Corbière et al. 2019).
The Softmax probability of CNN have been empirically shown lack proper calibration. Attempts to remedy improve these calibration issues in CNN have resulted in postprocessing techniques such as temperature scaling and isotonic calibration (Guo et al. 2017).
FL has received considerable attention for privacy sensitive applications such as healthcare (Rieke et al. 2020). Previous works attempt to incorporate Bayesian uncertainty or address non-IID distributions with post-calibration in FL context (Yurochkin et al. 2019;Luo et al. 2021).
Another work proposes distributed conformal predictions but does not consider a FL context with CNN for medical imaging applications (Spjuth, Carlsson, and Gauraha 2018).

Methods
The conformal framework can be used to produce confidence prediction sets with any machine learning model that outputs a scoring function (e.g. deep neural networks, decision trees, and quantile regression). For CNN classifiers, this amounts to predicting a set of predictions using the Softmax probability (for multi-class classification) as the conformality score function. One naive way of forming prediction sets is to simply sort the class scores for a given example and include all classes in the prediction set up to some confidence threshold. For example, for a three-class prediction task with the Softmax class scores [0.3, 0.1, 0.2, 0.4], our naive method would be output {3, 0, 2} for a confidence level of 90% and {3, 0} for a confidence level of 70%. Unfortunately, this naive approach does not provide the property of coverage -. simply, that the prediction set for any given example will contain the true class on average at some desired confidence level. To achieve a formal guarantee of coverage, we can instead reuse the validation data to calibrate our model to achieve valid conformal predictions during model inference.
Formally, let C(X) be a conformal prediction set, which is a subset of the label powerset, P, and let α ∈ (0, 1) be a pre-chosen confidence level that determines the degree of guaranteed coverage on the joint distribution, where N is the number of examples in the calibration set and M is the number of examples in the test set. Then, for some classifier that makes |Y | class predictions using a monotonic scoring function, S : X → R |Y | , a prediction set can be created: where S(X) y is the score of the yth class andq is the score quantile (estimated using the calibration set Algorithm 1: Federated conformal prediction sets Input: required to guarantee marginal coverage with a small finite sample correction, (Angelopoulos et al. 2020). If the data is drawn from an identical and exchangeable distribution (a weaker form of IID), then marginal coverage can be defined as satisfying the following property: This bound can be made near-tight through an appeal to symmetry (again assuming exchangeable random variables), which appears in several previous works (Papadopoulos et al. 2002;Vovk, Gammerman, and Shafer 2005;Lei et al. 2017;Romano, Sesia, and Candès 2020).
Because this marginal coverage property does not impose any assumptions on the distribution (besides exchangeability) or score function (besides monotonicity), conformal prediction methods can be easily adapted for FL settings. Federated averaging (FedAvg) is a simple FL procedure that averages parameter weights of all local model (client side) to update the global model (server side) -which is then distributed back to each local model -after each training epoch (McMahan et al. 2017). As described in Algorithm 1, we adapt split conformal predictions (Romano, Sesia, and Candès 2020) for FedAvg While our conformal framework does not depend on a specific FL technique, we implement FedAvg for its simplicity in order to demonstrate a proof of concept.
For more information on conformal predictions and distribution-free uncertainty, we refer the reader to the excellent tutorial by Angelopoulos and Bates (2021).

Experiments
We compare three methods of forming prediction sets: a naive baseline, conformal predictions using local quantiles, and conformal predictions using federated quantiles. The naive baseline simply form predictions sets by adding sorting classes by predicted scores and adding elements to the set until the 1 − α threshold is met. Because the naive baseline does not estimate the empirical quantile on a held-out calibrate set, we cannot expect it to satisfy the coverage guarantee described above.
For our experiments, we train a ResNet-18 (He et al. 2016) for 5 different random weight initializations to optimize a cross entropy loss on six datasets in the MedM-NIST medical imaging dataset benchmark (Yang, Shi, and Ni 2021) (BloodMNIST, DermaMNIST, PathMNIST, Tis-sueMNIST, RetinaMNIST, OrganMNIST3D). The number of classes and overall class distribution for each dataset is shown in Figure 2.
For each dataset, we split the original training, validation, and testing sets into four partitions to simulate different healthcare institutions to train our FL models. As conformal predictions are a "post-proccessing" step that do not depend on model training, the same trained models where used for all three methods of forming prediction sets. For local conformal prediction sets, we estimate the quantile using only the first institution's validation set as the calibration set. For federated conformal prediction sets, we calibrate the quantile using a simple average of quantiles from each individual institution's respective validation set. To further assess the performance of federated conformal and to tease out possible confounding of performance with larger calibration dataset sizes, we randomly shuffle 30% of labels for three out of the four institutions' validation set while keeping the first institution's validation set "clean". All three methods were evaluated only on the first institution's test set.
Images with the corresponding conformal prediction set is shown in Figure 1.   Additionally, we wish to study the relationship between the difficulty of predicting a specific case (independent to the number of classes) with its corresponding uncertainty estimate (as determined by the number of elements in the prediction set). To this end, we hold out 10% of the training set from each dataset to train an auxiliary classifier, which can then be used to correlate the maximum Softmax score with the class-wise entropy, H(X i ) = − y∈Y S(X i ) y · log S(X i ) y , for the rest of the dataset. Therefore, we expect entropy to be indicative of model uncertainty and positively correlated with the size of a conformal prediction set.

Discussion
We can evaluate and compare different methods of predictions sets by their cardinality (average number of elements in a prediction set) and coverage (probability that the true class is an element of the prediction set). Ideally, we would also like prediction sets to be "adaptive" to communicate model uncertainty at an instance level (difficult cases should have larger confidence sets while easier cases should have fewer elements in their prediction sets) while still satisfying marginal coverage guarantees. From the results of our experiments, which are summarized in Table   Figure 4: Average size of prediction sets of naive, local conformal, and federated conformal methods by different levels of confidence (1 − α). 1, we can immediately see the naive baseline prediction sets as exceptionally conservative in coverage across all six datasets. In order words, naively forming predictions sets using raw Softmax "probabilities" simply outputs all possible classes for each prediction for 100% coverage but useless for any kind of prediction task. Our results validate previous studies on overconfident Softmax scores in deep neural networks (Guo et al. 2017;Hendrycks and Gimpel 2018). While post-processing calibration techniques may produce more useful confidence sets, they do not offer the statistical guarantees provided by conformal prediction methods. Next, we compare the two conformal prediction methods: prediction sets calibrated with a federated quantile and prediction sets calibrated with a local quantile. As shown in Table 1 and 3, while all methods satisfy coverage properties (for example at a α threshold of 90%), both conformal methods have much tighter confidence sets in terms of empirical cardinality compared to the naive baseline (see Figure  4). Additionally, federated conformal predictions have lower cardinality than local conformal predictions across MedM-NIST datasets for at most α levels (see Figure 4) -even when label noise was introduced to 30% of the validation set used to estimate the federated conformal prediction quantile. Figure 5: (Left) figure shows average test coverage at α = 0.9 of local conformal and federated conformal methods across six MedMNIST classification tasks; (right) figure shows federated prediction sets having lower average cardinality than local prediction sets at p < 0.001 significance for BloodMNIST, DermaMNIST, PathMNIST, and TissueM-NIST datasets Figure 6: Correlation of local conformal set size and entropy percentile for each of the four institutions (1 clean; 3 trained with 30% random labels).
Notably, our federated method performs remarkably well on both the BloodMNIST and PathMNIST datasets, which both have mostly equal distribution of classes (see Figure  2), achieving average prediction set sizes of 2.3 ± 0.1 and 2 ± 0.1, respectively, and having a much lower rate of set size with at lower α thresholds compared to local conformal prediction sets (see 4). However, on both RetinaMNIST and OrganMNIST3d datasets, prediction sets formed using federated quantile estimate show a similar average set size as prediction sets formed with a local quantile estimate; however, both dataset also have (between 10-200 times) fewer cases than the other datasets. As shown in Figure 5, both these smaller datasets have much larger variance bands for both coverage and prediction set size. Therefore, we conclude that conformal methods outperform the naive baseline of forming prediction sets (RQ1) and that federated conformal prediction sets have smaller set sizes than local conformal prediction sets (RQ2) for datasets with a sufficient number of examples.
To answer RQ3, we plot each of the four institutions at different three different class entropy percentiles (50%, 75%, and 90%) each dataset (see Figure 6). We confirm a positive relationship between between cardinality and epis-temic model uncertainty, and also observe that conformal uncertainty to be robust to moderate levels of label corruption in the calibration set used to estimate the empirical quantile.

Conclusion
We proposed a novel approach to combine FL with conformal prediction sets and empirically evaluated our method on several benchmark medical imaging datasets (MedM-NIST) to demonstrate feasibility of conformal uncertainty in healthcare. Additionally, we find a intuitive correspondence between conformal uncertainty and prediction task difficulty as measured by predictive class entropy. Combining the benefits of federated training with conformal inference, our distribution-free method of uncertainty quantification is a simple and flexible technique that requires no direct modification to model training while retaining wide applicability for collaboratively developing FL models among healthcare institutions.