{'fraction_non_alphanumeric': 0.037661250757553895, 'fraction_numerical': 0.011861129548930767, 'mean_word_length': 4.737086092715232, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Bayesian Few-Shot Classification with One-vs-Each P\'olya-Gamma Augmented Gaussian Processes

Few-shot classification (FSC), the task of adapting a classifier to unseen classes given a small labeled dataset, is an important step on the path toward human-like machine learning. Bayesian methods are well-suited to tackling the fundamental issue of overfitting in the few-shot scenario because they allow practitioners to specify prior beliefs and update those beliefs in light of observed data. Contemporary approaches to Bayesian few-shot classification maintain a posterior distribution over model parameters, which is slow and requires storage that scales with model size. Instead, we propose a Gaussian process classifier based on a novel combination of P\'olya-gamma augmentation and the one-vs-each softmax approximation that allows us to efficiently marginalize over functions rather than model parameters. We demonstrate improved accuracy and uncertainty quantification on both standard few-shot classification benchmarks and few-shot domain transfer tasks.


Introduction
The rapidly growing field of few-shot classification (FSC) seeks to build classifiers that quickly adapt to novel classes given only a few labeled examples from those classes. Bayesian methods are a natural fit for FSC, where the seamless integration of prior knowledge is important to dealing with the problem of overfitting. Bayesian probability also provides a principled framework for modeling uncertainty, which is a significant concern as FSC is increasingly being used for user-facing applications such as personalizable human-computer interfaces [35] and medical diagnosis [22].
Current Bayesian approaches to FSC typically maintain distributions over model parameters, either explicitly through approximate variational distributions [9,23] or implicitly through multiple samples of weights [26,39]. The variational approach is limited in posterior expressiveness while the implicit approach is computationally slow and costly in terms of storage. Moreover, specifying meaningful priors in parameter space is known to be difficult due to the complex relationship between weights and functions in deep networks [29].
In this paper, we present a Bayesian approach to FSC based on Gaussian processes (GPs) [36] that enables efficient marginalization over functions rather than model parameters. GPs are a widely used Bayesian modeling approach whose application to classification is traditionally hindered by two main obstacles. The first is that GPs scale cubically with the number of data points. This is not a significant concern for FSC because data is scarce (only a few shots per class).
The second and more critical hurdle is that non-conjugacy of the GP prior with the softmax likelihood renders posterior inference intractable. Thus it is not surprising that GPs have seen little application to the few-shot scenario. The GP approaches currently employed in few-shot learning rely on the Gaussian likelihood [32,20], which is mathematically convenient but not well-suited to the discrete nature of classification.
Pólya-gamma augmentation [21] is a useful technique for achieving tractable Bayesian inference in logistic models that has recently been applied to GP classification through the logistic softmax likelihood [8], which replaces the exponential functions inside the softmax with logistic sigmoids. Although this is a valuable step in the right direction, we found this approach to be complicated and lacking in terms of uncertainty quantification for few-shot classification.
In this work we propose a novel GP-based classifier to tackle Bayesian FSC that uses the one-vs-each softmax approximation [31] as a likelihood. By leveraging Pólya-gamma augmentation, our approach maintains tractable inference with a single augmentation and outperforms recent GP-based methods that rely on Gaussian and logistic softmax likelihoods.
Our contributions are as follows: • We introduce a novel Gaussian process-based approach to FSC utilizing the one-vs-each softmax approximation [31] and Pólya-gamma augmentation for tractable inference.
• We demonstrate competitive classification accuracy relative to baseline approaches in the standard few-shot classification benchmark and domain transfer settings.
• We show overall improved uncertainty quantification of our method, including difficult scenarios such as input corruption and out-of-distribution detection.

Pólya-Gamma Augmentation
The Pólya-gamma augmentation scheme was originally introduced to address Bayesian inference in logistic models [21] and has since been applied to multinomial GPs via a stick-breaking construction [15] and to GP-based classification with the logistic softmax likelihood [8].
In Bayesian inference, we are interested in the posterior p(ψ|y) ∝ p(y|ψ)p(ψ) but the form of (1) does not admit analytic computation due to non-conjugacy. The main idea of Pólya-gamma augmentation is to introduce auxiliary random variables ω to the likelihood such that the original model is recovered when ω is marginalized out: p(y|ψ) = p(ω)p(y|ψ, ω) dω. Conditioned on ω ∼ PG(b, c), the likelihood is proportional to a diagonal Gaussian (see Section A for a full derivation): where κ i = y i − 1/2 and Ω = diag(ω). The conditional distribution over ψ given y and ω is now tractable: whereΣ = (Σ −1 + Ω) −1 . The conditional distribution of ω given ψ and y can also be easily computed: where the last expression follows from the exponential tilting property of Pólya-gamma random variables. This suggest a Gibbs sampling procedure in which iterates ω (t) ∼ p(ω|y, ψ (t−1) ) and ψ (t) ∼ p(ψ|X, y, ω (t) ) are drawn sequentially until the Markov chain reaches its stationary distribution, which is the joint posterior p(ψ, ω|y). Fortunately, efficient samplers for the Pólyagamma distribution have been developed [38] to facilitate this.

One-vs-Each Approximation to Softmax
The one-vs-each (OVE) approximation [31] was formulated as a lower bound to the softmax likelihood in order to handle classification over a large number of output classes, where computation of the normalizing constant is prohibitive. We use the OVE approximation not to deal with extreme classification, but rather due to its compatibility with Pólya-gamma augmentation, as we shall soon see. The one-vs-each approximation can be derived by first rewriting the softmax likelihood as follows: where f (f 1 , . . . , f C ) are the logits. (5) can be bounded as follows: which is the OVE lower bound. This expression avoids the normalizing constant and factorizes into a product of pairwise sigmoids. Titsias [31] showed that surprisingly the OVE approximation shares the same global optimum as the exact softmax maximum likelihood, suggesting a close relationship between the two.

One-vs-Each Pólya-Gamma GPs
We now introduce our method for GP-based Bayesian few-shot classification, which utilizes a novel combination of Pólya-gamma augmentation and the one-vs-each (OVE) approximation.

OVE as a Likelihood Function
Suppose we have access to examples X ∈ R N ×D with corresponding one-hot labels Y ∈ {0, 1} N ×C , where C is the number of classes. We consider the logits jointly as a single vector . . , f C N ) and place an independent GP prior on the logits for each class: f c (x) ∼ GP(m(x), k(x, x )). Therefore we have p(f |X) = N (f |µ, K), where µ c i = m(x i ) and K is block diagonal with K c ij = k(x i , x j ) for each block K c . The Pólya-gamma integral identity used to derive (2) does not have a multi-class analogue and thus a direct application of the augmentation scheme to the softmax likelihood is nontrivial. Instead, we propose to directly replace the softmax with an OVE-based likelihood function, which is the same as (6): We use this likelihood not to handle extreme classification as Titsias [31], but instead due to its close relationship with the softmax likelihood while maintaining tractable inference with Pólya-gamma augmentation.
The reader may have noticed that (7) is not normalized over classes, in the sense that in general c p OVE (y = c|f ) = 1. Here we invoke the likelihood principle [1], which is fundamental to Bayesian inference and states that all relevant experimental information is contained in the likelihood function for f given the observed data y. Moreover, two likelihood functions contain the same information about f if they are proportional to each other. Therefore the fact that (7) is not normalized over classes c is of no consequence. All that matters for inference and prediction is the relative values of the likelihood function for the labels y that were actually observed.

