PAC Prediction Sets for Meta-Learning
Abstract
Uncertainty quantification is a key component of machine learning models targeted at safety-critical systems such as in healthcare or autonomous vehicles.
We study this problem in the context of meta learning, where the goal is to quickly adapt a predictor to new tasks.
In particular, we propose a novel algorithm to construct PAC prediction sets , which capture uncertainty via sets of labels, that can be adapted to new tasks with only a few training examples.
These prediction sets satisfy an extension of the typical PAC guarantee to the meta learning setting; in particular, the PAC guarantee holds with high probability over future tasks.
We demonstrate the efficacy of our approach on four datasets across three application domains: mini-ImageNet and CIFAR10-C in the visual domain, FewRel in the language domain, and the CDC Heart Dataset in the medical domain.
In particular, our prediction sets satisfy the PAC guarantee while having smaller size compared to other baselines that also satisfy this guarantee.
Introduction
Uncertainty quantification is a key component for safety-critical systems such as healthcare and robotics, since it enables agents to account for risk when making decisions.
Prediction sets are a promising approach, since they provide theoretical guarantees when the training and test data are i.i.d.
[1, 2, 3, 4]; there have been extensions to handle covariate shift [5, 6, 7] and online learning [8].
We consider the meta learning setting, where the goal is to adapt an existing predictor to new tasks using just a few training examples [9, 10, 11, 12, 13].
Most approaches follow two steps: meta learning ( i.e., learn a predictor for fast adaptation) and adaptation ( i.e., adapt this predictor to the new task).
While there has been work on prediction sets in this setting [14], a key shortcoming is that their guarantees do not address some important needs in meta learning; in particular, they do not hold with high probability over future tasks.
For instance, in autonomous driving, the future tasks might be new regions, and correctness guarantees ought to hold for each region; in healthcare, future tasks might be new patient cohort, and correctness guarantees ought to hold for each cohort.
We propose an algorithm for constructing probably approximately correct (PAC) prediction sets for the meta learning setting.
As an example, consider learning an image classifier for self-driving cars as our use case (Figure 1).
Labeled images for image classifier learning are collected, with different regions representing different but related tasks ( e.g., New York, Pennsylvania, and California).
The car person adaptation set Acar person calibration set task dataset p θf A
F A 1 τcar person adaptation set Acar person calibration set task dataset p θf A
F A 2 ττ meta learning and calibration car person adaptation set A task dataset p θ f A adaptation car person car person evaluation set task dataset p θ
P (cid:8) Y / ∈
F
Aτ ( X ) (cid:9) ≤ ε inference use goal is to deploy this learned image classifier to a new target region ( e.g., Alaska) in a cost-efficient way, e.g., minimizing label gathering cost on labeled images from Alaska for the classifier adaptation. Due to the safety-critical nature of the task, it is desirable to quantify uncertainty in a way that provides rigorous guarantees, where the guarantees are adapted to a new task ( e.g., Alaska images)— i.e., they hold with high probability specifically for future observations from this new task. In contrast, existing approaches only provide guarantees on average across future tasks [14].
Our proposed PAC prediction set starts with a meta-learned and potentially adaptable score function as our base predictor (using a standard meta learning or few shot classification approach).
Then, we learn the parameter of a prediction set for meta “calibration” by using calibration task distributions ( e.g., labeled images from Texas and Massachusetts).
Given a test task distribution ( e.g., labeled images from Alaska), we only have a few labeled examples for adapting the score function to this target task without further updating the prediction set parameter, which potentially saves additional labeled examples.
We prove that the proposed algorithm satisfies the PAC guarantee tailored to the meta learning setup.
Additionally, we demonstrate the validity of the proposed algorithm over four datasets across three application domains: mini-ImageNet [10] and CIFAR10-C [15] in the visual domain, FewRel [16] in the language domain, and CDC Heart Dataset [17] in the medical domain.
Related Work
Meta learning for few-shot learning.
Meta-learning follows the paradigm of learning-to-learn [9], usually formulated as few-shot learning: learning or adapting a model to a new task or distribution by leveraging a few examples from the distribution.
Existing approaches propose neural network predictors or adaptation algorithms [10, 11, 12, 13] for few-shot learning.
However, there is no guarantee that these approaches can quantify uncertainty properly, and thus they do not provide guarantees for probabilistic decision-making.
Conformal prediction.
The classical goal in conformal prediction (and inductive conformal prediction) [18, 2, 19] is to find a prediction set that contains the label with a given probability, with respect to randomness in both calibration examples and a test example, where a score function (or non-conformity score) is given for the inductive conformal prediction.
This property is known as marginal coverage.
If the labeled examples are independent and identically distributed (or more precisely exchangeable), prediction sets constructed via inductive conformal prediction have marginal coverage [19, 2].
However, the identical distribution assumption can fail if the covariates of a test datapoint are differently distributed from the training covariates, i.e., covariate shift occurs.
Assuming that the likelihood ratio is known, the weighted split conformal prediction set [5] satisfies marginal coverage under covariate shift.
So far, we have considered only two distributions, a calibration distribution and test distribution.
In meta learning, a few examples from multiple distributions are given, providing a different setup.
Assuming exchangeability of these distributions, conformal prediction sets for meta learning have been constructed, covering over a random sample from a new randomly drawn distribution, exchangeable with the training distributions [14]. In statistics, two-layer hierarchical models consider examples drawn from multiple distributions, while assuming examples and distributions are independent and identically distributed; these are identical to the model of meta-learning we study. Several approaches to construct prediction sets ( e.g., double conformal prediction) satisfy the marginal coverage guarantee [20].
PAC prediction sets.
Marginal coverage is unconditional over calibration data, and does not hold conditionally over calibration data ( i.e., with specified probability for a fixed calibration set).
Training conditional conformal prediction was introduced as a way to construct prediction sets with PAC guarantees [21]; Specifically, for independent and identically distributed calibration examples, they construct a prediction set that contains a true label with high probability with respect to calibration examples; thus, these prediction sets cover the labels for most future test examples.
This approach applies classical techniques for constructing tolerance regions [1, 22] to the non-conformity score to obtain these guarantees.
Recent work casts this technique in the language of learning theory [3], informing our extension to the meta-learning setting; thus, we adopt this formalism in our exposition.
PAC prediction sets can be constructed in other learning settings— e.g., under covariate shift (assuming the distributions are sufficiently smooth [6] or well estimated [7]).
In the meta learning setting, the meta conformal prediction set approach also has a PAC property [14], but does not control error over the randomness in the adaptation test examples.
In contrast, we propose a prediction set satisfying a meta-PAC property— i.e., separately conditional with respect to the calibration data and the test adaptation examples; see Section 4.1 for details.
Background 3.1 PAC Prediction Sets
We describe a training-conditional inductive conformal prediction strategy for constructing probably approximately correct (PAC) prediction sets [21], using the reformulation as a learning theory problem in [3].
Let X be a set of examples or features and Y be a set of labels.
We consider a given score function f : X × Y → R ≥ 0 , which is higher if y ∈ Y is the true label for x ∈ X .
We consider a parametrized prediction set; letting τ ∈ R ≥ 0 , we define a prediction set F τ : X → 2 Y as follows:
[Equation]
Consider a family of distributions ( p θ ) θ ∈ Θ over Z :=
X × Y , parametrized by θ ∈ Θ .
For an unknown θ , we observe independent and identically distributed (i.i.d.)
calibration datapoints S ∼ p nθ .
We define a prediction set, or equivalently the corresponding parameter τ , to be ε -correct, as follows:
Definition 1.
A parameter τ ∈ R ≥ 0 is ε -correct for p θ if
[Equation]
where the probability is taken over ( X, Y )
∼ p θ .
Letting T ε ( θ ) be the set of τ satisfying (1) for p θ , we can write τ ∈ T ε ( θ ) ⊆ R {+≥ 
+}
if τ is ε -correct for p θ . If an estimator of τ is ε -correct on most random calibration sets S ∼ p nθ , we say it is PAC.
Definition 2.
An estimator ˆ γ ε,δ : Z n → R ≥ 0 is ( ε, δ ) -probably approximately correct (PAC) for p θ if
P { ˆ γ ε,δ ( S ) ∈ T ε ( θ ) } ≥ 1 − δ, where the probability is taken over S .
Along with the PAC guarantee, the prediction set should be small in size.
Here, by increasing the scalar parameterization, we see that the expected prediction set size is decreasing with an increasing prediction set error ( i.e., P X,Y { Y / ∈ F τ ( X ) } ).
Thus, a practical ( ε, δ ) -PAC algorithm that implements the estimator ˆ γ ε,δ maximizes τ while satisfying a PAC constraint to minimize the expected prediction set size [3].
3.2 Meta Learning
Meta learning aims to learn a score function that can be conveniently adapted to a new distribution, also called a task .
Consider a task distribution p π over Θ , and M training task distributions p θ 1 , . .
, p θ M , where θ 1 , . .
, θ M is an i.i.d.
sample from p π .
Here, we mainly consider meta learning with adaptation ( e.g., few-shot learning) to learn the score function, while having learning without adaptation ( e.g., zero-shot learning) as a special case of our main setup.
For meta learning without adaptation, labeled examples are drawn from each training task distribution to learn the score function f ∅ : X × Y → R ≥ 0 , and the same score function is used for inference ( i.e., at test time).
For meta learning with adaptation, t adaptation examples are also drawn from each training task distribution to learn the score function f : Z t × X × Y →
R ≥ 0 , and the same number of adaptation examples are drawn from a new test task distribution for adaptation.
Given an adaptation set A ∈ Z t , the adapted score function is denoted by f A : X × Y → R ≥ 0 , where f A ( x, y ) :
= f
( A, x, y ) .
We consider Y large enough to include all label classes, some of which possibly seen during testing but not during training.
This formulation includes learning setups ( e.g., few-shot learning) where unseen label classes are observed during inference, by considering different distributions over labeled examples during training and inference.
Meta PAC Prediction Sets
We propose a PAC prediction set for meta learning.
In particular, we consider a meta-learned score function, which is typically trained to be a good predictor after adaptation to the test distribution.
Our prediction set has a correctness guarantee for future test distributions.
There are three sources of randomness: (1) an adaptation set and a calibration set for each calibration task, (2) an adaptation set for a new task, and (3) an evaluation set for the same new task.
We control the three sources of randomness and error by δ , α , and ε , respectively, aiming to construct a prediction set that contains labels from a new task.
Given a meta-learned model, the proposed algorithm consists of two steps: constructing a prediction set—captured by a specific parameter to be specified below—for each calibration task (related to ε and α ), and then constructing a prediction interval over parameters (related to α and δ ).
Suppose we have prediction sets for each task, parametrized by some threshold parameters.
Suppose that, for each task, the parameters only depend on an adaptation set for the respective task.
As tasks are i.i.d., the parameters also turn out to be i.i.d..
The distribution of parameters represents a possible range of the parameter for a new task.
In particular, if for each task, the prediction set contains the true label a fraction 1 − ε of the time, the distribution of the parameters suggests how one may achieve ε -correct prediction sets for a new task.
Based on this observation, we construct a prediction interval that contains a fraction 1 − α of ε -correct prediction set parameters.
However, the parameters of prediction sets need to be estimated from calibration tasks, and the estimated parameters depend on the randomness of calibration tasks.
Thus, we construct a prediction interval over parameters which accounts for this randomness.
The interval is chosen to be correct ( i.e., to contains ε -correct prediction set parameters for a fraction 1 − α of new tasks) with probability at least 1 − δ over the randomness of calibration tasks. θ X S Y 1 ( Y / ∈ F ′ ( X ; S ))
(a) Marginal guarantee [2] θ
X S
Y τ 1 ( Y / ∈ F τ ( X )) (b) PAC guarantee [1, 21, 3]θ X A Y 1 ( Y / ∈ F ′
( A,X ; A , S )
S i
A i
θ
i π
N (c) Meta task-marginal guarantee [14] θ
X A
Y 1 ( Y / ∈ F τ ( A,X ))
S i
A i θ
i
τ π N (d) Meta PAC guarantee (ours) 4.1 Setup and Problem We describe the problem on PAC prediction set construction for meta learning with adaptation; see
Appendix A for a simpler problem setup without adaptation, a special case of our main problem.
Setup.
In the setting of Section 3.2, the training samples from some training distributions p θ ′ i , i = 1 , . . .
, M are used to learn a score function via an arbitrary meta learning method, including metric-based meta-learning [11] and optimization-based meta-learning [12].
We denote the given meta-learned score function by f .
Additionally, we have N calibration distributions p θ 1 , . .
, p θ N , where θ 1 , . .
, θ N is an i.i.d.
sample from p π , i.e., θ :=
( θ 1 , . . .
, θ N ) ∼ p Nπ .
From each calibration distribution p θ i , we draw n i.i.d.
labeled examples for a calibration set, i.e., S :=
( S 1 , . . .
, S N ) ∼ p nθ 1 · · · p nθ N and S ∈ S :
= Z n × N .
Additionally, we draw t i.i.d.
labeled examples for an adaptation set, i.e., A :=
( A 1 , . . . , A N ) ∼ p tθ 1 · · · p tθ N and A ∈ A :
=
[-X A Y ( Y / 2 F 
 ( A,X-]Z t × N ; we use them to construct the meta
PAC prediction set.
Finally, we consider a test distribution p θ , where θ ∼ p π .
From it, we draw i.i.d. labeled adaptation examples A , i.e., A ∼ p tπ , and i.i.d.
evaluation examples.
Problem.
Our goal is to find a prediction set F τ : Z t × X
→ 2 Y parametrized by τ ∈ R ≥which satisfies a meta-learning variant of the PAC definition.
In particular, consider an estimator ˆ τ : S ×
A → R ≥ 0 that estimates τ for a prediction set, given an augmented calibration set ( S , A ) .
Let T ε ( θ, A ) be a set of all ε -correct parameters τ with respect to f adapted using a test adaptation set A .
We also consider F Aτ ( x, y ) :
= F τ ( A, x, y ) .
We say that a prediction set F τ parametrized by τ is ε -correct for p θ for a fixed adaptation set A , if τ ∈ T ε ( θ, A ) .
Moreover, we want the prediction set F τ where τ is estimated via ˆ τ to be correct on most test sets A for adaptation and for most test tasks θ , i.e., given S ∈ S and A ∈ A ,
[Equation]
where the probability is taken over θ and A .
Intuitively, we want a prediction set, adapted via A , to be correct on future labeled examples from p θ .
Finally, we want the above to hold for most augmented calibration sets ( S , A ) from most calibration tasks θ 1 , . . .
, θ N , leading to the following definition.
Definition 3.
An estimator ˆ τ : S ×
A → R ≥ 0 is ( ε, α, δ ) -meta probably approximately correct (mPAC) for p π if
[Equation]
where the outer probability is taken over θ , S and A , and the inner probability is taken over θ and A .
Notably, Definition 3 is tightly related to the PAC definition of meta conformal prediction [14].
We illustrate the difference in Figure 2; the figure represents the different guarantees of prediction sets via graphical models.
Each stripe pattern indicates the random variables that are conditioned on in the respective guarantee.
Figure 2d represents the proposed guarantee, having Figure 2b and 7b as special cases.
Figure 2c shows the guarantee of meta conformal prediction proposed in [14], also having Figure 2a and 7a as special cases.
Figure 2d shows that the proposed correctness guarantee is conditioned over calibration tasks , an adaptation set A from a test task , and test data ( x, y ) .
This implies that the correctness guarantee of an adapted prediction set (thus conditioned on the adaptation set) holds on most future test datasets from the same test task.
In contrast, the guarantee in Figure 2c is conditioned on the entire test task.
Thus, the correctness guarantee does not hold conditionally over adaptation sets; this means that the adapted prediction set (thus conditioned on an adaptation set) does not need to be correct over most future datasets in the same task.
4.2 Algorithm
Next, we propose our meta PAC prediction set algorithm for an estimator ˆ τ that satisfies Definitionwhile aiming to minimize the prediction set size, by leveraging the scalar parameterization of a prediction set.
The algorithm consists of two steps: find a prediction set parameter over labeled examples S i and A i from the i -th calibration task distribution, and find a prediction set over the parameter of prediction sets in the previous step.
At inference, the constructed prediction set is adapted to a test task distribution via an adaptation set A .
Importantly, in finding prediction sets ( i.e., implementating an ( ε, δ ) -PAC estimator ˆ γ ε,δ ), we can use any PAC prediction set algorithms ( e.g., Algorithm 2 in Appendix B).
Meta calibration.
For the first step, for each i ∈ { 1 , . . . , N } , we estimate a prediction set parameter ˆ γ ε,α/ 2 ( S i ) , satisfying a ( ε , α/ 2 )-PAC property using a calibration set S i and a score function f adapted via an adaptation set A i , leading to f A i , by using any meta learning and adaptation algorithm.
We consider the N learned prediction set parameters—with a dummy label 1 to fit the convention of the PAC prediction set algorithm—to form a new labeled sample, i.e., S ′ : = ((ˆ γ ε,α/ 2 ( S 1 ) , 1) , . . .
, (ˆ γ ε,α/ 2 ( S N ) , 1)) .
In the second part, we construct an ( α/ 2 , δ )-PAC prediction set for the threshold τ using S ′ and a score function g defined as g ( τ, y ) :
= τ 1 ( y = 1) , where 1 ( · ) is the indicator function 2 .
Thus, the constructed prediction set can be equivalently viewed as an interval [ˆ γ α/ 2 ,δ ( S ′ ) , ∞ ) where the thresholds τ of most calibration distributions are included; see Section 4.3 for a formal statement along with intuition on our design choice, and see Algorithm 1 for an implementation.
Adaptation and inference.
We then use labeled examples A from a test distribution to adapt the meta-learned score function f as in the meta calibration part.
Then, we use the same parameter ˆ τ ( S , A ) of the meta prediction set along with the adapted score function as our final meta prediction set F ˆ τ ( S , A ) for inference in the future.
Reusing the same meta prediction set parameter after adaptation is valid, as the meta prediction set parameter is also chosen after adaptation via a hold-out adaptation set from the same distribution as each respective calibration set.
Moreover, by reusing the same parameter, we only need a few labeled examples from the test distribution for an adaptation set, without requiring additional labeled examples for calibration on the test distribution.
Finally, we rely on a PAC prediction set algorithm that aims to minimize the expected prediction set size [21, 3]; Algorithm 1 relies on this property, thus making the meta prediction set size small.
4.3 Theory
The proposed Algorithm 1 outputs a threshold for a prediction set that satisfies the mPAC guarantee, as stated in the following result (see Appendix C for a proof):
Theorem 1.
The estimator ˆ τ implemented in Algorithm 1 is ( ε, α, δ ) -mPAC for p π .
Intuitively, the algorithm implicitly constructs an interval [ˆ γ α/ 2 ,δ ( S ′ ) , ∞ ) over scalar parameters of prediction sets.
In particular, for the i -th distribution, the Algorithm in Line 3 finds a scalar parameter of a prediction set for the i -th distribution, which forms an empirical distribution over the scalar parameters.
Due to the i.i.d.
nature of θ i , i = 1 , . .
, N , the parameter of a prediction set for a test distribution follows the same distribution over scalar parameters.
Thus, choosing a conservative scalar parameter as in Line 5 of the Algorithm suffices to satisfy the mPAC guarantee.
Experiments
We demonstrate the efficacy of the proposed meta PAC prediction set based on four few-shot learning datasets across three application domains: mini-ImageNet [10] and CIFAR10-C [15] for the visual domain, FewRel [16] for the language domain, and CDC Heart Dataset [17] for the medical domain.
See Appendix E for additional experiments, including the results for CIFAR10-C.
5.1 Experimental Setup
Few-shot learning setup.
We consider k -shot c -way learning except for the CDC Heart Dataset; In particular, there are c classes for each task dataset, and k adaptation examples for each class.
Thus, we have t :=
kc labeled examples to adapt a model to a new task.
As the CDC Heart dataset is a label unbalanced dataset, we do not assume equal shots per class.
Score functions.
We use a prototypical network [11] as a score function.
It uses t adaptation examples to adapt the network to a given task dataset, and predicts labels on query examples.
Baselines.
We compare four approaches, including our proposed approach.
• PS : We consider a naive application of PAC prediction sets [3].
We pool all nN labeled examples from calibration datasets into one calibration set to run the PAC prediction set algorithm.
• PS-Test : We construct PAC prediction sets by using 20 shots for each class directly drawn from the test distribution.
• Meta-CP : We use the PAC variant of meta conformal prediction [14], which trains a quantile predictor along with a score function, while our approach only needs a score function.
We run the authors’ code with the same evaluation parameters for comparison.
• Meta-PS : This is the proposed meta PAC prediction set from Algorithm 1.
Metric.
We evaluate prediction sets mainly via their empirical prediction set error over a test sample, i.e., having learned a parameter τ , we find 1 / | E | (cid:80) (
x,y ) ∈ E 1 ( y / ∈ F A τ ( x )) , where A is an adaptation set, and E is an evaluation set drawn from each test task distribution.
We desire this to be at most ε given fixed calibration and test datasets.
This should hold with probability at least 1 − δ over the randomness due to the calibration and adaptation data; and with probability at least 1 − α over the randomness due to the test adaptation set.
To evaluate this, we conduct 100 random trials, drawing independent calibration datasets, and for each fixed calibration dataset, we conduct 50 random trials [Figure] drawing independent test datasets.
The prediction set size evaluation is done similarly to the error; we compute the empirical prediction set size 1 / | E | (cid:80)
( x,y ) ∈ E S ( F Aτ ( x )) , where S is a size measure, e.g., set cardinality for classification.
5.2 Mini-ImageNet
Mini-ImageNet [10] is a smaller version of the ImageNet dataset for few-shot learning.
Setup.
Mini-ImageNet consists of 100 classes with 64 classes for training, 16 classes for calibration, and 20 classes for testing; each class has 600 images.
Following a standard setup, we consider five randomly chosen classes as one task and 5 -way classification.
In training, we follows 5 -shot 5 -way learning, considering M = 800 training task distribution randomly drawn from the (cid:0) 645 (cid:1) possible tasks.
In calibration, we have N = 500 calibration task datasets randomly drawn from the (cid:0) 16 5 (cid:1) possible tasks, and use 5 shots for adaptation and 500 shots for calibration ( i.e., t = 25 and n = 2500 ).
In evaluation, we have 50 test task datasets randomly drawn from the (cid:0) 205 (cid:1) possible tasks and useshots from each of 5 classes for adaptation and 100 shots from each 5 classes for evaluation.
Results.
Figure 3 shows the prediction set error and size of the various approaches in box plots.
Whiskers in each box plot for the error cover the range between the 10 -th and 90 -th percentiles of the empirical error distribution, while whiskers in each box plot for the size represents the minimum and maximum of the empirical size distribution.
The randomness of error and size is due to the randomness of the augmented calibration ( S , A ) and a test adaptation set A ; but since δ = 10 − 5 , the randomness is mostly due to the adaptation set.
The prediction set error of the proposed approach is below the desired level ε = 0 .
1 at least a fraction 1 − α = 0 .
9 of the time.
This supports that the proposed prediction set satisfies the meta PAC criterion.
However, PS and Meta-CP do not empirically satisfy the meta PAC criterion, and PS-Test is too conservative.
In particular, Meta-CP does not empirically control the randomness due to the test distribution.
To make this point precise, Figure 3c shows a prediction set error distribution over different test distributions given a fixed calibration dataset.
As can be seen, the proposed Meta-PS approach empirically satisfies the ε error criterion at least a fraction 1 − α = 0 . 9 of the time (as [Figure] [Figure]
[Figure]
[Figure]
[Figure] p r e d i c t i o n s e t s i [Figure] shown in the whiskers), but Meta-CP does not empirically control it.
Figure 3b demonstrates that the proposed Meta-PS produces smaller prediction sets compared to the PS-Test approach that also satisfies the ε error constraint.
5.3 FewRel
FewRel [16] is an entity relation dataset, where each example is the tuple of the first and second entities in a sentence along with their relation as a label.
Setup.
FewRel consists of 100 classes, where 64 classes are used for training and 16 classes are originally used validation; each class has 700 examples.
The detailed setup for training, calibration, and test are the same as those of mini-ImageNet, except that the test task distributions are randomly drawn from the original validation split.
Results.
Figure 4 presents the prediction set error and size of the approaches.
The trend of the results is similar to the mini-ImageNet result.
Ours empirically satisfies the desired prediction set error specified by ε with empirical probabilities of at least 1 − α over the test adaptation set and 1 − δ over the (augmented) calibration data.
In contrast, the other approaches either do not empirically satisfy the meta PAC criterion or are highly conservative.
Figure 6a also confirms that the proposed approach empirically controls the error with probability at least 1 − α over the randomness in the test dataset.
5.4 CDC Heart Dataset
The CDC Behavioral Risk Factor Surveillance System [17] consists of health-related telephone surveys started in 1984.
The survey data is collected from US residents.
We use the data collected from 2011 to 2020 and consider predicting the risk of heart attack given other features ( e.g., level of exercise or weight).
We call this curated dataset the CDC Heart Dataset.
See Appendix D.4 for the details of the experiment setup.
Setup.
The 10 years of the CDC Heart Dataset consists of 530 task distributions from various US states.
We consider data from 2011-2014 as the training task distributions, consisting of 212 different tasks and 1,805,073 labeled examples, and data from 2015-2019 as calibration task distributions, consisting of 265 different tasks and 2,045,981 labeled examples.
We use the data from 2020 as a test task distribution, consisting of 53 different tasks and 367,511 labeled examples.
We use M = 200 ,
N = 250 , n = 3000 , and t = 10 ; see Appendix D.4 for the details.
Results.
Figure 5 includes the prediction set error and size of each approach.
The trend is as before.
The proposed Meta-PS empirically satisfies the ε = 0 .
1 constraint ( i.e., the top of the whisker is below of the ε = 0 . 1 line), while PS and Meta-CP violate this constraint.
Meanwhile, PS-Test conservatively satisfies it.
As before, Figure 6b empirically justifies that the proposed approach controls the prediction set error due to the randomness over the test adaptation data.
Conclusion
We propose a PAC prediction set algorithm for meta learning, which satisfies a PAC property tailored to a meta learning setup.
The efficacy of the proposed algorithm is demonstrated in four datasets across three application domains. Specifically, we observe that the proposed algorithm finds a
[Figure] [Figure] prediction set that satisfies a specified PAC guarantee, while producing a small set size.
A limitation of the current approach is that it requires enough calibration datapoints to satisfy the PAC guarantee, see [3] for an analysis.
A potential societal impact is that a user of the proposed algorithm might misuse the guarantee without a proper understanding of assumptions; see Appendix F for details.
Acknowledgements
This work was supported in part by DARPA/AFRL FA8750-18-C-0090, ARO W911NF-20-1-0080, NSF TRIPODS 1934960, NSF DMS 2046874 (CAREER), NSF-Simons 2031895 (MoDL). Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the Air Force Research Laboratory (AFRL), the
Army Research Office (ARO), the Defense Advanced Research Projects Agency (DARPA), or the Department of Defense, or the United States Government.
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] See Section 6.
(c) Did you discuss any potential negative societal impacts of your work?
[Yes] See Section(d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] See Section 4.1.
(b) Did you include complete proofs of all theoretical results?
[Yes] See Section C. 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[No] Code will be released once accepted along with data and precise instructions to run it.
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Section 5 and D. (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] We use box plots to represent the randomness on error.
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] See Section D.1.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] (b) Did you mention the license of the assets?
[Yes] See Section D.2.
(c) Did you include any new assets either in the supplemental material or as a URL?
[No] (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating?
[Yes] See Section D.2.
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[Yes] See Section D.2.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]
[Figure] We introduce our problem setup without adaptation, which is a special case of our main problem with adaptation, and thus may be simpler to understand. Setup. In the setting of Section 3.2, the training samples from some training distributions p θ ′ i , i = 1 , . . .
, M are used to learn a score function via an arbitrary meta learning method. We denote the given meta-learned score function by f . Additionally, we have N calibration distributions p θ 1 , . . , p θ N , where θ 1 , . .
, θ N is an i.i.d.
sample from p π , i.e., θ :=
( θ 1 , . . .
, θ N ) ∼ p Nπ .
From each calibration distribution p θ i , we draw n i.i.d.
labeled examples for a calibration set, i.e., S :=
( S 1 , . . .
, S N ) ∼ p nθ 1 · · · p nθ N and S ∈ S :
= Z n × N .
Finally, we consider a test distribution p θ , where θ ∼ p π , and draw i.i.d.
labeled examples from it for an evaluation set.
Problem.
Our goal is to find a prediction set F τ : X → 2 Y parametrized by τ ∈ R ≥ 0 which satisfies a meta-learning variant of the PAC definition.
In particular, consider an estimator ˆ τ : S → R ≥ 0 that estimates the threshold τ defining a prediction set, given a calibration set S .
Recall that a prediction set F τ parametrized by τ is ε -correct for p θ if τ ∈ T ε ( θ ) .
Moreover, we want the prediction set F τ , where τ is estimated via ˆ τ ε,α,δ , to be correct on most test tasks θ , i.e., given
S ∈ S ,
[Equation]
where the probability is taken over θ .
Intuitively, we want a prediction set to be correct on future labeled examples from p θ .
Finally, we want the above to hold for most calibration sets S from most calibration tasks θ , leading to the following definition.
Definition 4.
An estimator ˆ τ : S → R ≥ 0 is ( ε, α, δ ) -meta probably approximately correct (mPAC) for p π if
[Equation]
where the outer probability is taken over θ and S and the inner probability is taken over θ .
Figure 7b shows that the proposed correctness guarantee is conditioned over calibration tasks , a test task , and test data ( x, y ) .
This implies that the correctness guarantee of a prediction set holds on most future test data from the same test task.
In contrast, the guarantee in Figure 7a is conditioned on the entire test task.
B PAC Prediction Sets Algorithm
Algorithm 2 describes a way to find a PAC prediction set, proposed in [3, 6].
This is equivalent to inductive conformal prediction, tuned to achieve training-conditional validity [21].
Here, θ ( k ; m, δ ) is the Clopper-Pearson upper bound [23] for the parameter of a Binomial distribution, where F is the cumulative distribution function (CDF) of the binomial distribution Binom ( m, ε ) with m trials and success probability ε , i.e., θ ( k ; m, δ ) :
= inf { θ ∈ [0 , 1] | F ( k ; m, θ ) ≤ δ } ∪ { 1 } .
Algorithm 2 PAC Prediction Sets algorithm [3, 6].
procedure PS-B INOM ( S, f, ε, δ ) ˆ τ ←for τ ∈ R ≥ 0 do ( ▷ ) Grid search in ascending order if θ ( (cid:80) (
x,y ) ∈ S 1 ( y / ∈ F τ ( x )); | S | , δ ) ≤ ε then ˆ τ ← max(ˆ τ, τ ) elsebreak return ˆ τ
C Proof of Theorem
We use the two defining properties of the estimators ˆ τ and ˆ γ ε,α/ 2 ; namely that ˆ τ is ( α/ 2 , δ ) -PAC and ˆ γ ε,α/ 2 is ( ε, α/ 2) -PAC.
First, consider that the calibration set and adaptation set pair ( S i , A i ) for i = 1 , . . .
, N can be viewed as an independent and identically distributed sample from the distributions p n × t θ i where θ i ∼ p π .
Then, ˆ γ ε,α/ 2 (( S i , A i )) , where A i is used for adapting a score function, follows the distribution induced by ( S i , A i ) ∼ p n × t θ i .
Since [ˆ τ ( S , A ) , ∞ ) is ( α/ 2 , δ ) -PAC, we have
P θ , S , A (cid:110) P θ,S,A (cid:8) ˆ γ ε,α/ 2 (( S, A ))
≥
ˆ τ ( S , A ) (cid:9) ≥ 1 − α 2 (cid:111) ≥
1 − δ.
Moreover, due to the ( ε, α/ 2) -PAC property of ˆ γ ε,α/ 2 , we have
[Equation]
It follows that
[Equation]
By a union bound, the events related to ( θ, S, A ) in (2) and (3) hold with probability at least 1 − α .
Thus, we have
[Equation]
Since the inner expression does not depend of S , it follows that
[Equation]
Finally, from the definition of ε -correctness in (1) it follows directly that for any θ ∈ Θ and any ε ∈ [0 , 1] , if τ ∈ T ε ( θ, A ) and 0 ≤ τ ′ ≤ τ , then τ ′ ∈ T ε ( θ, A ) .
Thus, it follows that
[Equation]
as claimed.
D Experiment Details D.1 Computing Environment
The experiments are done using an NVIDIA RTX A6000 GPU and an AMD EPYC 7402 24-Core
CPU.
D.2 Dataset License, Consent, and Privacy Issues
mini-ImageNet [10] is licensed under the the MIT License 3 , CIFAR10-C [15] is licensed under the the Apache 2.0 License 4 , and FewRel [16] is licensed under the MIT License 5 .
The CDC Heart
Dataset [17] is produced by the Centers for Disease Control and Prevention, a US federal agency, and belongs to the public domain.
mini-ImageNet, CIFAR10-C, and FewRel use public data ( e.g., images from Web or corpuses from
Wikipedia), so generally consent is not required.
The CDC Heart Dataset is based on a survey, which is collected in-person from consenting individuals.
mini-ImageNet, CIFAR10-C, and FewRel rarely contain personally identifiable information or offensive content, as verified over several years.
For the CDC Heart Dataset, personally identifiable information is excluded from the publically available data.
D.3 Prototypical Network Training
We train a prototypical network using an Adam optimizer with a dataset-specific initial learning rate, decaying it by a factor of two for every 40 training epochs.
We use an initial learning rate of 0.
for mini-ImageNet, 0.01 for CIFAR10-C, 0.01 for FewRel, and 0.001 for the CDC Heart Dataset.
For the backbone of the prototypical network, we use a four-layer convolutional neural network (CNN) for mini-ImageNet as in [11, 14], a ResNet-50 for CIFAR10-C, a CNN sentence encoder for
FewRel as in [16, 14], and a two-layer fully connected network for CDC Heart Dataset, where each layer consists of 100 neurons followed by the ReLU activation layer and the Dropout layer with a dropout probability of 0.5.
D.4 Details of CDC Heart Dataset Experiment
Data Post-processing.
We curate the original data released by the CDC [17]; in particular, the original data has a variable number of features per year (varying from 275 to 454), where each feature corresponds to a survey item.
Among these features, we use the answer of “Ever Diagnosed with
Heart Attack” as our label, which corresponds to the feature with SAS variable CVDINFR4 .
We use features reported in each year.
Then, we remove certain non-informative features (date, year, month, day, and sequence number) and features with more than 5% of values missing.
Furthermore, each datapoint that contains any missing value or has a missing label is also removed, resulting in our final dataset used in our experiments.
Prototypical Network Modification.
The CDC Heart Dataset is a highly unbalanced dataset, as the ratio of the positive labels is about 6% .
This does not fit with the conventional label-balance assumption of few-shot learning [11].
To handle the unbalanced labels, we modify prototypical networks to generate prototypes only for the labels observed in the adaptation set, while producing zero prediction probabilities for unobserved labels.
E Additional Experiments E.1 Corrupted CIFAR10 (CIFAR10-C)
CIFAR10-C is a CIFAR10 dataset with synthetic corruptions.
In particular, the corruptions consist of 15 synthetic image perturbations ( e.g., Gaussian noise) with 6 different severity levels, ranging from 0 to 5.
Setup.
To use CIFAR10-C as a few-shot learning dataset, we let a set of corruptions define one task dataset.
In particular, we choose all stochastic corruptions from 15 perturbations ( i.e., Gaussian noise, shot noise, impulse noise, and elastic transform) along with three severity levels (namely, 0, 1, and 2).
Thus, we can obtain nine different corruptions.
Then, a subsequence of the nine corruptions of size at most three is randomly chosen and applied to CIFAR10 to define one task distribution.
Moreover, we use CIFAR10 labels, leading to 10 -way learning.
[Figure]
[Figure]
[Figure]
p r e d i c t i o n s e t e rr o r = 0.
(a
[Figure]
Error
PS
PS
[Figure]
Meta-PS     p r e d i c t i o n s e t s i
z
e
[Figure]
In training, we consider M = 1000 training task distributions and train a score function via 5 -shot 10 -way learning.
During calibration, we consider N = 500 calibration task distributions andcalibration shots for each class ( i.e., n = 5000 ) and 5 adaptation shots for each class ( i.e., t = 50 ).
During testing, we have 50 test task distributions and use 5 shots per class for adaptation andshots per class for evaluation.
Results.
Figure 8 demonstrates the efficacy of the proposed approach.
Meta-PS satisfies PAC constraint with ε = 0 .
2 a fraction 1 − α = 0 .
9 of the time (as shown in whiskers).
The randomness of an augmented calibration set is negligible, as we set δ = 10 − 5 .
Other approaches either violate the ε constraint or are more conservative than the proposed approach.
In particular, PS-Test is slightly worse than the proposed approach.
Considering that it requires 200 additional labeled examples along with 50 adaptation examples from a test distribution for calibration, PS-Test is more expansive than
Meta-PS , which only needs 50 adaptation examples during testing.
E.2 Prediction Set Error Per Calibration Set for Varying δ
19 calibration distribution index
[Figure]
r =
[Figure]
= 0.
= 0.
Here δ = 0 .
1 means at most 10% of the calibration sets can produce prediction sets that violate the ε -constraint with probability at most α = 0 .
This means the green whisker can be over the line showing ε = 0 .
1 , as for the calibration distribution with index 9.
Based on this interpretation, the orange whisker is sufficiently below of the ε = 0 .
1 line, as δ = 10 − 5 .
F Discussion
On the i.i.d.
assumption over tasks.
We believe that the i.i.d.
assumption is useful and even reasonable in many settings.
For instance, the most common meta-learning setting is where users want to add new labels to an existing system, and we believe the arrival of new labels can reasonably be modeled as an i.i.d.
process.
This means that labels are thought of as belonging to the collection of "all possible labels", and are revealed without any systematic pattern or connection among themselves.
Of course, this assumption does not need to be exactly satisfied, but the same is true of i.i.d.
assumptions on the data that are common to prove any guarantees in learning theory.
Alleviating this assumption is an important direction for future work.
On the necessity of assumptions.
The proposed algorithm under assumptions ( e.g., the i.i.d.
assumption on tasks) may not be a cure-all for meta-learning calibration.
However, we believe that having a rigorous guarantee—under appropriate assumptions—significantly increases its importance.