Posterior Inference via Gibbs Sampling
Define the matrix A OVE-MATRIX(Y) to be a CN × CN sparse block matrix with C row partitions and C column partitions. Each block A cc is a diagonal N × N matrix defined as follows: where Y ·c denotes the cth column of Y. Now the binary logit vector ψ Af ∈ R CN will have entries equal to f yi i − f c i for each unique combination of c and i, of which there are CN in total. The OVE likelihood can now be written as p OVE (Y|ψ) = 2 N N C j=1 σ(ψ j ), where the 2 N term arises from the N cases in which ψ j = 0 due to comparing the ground truth logit with itself.
Analogous to (2), the likelihood of ψ conditioned on ω is proportional to a diagonal Gaussian: where κ j = 1/2 and Ω = diag(ω). By exploiting the fact that ψ = Af , we can express the likelihood in terms of f and write down the conditional posterior as follows: whereΣ = (K −1 + A ΩA) −1 , which is an expression remarkably similar to (3). Analogous to (4), the conditional distribution over ω given f and the data becomes p(ω|y, f ) = PG(ω|1, Af ).
The primary computational bottleneck of posterior inference lies in sampling f from (10). SinceΣ is a CN × CN matrix, a naive implementation would have complexity O(C 3 N 3 ). By utilizing of the matrix inversion lemma and Gaussian sampling techniques summarized in [6], this can be brought down to O(CN 3 ). However, in all the experiments for this work C was small enough that a naive implementation sufficed.

Learning Covariance Hyperparameters for Few-shot Classification
We now describe how we apply OVE Pólya-gamma augmented GPs to few-shot classification. We assume the standard episodic few-shot setup in which one observes a labeled support set S = (X, Y). Predictions must then be made for a query example (x * , y * ).
We consider a zero-mean GP prior over the class logits f c (x) ∼ GP(0, k θ (x, x )), where θ are learnable parameters of our covariance function. These could include traditional hyperparameters such as lengthscales or the weights of a deep neural network as in deep kernel learning [37]. By performing Bayesian modeling on the logits directly, we are able to construct a posterior distribution over functions and use it to make predictions on the query examples. The reader is encouraged to refer to [36, Section 2.2] for a discussion on the correspondence between function-space and weight-space.
We consider two objectives for learning hyperparameters of the covariance function: the marginal likelihood p θ (Y|X) and the predictive likelihood p θ (y * |x * , X, Y). Marginal likelihood measures the likelihood of the hyperparameters given the observed data and is intuitively appealing from a Bayesian perspective. On the other hand, many standard FSC methods optimize for predictive likelihood on the query set [33,7,28]. Both objectives marginalize over latent functions, thereby making full use of our Bayesian formulation.
Marginal Likelihood (ML). The log marginal likelihood can be written as follows: The gradient of the log marginal likelihood can be estimated by posterior samples ω ∼ p θ (ω|X, Y). In practice, we use a stochastic training objective based on samples of ω from Gibbs chains. We use Fisher's identity [5] to derive the following gradient estimator: where ω (1) , . . . , ω (M ) are samples from the posterior Gibbs chain. As suggested by Patacchiola et al. [20], who applied GPs to FSC via least-squares classification, we merge the support and query sets during learning to take full advantage of the available data within each episode.
Predictive Likelihood (PL). The expected log predictive likelihood for a query example x * is: We use an approximate gradient estimator again based on posterior samples of ω: ∇ θ log p θ (y * |x * , X, Y, ω (m) ).

(14)
We note that this is not an unbiased estimator of the gradient, but find it works well in practice. Our learning algorithm for both marginal and predictive likelihood may be found in Section B. Details of computing the posterior predictive distribution p(y * |x * , X, Y, ω) may be found in Section C.

Choice of Kernel
For our method we primarily use the following kernel, which we refer to as the "cosine" kernel due to its similarity to cosine similarity: where g θ (·) is a deep neural network that outputs a fixed-dimensional encoded representation of the input and α is the scalar log output scale. We experimented with several kernels and found the cosine and linear kernels to generally outperform RBF-based kernels (see Section E for detailed comparisons). We hypothesize that this is because they help the embedding network g θ (·) to learn linearly separable representations. In contrast, the RBF-based kernels yields nonlinear decision boundaries with respect to the embedded representation and may not provide the embedding network with as strong of a learning signal. Further study of the benefits and drawbacks of linear vs. nonlinear kernels is an interesting area of future work.

Baselines and Summary of Results
We compare classification accuracy and uncertainty quantification to representative baselines for several major approaches to FSC: fine-tuning, metric learning, gradient-based meta-learning, and GP-based classifiers. Fine-tuning approaches, including Feature Transfer and Baseline++ [3], train classification weights from scratch per episode on top of features extracted from an offline-trained classifier. Matching Networks [33] and Prototypical Networks [28] are popular metric learning approaches that optimize predictive cross-entropy on the query set. RelationNet [30] is another metric-learning approach but computes distances based on a pairwise-input deep neural network and optimizes a Gaussian likelihood on the query set. MAML [7] is a popular meta-learning approach that performs adaptation with one or a few gradient descent steps on the support set of each episode. Bayesian MAML [39] is a related Bayesian approach that uses Stein variational gradient (SVGD) to approximate the model posterior in weight space. In terms of GP-based methods, GPNet [20] applies GP regression directly on class labels with a Gaussian likelihood, an approach known as least squares classification [25]. Logistic Softmax GP is the approach proposed by Galy-Fajou et al. [8] discussed in Section 1 that replaces the exponential functions in the softmax with logistic sigmoids.
One of our aims is to compare methods based on uncertainty quantification. We therefore developed some new benchmark evaluations and tasks: few-shot calibration, robustness, and out-of-episode detection. In order to empirically compare methods, we could not simply borrow the accuracy results from other papers, but instead needed to train each of these baselines ourselves. For all baselines except Bayesian MAML and Logistic Softmax GP, we ran the code from [20] and verified that the accuracies matched closely to those reported by [20]. Additional experimental details may be found in Section D. We have made PyTorch code for our experiments publicly available 1 .
Here we summarize several conclusions of the experiments we conducted in the following sections. Firstly, the fine-tuning approaches are strong baselines in terms of accuracy (Baseline++ in particular), but do not produce reliable estimates of uncertainty. Secondly, methods relying on Gaussian likelihoods (RelationNet and GPNet) tend to also exhibit poor uncertainty quantification. We hypothesize this is due to the ill-suited nature of applying Gaussian likelihoods to the fundamentally discrete task of classification. Thirdly, optimizing for predictive cross-entropy generally improves classification accuracy and to some extent can remedy calibration issues of marginal likelihood-based methods. Fourthly, the OVE likelihood is better suited to classification than the Logistic Softmax likelihood, as can be seen by comparing the accuracy and calibration results of the ML versions of these models. Overall, our proposed OVE PG GP demonstrates strong performance across a wide range of scenarios.

Classification on Few-shot Benchmarks
As mentioned above, we follow the training and evaluation protocol of Patacchiola et al. [20] for this section. We train both 1-shot and 5-shot versions of our model in four different settings: Caltech-UCSD Birds (CUB) [34], mini-Imagenet with the split proposed by Ravi and Larochelle [24], as well as two cross-domain transfer tasks: training on mini-ImageNet and testing on CUB, and from Omniglot [14] to EMNIST [4]. We employ the commonly-used Conv4 architecture with 64 channels [33] for all experiments. Further experimental details and comparisons across methods can be found in the appendix. Classification results are shown in Table 1 and 2. We find that our proposed Pólya-Gamma OVE GPs yield strong classification results, outperforming the baselines in six of the eight scenarios. 60.11 ± 0.26 79.07 ± 0.05 48.00 ± 0.24 67.14 ± 0.23 77.00 ± 0.50 87.52 ± 0. 19 37.49 ± 0.11 57.23 ± 0.31

Uncertainty Quantification through Calibration
We next turn to uncertainty quantification, an important concern for few-shot classifiers. When used in safety-critical applications such as medical diagnosis, it is important for a machine learning system to defer when there is not enough evidence to make a decision. Even in non-critical applications, precise uncertainty quantification helps practitioners in the few-shot setting determine when a class has an adequate amount of labeled data or when more labels are required, and can facilitate active learning.
We chose several commonly used metrics for calibration. Expected calibration error (ECE) [11] measures the expected binned difference between confidence and accuracy. Maximum calibration error (MCE) is similar to ECE but measures maximum difference instead of expected difference. Brier score (BRI) [2] is a proper scoring rule computed as the squared error between the output probabilities and the one-hot label. For a recent perspective on metrics for uncertainty evaluation, please refer to Ovadia et al. [19]. The results for representative approaches on 5-shot, 5-way CUB can be found in Figure 1. Our OVE PG GPs are the best calibrated overall across the metrics.

Robustness to Input Noise
Input examples for novel classes in FSC may have been collected under conditions that do not match those observed at training time. For example, labeled support images in a medical diagnosis application may come from a different hospital than the training set. To mimic a simplified version of this scenario, we investigate robustness to input noise. We used the Imagecorruptions package [17] to apply Gaussian noise, impulse noise, and defocus blur to both the support set and query sets of episodes at test time and evaluated both accuracy and calibration. We used corruption severity of 5 (severe) and evaluated across 1,000 randomly generated tasks on the three datasets involving   Figure 2. We find that in general Bayesian approaches tend to be robust due to their ability to marginalize over hypotheses consistent with the support labels. Our approach is one of the top performing methods across all settings.

Out-of-Episode Detection
Finally, we measure performance on out-of-episode detection, another application in which uncertainty quantification is important. In this experiment, we used 5-way, 5-shot support sets at test time but incorporated out-of-episode examples into the query set. Each episode had 150 query examples: 15 from each of 5 randomly chosen in-episode classes and 15 from each of 5 randomly chosen out-of-episode classes. We then computed the AUROC of binary outlier detection using the negative of the maximum logit as the score. Intuitively, if none of the support classes assign a high logit to the example, it can be classified as an outlier. The results are shown in Figure 3. Our approach generally performs the best across the datasets.

Comparison of Likelihoods
In this section we seek to better understand the behaviors of the softmax, OVE, logistic softmax, and Gaussian likelihoods for classification. For convenience, we summarize the forms of these likelihoods below.
We sampled logits from f ∼ N (0, 1) and plotted a histogram and kernel density estimate of the maximum output probability max c p(y = c|f ) for each of the likelihoods, where C = 5. Note that because we are interested in predictions here that all output probabilities are normalized to sum to 1 when computing confidences. The results are shown in Figure 4. Logistic softmax is a priori underconfident: it puts little probability mass on confidence above 0.4. This may be due to the use of the sigmoid function which squashes large values of f . Gaussian likelihood a priori is overconfident in that it puts a large amount of probability mass on confident outputs. OVE on the other hand, is closer to softmax. Note that this is not a complete explanation, because GP hyperparameters such as the prior mean or Gaussian likelihood variance may be able to compensate for these imperfections to some degree. Indeed, we found it helpful to learn a constant mean for the logistic softmax likelihood, as mentioned in Section D.2.

Related Work
Many popular approaches to FSC rely on point estimates of parameters [33,24,7,28,30]. Such approaches may be useful for attaining good accuracy but become less useful when uncertainty quantification is critical. More recently, approaches attempting to infer posterior distributions over task-specific parameters have appeared. In this view, global meta-level parameters θ are shared across episodes and represent a prior over task-specific parameters φ that vary from episode to episode. The goal of this class of methods is to infer an approximate posterior q(φ) on a per-episode basis. Methods that follow this general approach, with various strategies for computing q(φ) include LLAMA [10], VERSA [9], Bayesian MAML [39], ABML [23], and VAMPIRE [18]. Because φ potentially represents the weights of a deep network, particular care needs to be taken in these methods to maintain computational efficiency. Methods that take a representation-based approach to uncertainty include Stochastic Prototype Embeddings [27], which induces uncertainty into the Prototypical Network classifier through encoder-driven embedding noise.
From a Gaussian Process perspective, Linderman et al. [15], like us, apply Pólya-gamma augmentation to Gaussian processes. They utilize a stick-breaking construction to decompose a multinomial distribution into a product of binomials. This construction introduces a permutation dependence that our OVE-based likelihood does not have. They also do not consider end-to-end deep kernel learning and do not investigate the few-shot setting. Galy-Fajou et al. [8] proposes a logistic-softmax likelihood for classification that requires Gamma augmentation and Poisson augmentation in addition to Pólya-gamma augmentation in order to perform inference. They also do not consider FSC.
Tossou et al. [32] consider Gaussian processes in the context of few-shot learning. Unlike ours, they only consider regression tasks using Gaussian likelihoods. GPNet [20], like us, use Gaussian processes to perform few-shot classification and learn covariance functions parameterized by deep neural networks. However, they use a Gaussian likelihood to model class labels rather than our OVEbased classification likelihood. Although the least squares classification approach can be effective from an accuracy standpoint, as our results show it suffers in terms of uncertainty quantification.

Conclusion
In this work, we have proposed a Bayesian few-shot classification approach based on Gaussian processes. Our method replaces the ordinary softmax likelihood with a one-vs-each likelihood and applies Pólya-Gamma augmentation to perform inference. This allows us to model class logits directly as function values and efficiently marginalize over uncertainty in each few-shot episode. Modeling functions directly enables our approach to avoid the dependence on model size that posterior inference in weight-space based models inherently have. Our approach compares favorably to baseline FSC methods under a variety of dataset and shot configurations, including dataset transfer. We also demonstrate strong uncertainty quantification, robustness to input noise, and out-of-episode detection. We believe that Bayesian modeling is a powerful tool for handling uncertainty and hope that our work will lead to broader adoption of efficient Bayesian inference in the few-shot scenario.

A Derivation of Pólya-Gamma Augmented Logistic Likelihood
In this section, we show the derivation for the augmented logistic likelihood presented in Section 2.1. First, recall the logistic likelihood: where σ(·) is the logistic sigmoid function. We have a Gaussian prior p(ψ) = N (ψ|µ, Σ) and introduce Pólya-gamma auxiliary random variables ω to the likelihood such that the original model is recovered when ω is marginalized out: p(y|ψ) = p(ω)p(y|ψ, ω) dω.
The Pólya-gamma distribution ω ∼ PG(b, c) can be written as an infinite convolution of gamma distributions: .

B Learning Algorithm
Our learning algorithm for both marginal and predictive likelihood is summarized in Algorithm 1.

Algorithm 1 One-vs-Each Pólya-Gamma GP Learning
Input: Objective L ∈ {L ML , L PL }, Task distribution T , number of parallel Gibbs chains M , number of steps T , learning rate η. Initialize hyperparameters θ randomly. repeat

C Posterior Predictive Distribution
The posterior predictive distribution for a query example x * conditioned on ω is: where f * are the query example's logits. The predictive distribution over f * can be obtained by noting that ψ and the query logits are jointly Gaussian: where K * is the N C × C block diagonal matrix with blocks K θ (X, x * ) and K * * is the C × C diagonal matrix with diagonal entries k θ (x * , x * ). The predictive distribution becomes: With p(f * |x * , X, Y, ω) in hand, the integral in equation (22) can easily be computed numerically for each class c by forming the corresponding OVE linear transformation matrix A c and then performing 1D Gaussian-Hermite quadrature on each dimension of N (ψ c * |A c µ * , A c Σ * A c ).

D Experimental Details
Here we provide more details about our experimental setup for our classification experiments, which are based on the protocol of [20].

D.1 Datasets
We used the four dataset scenarios described below. The first three are the same used by Chen et al. [3] and the final was proposed by Patacchiola et al. [20].
• CUB. Caltech-UCSD Birds (CUB) [34] consists of 200 classes and 11,788 images. A split of 100 training, 50 validation, and 50 test classes was used [12,3]. • mini-Imagenet. The mini-Imagenet dataset [33] consists of 100 classes with 600 images per class. We used the split proposed by Ravi and Larochelle [24], which has 64 classes for training, 16 for validation, and 20 for test. • mini-Imagenet→CUB. This cross-domain transfer scenario takes the training split of mini-Imagenet and the validation & test splits of CUB. • Omniglot → EMNIST. We use the same setup as proposed by Patacchiola et al. [20].
Omniglot [14] consists of 1,623 classes, each with 20 examples, and is augmented by rotations of 90 degrees to create 6,492 classes, of which 4,114 are used for training. The EMNIST dataset [4], consisting of 62 classes, is split into 31 training and 31 test classes.

D.2 Baselines
We compare to a variety of baselines, explained here in more detail.
• Feature Transfer [3] involves first training an off-line classifier on the training classes and then training a new classification layer on the episode. • Baseline++ [3] is similar to Feature Transfer except it uses a cosine distance module prior to the softmax during fine-tuning. • Matching Networks [33] can be viewed as a soft form of k-nearest neighbors that computes attention and sums over the support examples to form a predictive distribution over classes. • Prototypical Networks [28] computes class means (prototypes) and forms a predictive distribution based on Euclidean distance to the prototypes. It can be viewed as a Gaussian classifier operating in an embedding space. • MAML [7] performs one or a few steps of gradient descent on the support set and then makes predictions on the query set, backpropagating through the gradient descent procedure. For this baseline, we simply quote the classification accuracy reported by [20]. • RelationNet [30] rather than using a predefined distance metric as in Matching Networks or Prototypical Networks instead learns a deep distance metric as the output of a neural network that accepts as input the latent representation of both examples. It is trained to minimize squared error of output predictions. • GPNet [20] relies on least squares classification to maintain tractability of Gaussian process posterior inference. This is concurrent work to ours and so we compare to their results with a linear kernel (the latest version at the time the bulk of our experiments were performed). This work has since been renamed to GPShot. • Bayesian MAML [39] relies on Stein Variational Gradient Descent (SVGD) [16] to get an approximate posterior distribution in weight-space. We compare to both the non-chaser version, which optimizes cross-entropy of query predictions, and the chaser version, which optimizes mean squared error between the approximate posterior on the support set and the approximate posterior on the merged support & query set. The non-chaser version is therefore related to predictive likelihood methods and the chaser version is more analogous to the marginal likelihood methods. For the non-chaser version, we used 20 particles and 1 step of adaptation at both train and test time. For the chaser version, we also used 20 particles. At train time, the chaser took 1 step and the leader 1 additional step. At test time, we used 5 steps of adaptation. Due to the slow performance of this method, we followed the advice of Yoon et al. [39] and only performed adaptation on the final layer of weights, which may help explain the drop in performance relative to MAML. The authors only released Tensorflow code for regression, so we reimplemented this baseline in PyTorch. • Logistic Softmax GP [8] is the multi-class Gaussian process classification method that relies on the logistic softmax likelihood. Galy-Fajou et al. [8] did not consider few-shot, but we use the same objectives described in Section 3.3 of the main paper to adapt this method to FSC. In addition, we used the cosine kernel (see Section E for a description) that we found to work best with our OVE PG GPs. For this method, we found it important to learn a constant mean function (rather than a zero mean) in order to improve calibration. Please refer to Section 4.6 for a possible explanation why this is necessary.

D.3 Training Details
All methods employed the commonly-used Conv4 architecture [33] (see Table 3 for a detailed specification). All of our experiments used the Adam [13] optimizer with learning rate 10 −3 . During training, all models used epochs consisting of 100 randomly sampled episodes. A single gradient descent step on the encoder network and relevant hyperparameters is made per episode. All 1-shot models are trained for 600 epochs and 5-shot models are trained for 400 epochs. Each episode contained 5 classes (5-way) and 16

E Effect of Kernel Choice on Classification Accuracy
In this section, we examine the effect of kernel choice on classification accuracy for our proposed One-vs-Each Pólya-gamma OVE GPs.
Cosine Kernel. In the main paper, we showed results for the following kernel, which we refer to as the "cosine" kernel due to its resemblance to cosine similarity: where g θ (·) is a deep neural network that outputs a fixed-dimensional encoded representation of the input and α is the scalar log output scale. Both θ and α are considered hyperparameters and learned simultaneously as shown in Algorithm 1. We found that this kernel works well for a range of datasets and shot settings. We note that the use of cosine similarity is reminiscent of the approach taken by Baseline++ method of [3], which computes the softmax over cosine similarity to class weights.
Here we consider three additional kernels: linear, RBF, and normalized RBF.
Linear Kernel. The linear kernel is defined as follows: where D is the output dimensionality of g θ (x). We apply this dimensionality scaling because the dot product between g θ (x) and g θ (x ) may be large depending on D.
RBF Kernel. The RBF (also known as squared exponential) kernel can be defined as follows: where is the log lengthscale parameter (as with α, we learn the alongside θ).
Normalized RBF Kernel. Finally, we consider a normalized RBF kernel similar in spirit to the cosine kernel: The results of our Pólya-gamma OVE GPs with different kernels can be found in Tables 4 and 5. In general, we find that the cosine kernel works best overall, with the exception of Omniglot→EMNIST, where RBF does best.

F Additional Calibration Results
In Figure 5, we include calibration results for mini-Imagenet and Omniglot→EMNIST. They follow similar trends to the results presented in Section 4.3.

G Quantitative Robustness to Input Noise Results
In this section we include quantitative results for the robustness to input noise results presented in Figure 2. Results for Gaussian noise are shown in Table 6, impulse noise in Table 7, and defocus blur in Table 8. Table 6: Accuracy (%) and Brier Score when applying Gaussian noise corruption of severity 5 to both the support and query set of test-time episodes. Results were evaluated across 1,000 randomly generated 5-shot 5-way tasks.   Table 7: Accuracy (%) and Brier Score when applying impulse noise corruption of severity 5 to both the support and query set of test-time episodes. Results were evaluated across 1,000 randomly generated 5-shot 5-way tasks.