PI3NN: O UT - OF - DISTRIBUTION - AWARE PREDICTION INTERVALS FROM THREE NEURAL NETWORKS
A BSTRACT
We propose a novel prediction interval (PI) method for uncertainty quantiﬁcation, which addresses three major issues with the state-of-the-art PI methods.
First, existing PI methods require retraining of neural networks (NNs) for every given conﬁdence level and suffer from the crossing issue in calculating multiple PIs.
Second, they usually rely on customized loss functions with extra sensitive hyperparameters for which ﬁne tuning is required to achieve a well-calibrated PI.
Third, they usually underestimate uncertainties of out-of-distribution (OOD) samples leading to over-conﬁdent PIs.
Our PI3NN method calculates PIs from linear combinations of three NNs, each of which is independently trained using the standard mean squared error loss.
The coefﬁcients of the linear combinations are computed using root-ﬁnding algorithms to ensure tight PIs for a given conﬁdence level.
We theoretically prove that PI3NN can calculate PIs for a series of conﬁdence levels without retraining NNs and it completely avoids the crossing issue.
Additionally,
PI3NN does not introduce any unusual hyperparameters resulting in a stable performance.
Furthermore, we address OOD identiﬁcation challenge by introducing an initialization scheme which provides reasonably larger PIs of the OOD samples than those of the in-distribution samples.
Benchmark and real-world experiments show that our method outperforms several state-of-the-art approaches with respect to predictive uncertainty quality, robustness, and OOD samples identiﬁcation.
I NTRODUCTION
Neural networks (NNs) are widely used in prediction tasks due to their unrivaled performance in modeling complex functions.
Although NNs provide accurate predictions, quantifying the uncertainty of their predictions is a challenge.
Uncertainty quantiﬁcation (UQ) is crucial for many real-world applications such as self-driving cars and autonomous experimental and operational controls.
Moreover, effectively quantiﬁed uncertainties are useful for interpreting conﬁdence, capturing out-of-distribution (OOD) data, and realizing when the model is likely to fail.
A diverse set of UQ approaches have been developed for NNs, ranging from fully Bayesian NNs [1], to assumption-based variational inference [2; 3], and to empirical ensemble approaches [4; 5; 6].
These methods require either high computational demands or strong assumptions or large memory costs.
Another set of UQ methods is to calculate prediction intervals (PIs), which provides a lower and upper bound for an NN’s output such that the value of the prediction falls between the bounds for some target conﬁdence level γ (e.g., 95%) of the unseen data.
The most common techniques to construct the PI are the delta method (also known as analytical method)
[7; 8], methods that directly predict the variance (e.g., maximum likelihood methods and ensemble methods) [9; 10] and quantile regression methods [11; 12].
Most recent PI methods are developed on the high-quality principle—a PI should be as narrow as possible, whilst capturing a speciﬁed portion of data.
Khosravi et al.
[13] developed the Lower Upper Bound Estimation method by incorporating the high-quality principle directly into the NN loss function for the ﬁrst time.
Inspired by [13], the Quality-Driven (QD) prediction interval approach in [14] deﬁnes a loss function that can generate a high-quality PI and is able to optimize the loss using stochastic gradient descent as well.
Built on QD, the Prediction
Intervals with speciﬁc Value prEdictioN (PIVEN) method in [15] adds an extra term in the loss to enable the calculation of point estimates and the PI method in [16] further integrates a penalty function to the loss to improve the training stability of QD.
The Simultaneous Quantile Regression (SQR) method [17] proposes a loss function to learn all quantiles of a target variable with one NN.
Existing
PI methods suffer from one or more of the following limitations: (1) Requirement of NNs retraining for every given conﬁdence level γ and suffering from the crossing issue [18] when calculating PIs for differnt γ ; (2) Requirement of hyper-parameter ﬁne tuning; (3) Lack of OOD identiﬁcation capability resulting in unreasonably narrow PIs for OOD samples (See Section 2.1 for details).
To address these limitations, we develop PI3NN (prediction interval based on three neural networks)— a novel method for calculating PIs.
We ﬁrst lay out the theoretical foundation of the PI3NN in Section 3.1 by proving Lemma 1 that connects the ground-truth upper and lower bounds of a PI to a family of models that are easy to approximate.
Another advantage of the model family introduced in Lemmais that it makes the NN training independent of the target conﬁdence level, which makes it possible to calculate multiple PIs for a series of conﬁdence levels without retraining NNs.
On the basis of the theoretical foundation, we describe the main PI3NN algorithm in Section 3.2.
Different from existing
PI methods [14; 15; 16; 17] that design complicated loss functions to obtain a well-calibrated PI by ﬁne-tuning their loss hyper-parameters, our method simply uses the standard mean squared error (MSE) loss for training.
Additionally, we theoretically prove that PI3NN has a non-crossing property in Section 3.2.1.
Moreover, we address the OOD identiﬁcation challenge by proposing a simple yet effective initialization scheme in Section 3.3, which provides larger PIs of the OOD samples than those of the in-distribution (InD) samples.
The main contributions of this work are summarized as follows:
Our PI3NN method can calculate PIs for a series of conﬁdence levels without retraining NNs; and the calculated PIs completely avoid the crossing issue as proved in Section 3.2.1.
The theoretical foundation in Section 3.1 enables PI3NN to use the standard MSE loss to train three NNs without introducing extra hyper-parameters that need to be ﬁne-tuned for a good PI.
We develop a simple yet effective initialization scheme and a conﬁdence score in Section 3.3 to identify OOD samples and reasonably quantify their uncertainty.
1. R ELATED WORK
Non-PI approaches for UQ .
Early and recent work was nicely summarized and reviewed in these three survey papers [19; 20; 21].
The non-PI approaches use a distribution to quantify uncertainty, which can be further divided into Bayesian [1] and non-Bayesian methods.
Bayesian methods—including
Markov chain Monte Carlo [22] and Hamiltonian Monte Carlo [23]—place priors on NN weights
and then infer a posterior distribution from the training data.
Non-Bayesian methods includes evidential regression [6] that places priors directly over the likelihood function and some ensemble learning methods that do not use priors.
For example, the DER method proposed in [6] placed evidential priors over the Gaussian likelihood function and training the NN to infer the hyperparameters of the evidential distribution.
Gal and Ghahramani [3] proposed using Monte Carlo dropout to estimate predictive uncertainty by using Dropout (which can be interpreted as ensemble model combination) at test time.
Deep ensembles [4] employed a combination of ensembles of NNs learning and adversarial training to quantify uncertainty with a Gaussian distributional assumption on the data.
Pearce et al.
[5] proposed an anchored ensembling by using the randomized MAP sampling to increase the diversity of NN training in the ensemble.
B ACKGROUND
We are interested in building PIs for the output of the regression problem y =
f ( x ) + ε from a training set D train = { ( x i , y i ) } Ni =1 , where x ∈ R d , y ∈ R , and ε is the random noise.
We do not impose distributional assumption on the noise ε .
Since the output of f ( x ) is polluted by the noise, the output y of the regression model y =
f
( x ) + ε is also a random variable.
For a given conﬁdence level γ ∈ (0 , 1) , the ground-truth 100 γ % PI, denoted by [ L true γ ( x ) , U true γ ( x )] , is deﬁned by
[Equation]
Note that L true γ ( x ) and U true γ ( x ) are not unique for a ﬁxed γ in the deﬁnition of Eq.
(1), because the probability of y outside the PI, i.e., P [ y > U true γ ( x ) or y <
L true γ ( x )] , may be split in any way between the two tails.
In this work, we aim to approximate the PI that satisﬁes
P [ y > U true γ ( x )]
=
(1 − γ ) / 2 and P [ y <
L true γ ( x )]
= (1 − γ ) / 2 , (2) which is unique because the probability outside the PI is equally split between the two tails.
2. M OTIVATION
Recent effort on PI methods, e.g., QD, SQR and PIVEN, tend to exploit the NNs to learn the upper and lower bounds in Eq.
Despite their promising performance, these methods suffer from some unsatisfactory drawbacks.
This effort is motivated by their following limitations:
• Requirement of retraining NNs for every given γ and the crossing issue when calculating multiple PIs.
Existing PI methods usually incorporate γ into their loss functions for training NNs, so that each NN can only predict PI for a speciﬁc γ , which is not convenient for users.
On the other hand, even multiple NNs can be trained for PIs with multiple γ values, the approximate PIs often encounter the crossing issue, e.g., the upper bounds for different γ values may cross each other, which is not reasonable.
To alleviate this issue, a non-crossing constraint is usually added to the loss as a regularization to encourage non-crossing PIs.
However, the non-crossing constraint may deteriorate the quality of the approximate PI, because due to the trade-off between the original loss and the non-crossing constraint.
Requiring hyper-parameter ﬁne tuning.
Recently developed PI methods [14; 15; 16] tend to design complicated loss functions to obtain a well-calibrated PI.
Although these work has achieved promising results, their performance is sensitive to the unusual hyperparameters introduced into their customized loss functions.
Thus, hyperparameter ﬁne tuning is usually required for each speciﬁc problem to achieve satisfactory upper and lower bounds.
• Lack of OOD identiﬁcation capability .
OOD identiﬁcation is a critical metric to evaluate the performance of an UQ method.
It has been received signiﬁcant attention in recent UQ method development in the machine learning community.
However, the OOD identiﬁcation has not been deeply studied for PI methods in solving the regression problem.
Even though there are some promising empirical results on OOD-aware PIs [15], the underlying mechanism is still not clear, making it difﬁcult to extend the occasional success to a general setting.
T HE PI3NN METHOD
The main contribution is presented in this section.
Section 3.1 shows a theoretical justiﬁcation of our method, where Lemma 1 plays a critical role to connect the ground-truth upper and lower bounds to
Eq.
(5) and Eq.
(6) that are easier to approximate.
Section 3.2 introduces the main PI3NN algorithm inspired by Lemma 1.
Section 3.3 describes how to turn on the OOD identiﬁcation capability in the
PI3NN method.
The features of our methods are illustrated using a simple example in Section 3.4.
3. T HEORETICAL JUSTIFICATION
To proceed, we ﬁrst rewrite Eq.
(2) to an equivalent form
[Equation]
where 1 ( · ) is the indicator function, deﬁned by
[Equation]
, otherwise, and
[Equation]
For simplicity, we take U true γ ( x ) as an example in the rest of Section 3.1, and the same derivation can be applied to L true γ ( x ) .
In deﬁnition, U true γ ( x ) has the following three properties: (P1)
U true γ ( x ) ≥ M [ y ] =
f ( x ) + M [ ε ] , where M [ · ] denotes the median of a random variable,
[Equation]
( x ) − f
[Equation]
x ) is independent of x , because ε is independent of x , (P
[Equation]
U true γ ( x ) is unique for a given conﬁdence level γ ∈ (0 , 1)
Next, we show that the ground-truth U true γ ( x ) is a member of the following model family:
[Equation]
where α ≥ 0 is a scalar model parameter and M [ · ] denotes the median of y .
To this end, we prove the following lemma:
Lemma 1.
For a given γ ∈ (0 , 1) , there exists a unique α ( γ ) , such that ˆ U ( x | α ( γ ))
=
U true γ ( x ) .
The proof of this lemma is given in Appendix A.
The same result can be derived for the lower bound, i.e., for a given γ ∈ (0 , 1) , there exists a unique β ( γ ) , such that ˆ L ( x | β ( γ ))
=
L true γ ( x ) , where ˆ L ( x | β ) is deﬁned by
[Equation]
Lemma 1 connects the ground-truth upper and lower bounds to the model families ˆ U ( x | α ) and ˆ L ( x | β ) , such that the task of approximating U true γ ( x ) and L
true γ ( x ) can be decomposed into two sub-tasks:
• Approximate the models ˆ U ( x | α ) and ˆ L ( x | β ) by training NNs; • Calculate the optimal values of α ( γ ) and β ( γ ) for any γ ∈ (0 , 1) .
In above theoretical justiﬁcation we assume the noise ε is homoscedastic as commonly done in regression problems.
But note that we use this assumption just for simplifying the theoretical proof.
In practice, our method can be generally applied to problems with different forms of noise.
3. T HE MAIN ALGORITHM
PI3NN accomplishes the above two sub-tasks in four steps.
Step 1-3 build approximations of ˆ U ( x | α ) and ˆ L ( x | β ) by training three independent NNs, denoted by f ω ( x ) , u θ ( x ) , l ξ ( x ) , which approximate M [ y ] , E
[( y − M [ y ]) 1 y − M
[ y ] > 0 ] , and E [( M [ y ] − y ) 1 M [ y ] − y> 0 ] , respectively.
After the three NNs are trained, we calculate the optimal values of α ( γ ) and β ( γ ) in Step 4 using root-ﬁnding techniques.
Step 1: Train f ω ( x ) to approximate the mean E [ y ] .
This step follows the standard NN-based regression process using the standard MSE loss.
The trained f ω ( x ) will serve two purposes.
The ﬁrst is to provide a baseline to approximate M [ y ] in Step 2 ; the second is to provide a point estimate of E [ f ] .
In this step, we use the standard L 1 and L 2 regularization to avoid over-ﬁtting.
Step 2: Add a shift ν to f ω ( x ) to approximate the median M [ y ] .
A scalar ν is added to f ω ( x ) , such that each of the two data sets D upper and D lower , deﬁned by
[Equation] [Equation]
contains 50% of the total training samples in D train .
Note that D upper and D lower include data points above and below f ω ( x ) + ν , respectively.
The value of the shift ν is calculated using a root-ﬁnding method [24] (e.g., the bisection method) to ﬁnd the root (i.e., the zero) of the function
Q ( ν ) =
(cid:80) ( x i ,y i ) ∈D train 1 y i >f ω ( x i )+ ν − 0 .
5 N .
This is similar to ﬁnding the roots of Eq.
(10), so we refer to Lemma 2 for the existence of the root.
Step 3: Train u θ ( x ) and l ξ ( x ) to learn E [( y − M [ y ]) 1 y − M
[ y ] > 0 ] and E [( M [ y ] − y )
1 M [ y ] − y> 0 ] .
We use D upper to train u θ ( x ) , and use D lower to train l ξ ( x ) .
To ensure the outputs of u θ ( x ) and l ξ ( x ) are positive, we add the operation (cid:112) ( · ) 2 to the output layer of both NNs.
The two NNs are trained separately using the standard MSE loss, i.e.,
[Equation]
Step 4:
Calculate the PI via root-ﬁnding methods.
Using the three NNs trained in Step 1-3 , we build approximations of ˆ U ( x | α ) and ˆ L ( x | α ) , denoted by
[Equation]
For a sequence of conﬁdence levels Γ = { γ k } Kk =1 , we use the bisection method [24] to calculate the optimal value of α ( γ k ) and β ( γ k ) by ﬁnding the roots (i.e., the zeros) of the following functions:
[Equation]
for k = 1 , . . .
, K .
Note that Eq.
(10) can be reviewed as the discrete version of Eq.
(3) and/or
Eq.
When D upper and D lower have ﬁnite number of data points, it is easy to ﬁnd α ( γ ) and β ( γ ) such that Q upper ( α ( γ ))
=
Q lower ( β ( γ ))
=
up to the machine precision (See Section 3.2.1 for details).
Then, the ﬁnal K PIs for the conﬁdence levels Γ = { γ k } Kk =1 is given by
[Equation]
Remark 1 (Generate PIs for multiple γ without re-training the NNs) .
Note that the NN training in
Step 1-3 is independent of the conﬁdence level γ , so the PIs for multiple γ can be obtained by only performing the root ﬁnding algorithm in Step 4 without re-training the three NNs.
In contrast, most existing PI methods (e.g., QD and PIVEN) require re-training NNs when γ is changed.
This feature, ultimately enabled by Lemma 1, makes our method more efﬁcient and convenient to use in practice.
3.2. T HEORETICAL ANALYSIS ON THE NON - CROSSING PROPERTY
The goal of this subsection is to theoretically prove that our algorithm can completely avoid the “crossing issue” [18] suffered by most existing PI methods without adding any non-crossing constraints to the loss function.
To proceed, we ﬁrst prove the existence of the roots of the functions in Eq.
Lemma 2 (Existence of the roots) .
Given the trained models f ω ( x ) , u θ ( x ) , l ξ ( x ) and ν , if the training set D train does not have repeated samples (i.e., ( x i , y i ) (cid:54) =
( x j , y j ) if i (cid:54) =
j ), then, for any ﬁxed γ > 0 , there exist α ( γ ) and β ( γ ) such that Q upper ( α ( γ ))
=
Q lower ( β ( γ )) = 0 .
The proof of this lemma is given in Appendix B.
In practice, the reason why it is easy to ﬁnd the roots of Q upper and Q lower is that the number of training samples are ﬁnite, so that the bisection method can vary α and β continuously in [0 , ∞ ) to search for “gaps” among the data points to ﬁnd the zeros of Q upper ( α ) and Q lower ( β ) .
Below is the theorem about the non-crossing property of the
PIs obtained by our method.
Lemma 2 will be used to in the proof of the theorem.
Theorem 1 (Non-crossing property) .
Given the trained models f ω ( x ) , u θ ( x ) , l ξ ( x ) and ν , if γ > γ (cid:48) satisfying (cid:100) N (1 − γ ) / 2 (cid:101) <
(cid:100) N (1 − γ (cid:48) ) /
2 (cid:101) , then U ( x | α ( γ ))
> U ( x | α ( γ (cid:48) )) and L ( x | β ( γ )) <
L ( x | β ( γ (cid:48) )) .
The proof of this theorem is given in Appendix C. Theorem 1 tells us that the width of the PI obtained by our method will monotonically increasing with γ , which completely avoids the crossing issue.
Again, this property is ultimately enabled by the equivalent representation of the PI in Lemma 1.
3. I DENTIFYING OUT - OF - DISTRIBUTION (OOD) SAMPLES
When using the trained model f ω ( x ) to make predictions for x (cid:54)∈ D train , it is required that a UQ method can identify OOD samples and quantify their uncertainties, i.e., for x (cid:54)∈ D train , the PI’s width increases with the distance between x and D train .
Inspired by the expressivity of ReLU networks, we add the OOD identiﬁcation feature to the PI3NN method by initializing the bias of the output layer of u θ ( x ) and l ξ ( x ) to a relatively large value.
Speciﬁcally, when the OOD identiﬁcation feature is turned on, we perform the following initialization before training u θ ( x ) and l ξ ( x ) in Step
• Pretrain u θ and l ξ using the training set D train with default initialization and compute the mean outputs µ upper = (cid:80)
Ni =
1 u θ ( x i ) /N and µ lower =
(cid:80) Ni =
1 l ξ ( x i ) /N
based on the training set.
• Initialize the biases of the output layers of u θ ( x ) and l ξ ( x ) to c µ upper and c µ lower , where c is a large number (e.g., c = 10 in this work), such that the initial outputs of u θ ( x ) and l ξ ( x ) are signiﬁcantly larger than µ upper and µ .
• Re-train u θ ( x ) and l ξ ( x ) following Step 3 using the MSE loss.
The key in above initialization scheme is the increase of the bias of the output layer of u θ ( x ) and l ξ ( x ) .
It is known that a ReLU network provides a piecewise linear function.
The weights and biases of hidden layers deﬁnes how the input space is partitioned into a set of linear regions [25]; the weights of the output layer determines how those linear regions are combined; and the bias of the output layer acts as a shifting parameter.
The weights and biases are usually initialized with some standard distribution, e.g., uniform or Gaussian.
Setting the biases to cµ upper and cµ lower with a large value of c will signiﬁcantly increase the output of the initial u θ ( x ) and l ξ ( x ) (See Figure 1 for demonstration).
During the training, the loss in Eq.
(8) will encourage the decrease of u θ ( x ) and l ξ ( x ) only for the in-distribution (InD) samples (i.e., x ∈ D train ), not for the OOD samples.
Therefore, after training, the PI will be wider in the OOD region than in the InD region.
Additionally, due to continuity of the
ReLU network, the PI width (PIW) will increase with the distance between x and D train showing a decreasing conﬁdence.
Moreover, we can deﬁne the following conﬁdence score by exploiting the width of the PI, i.e.,
[Equation]
where the numerator is the mean PI width (MPIW) of the training set D train and the denominator is the PIW of a testing sample x .
If x is an InD sample, its conﬁdence score should be close to one.
As x moves away from D train , the PIW gets larger and thus the conﬁdence score becomes smaller.
3. A N ILLUSTRATIVE EXAMPLE
We use a one-dimensional non-Gaussian cubic regression dataset to illustrate PI3NN.
We train models on y = x 3 + ε within [ − 4 , 4] and test them on [ − 7 , 7] .
The noise ε is deﬁned by ε = s ( ζ ) ζ , where ζ ∼ N (0 , 1) , s ( ζ ) =
30 for ζ ≥ 0 and s ( ζ )
= 10 for ζ < 0 .
Top panels of Figure 1 illustrate the four steps of the PI3NN algorithm.
After Step 1-3 we ﬁnish the NNs training and obtain f ω ( x )+ ν − l ξ ( x ) and f ω ( x )+ ν + u θ ( x ) .
Then for a given series of conﬁdence levels γ , we use root-ﬁnding technique to calculate the corresponding α and β in Step 4 and obtain the associated 100 γ % PIs deﬁned in
Eq.
Figure 1 shows the 90%, 95% and 99% PIs.
In calculation of the series of PIs for the multiple conﬁdence levels, PI3NN only trains the three NNs once and the resulted PIs have no “crossing issue”.
Bottom panels of Figure 1 demonstrate the effectiveness of PI3NN’s OOD identiﬁcation capability and illustrate that it is our bias initialization scheme (Section 3.3) enables PI3NN to identify the OOD regions and reasonably quantify their uncertainty.
E XPERIMENTAL EVALUATION
We evaluate our PI3NN method by comparing its performance to four top-performing baselines—QD [14], PIVEN [15], SQR [17], and DER [6] on four experiments.
The ﬁrst experiment focuses on evaluation of the accuracy and robustness of the methods in calculating PIs.
The last three experiments focus on the assessment of the OOD identiﬁcation capability.
The code of PI3NN is avaliable at https://github.com/liusiyan/PI3NN .
4. UCI REGRESSION BENCHMARKS
We ﬁrst evaluate PI3NN to calculate 95% PIs on nine UCI datasets [26].
The quality of PI is measured by the Prediction Interval Coverage Probability (PICP) which represents the ratio of data samples that fall within their respective PIs.
We are interested in calculating a well-calibrated PIs, i.e., the test
PICP is close to the desired value of 0.95 and meanwhile has a narrow width.
In this experiment, we focus on the metric of PICP, not the PI width (PIW) because it is meaningful to compare PIWs only when the methods have the same PICPs.
A small PICP certainly produces small PIWs, but the small PICP may be much lower than the desired conﬁdence level causing unreasonable PIs.
In this experiment, for different model settings, some PI methods produce a wide range of PICPs while others result in a relatively narrow range; it is unfair to compare the PIWs between methods that produce different ranges of PICPs.
We use a single hidden layer ReLU NN for all the methods.
For each method, we test multiple scenarios with different hyper-parameter conﬁgurations, different training-testing data splits.
For each scenario, we use the average of 5 runs (with 5 random seeds) to generate the result.
All the methods consider the variation of the hidden layer size.
QD and PIVEN additionally consider the variation of the extra hyper-parameters introduced in their loss functions.
See Appendix for details about the experimental setup.
Table 1 summarizes the results.
It shows the mean, standard deviation (std), best, and worst PICP (across hyper-parameter conﬁgurations) for all the methods on the testing datasets.
DER, because of the Gaussian assumption, tends to overestimate the PI resulting in PICPs close to 1.0 for most datasets and produces the worst performance in terms of PICP.
For the four PI methods, our PI3NN achieves the best mean PICP (closest to 0.95) with the smallest std.
PI3NN is also the top performer in terms of the best and the worst PICP.
This suggests that PI3NN can produce a well-calibrated PI and its performance is less affected by the hyper-parameter conﬁguration.
In contrast, QD, PIVEN, and SQR require a careful hyper-parameter tuning to obtain the comparable best PICP as the PI3NN, but for each hyper-parameter set, their PICPs vary a lot with a large std and the worst PICP can be much lower than the desired 0.95 resulting in an unreasonable PI.
Thus, this experiment demonstrates the advantage of our method in producing a well-calibrated PI without time-consuming hyperparameter ﬁne tuning, which makes it convenient for practical use.
4. OOD IDENTIFICATION IN A 10- DIMENSIONAL FUNCTION EXAMPLE
We use a 10-dimensional cubic function f ( x ) =
110 ( x 31 + · · · + x 310 ) to demonstrate the effectiveness of the proposed bias initialization strategy in Section 3.3 for OOD identiﬁcation.
The training data of x is generated by drawing 5,000 samples from the normal distribution N (0 , 1) ; the corresponding training data of outputs y is obtained from y = f
( x ) + ε with ε following a Gaussian distribution
N (0 , 1) .
We deﬁne a test set with 1,000 OOD samples, where x are drawn from a shifted normal distribution N (2 , 1) .
We calculate the 90% PI for both the training (InD) and the testing (OOD) data using all the ﬁve methods.
For PI3NN, we consider two situations with the OOD identiﬁcation turned on and turned off.
We set the constant c in Section 3.3 to 10 to turn on PI3NN’s OOD identiﬁcation feature, and use the standard initialization to turn the feature off.
We use PI width (PIW) to evaluate
[Table]
the method’s capability in OOD identiﬁcation.
A method having an OOD identiﬁcation capability should produce larger PIWs of the OOD samples than those of the InD samples.
Additionally, we use the conﬁdence score deﬁned in Eq.
(12) to quantitatively evaluate the method’s capability in OOD identiﬁcation.
InD samples should have a close-to-one conﬁdence score and the OOD samples should have a remarkably smaller conﬁdence score than that of the InD datasets
[Figure] [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
Figure 2 shows the PDFs of the PIWs of the InD and OOD samples.
The ﬁgures indicate that our
PI3NN method, with OOD identiﬁcation feature turned on, can effectively identify the OOD samples by assigning them larger and well-separated PIWs than those of the InD dataset.
The other methods are not able to identify the OOD samples by mixing their PIWs into the InD data’s PIWs, showing overlapped PDFs.
These methods’ performance is similar to the case when the PI3NN turns off
its
OOD identiﬁcation capability.
Table 2 lists the mean and std of the conﬁdence scores for the InD and
OOD datasets.
This table further shows that PI3NN with OOD identiﬁcation feature turned on can effectively identify the OOD samples by giving them smaller conﬁdence scores than those of the InD samples, while other methods produce over-conﬁdent (wider) PIs for the OOD samples and cannot separate OOD samples from InD dataset.
4. OOD IDENTIFICATION IN A FLIGHT DELAY DATASET
We test the performance of our method in OOD detection using the Flight Delay dataset [27], which contains about 2 million US domestic ﬂights in 2008 and their cases for delay.
We use the PI3NN method to predict the regression map from 6 input parameters, i.e., Day of Month, Day of Week,
AirTime, Flight Distance, TaxiIn (taxi in time), and TaxiOut (taxi out time), to the Arrival Delay.
The US federal aviation administration (FAA) categories general commercial airports into several ranks, i.e., Rank 1 (Large Hub) : 1% or more of the total departures per airport, Rank 2 (Medium
Hub) : 0.25% - 1.0% of the total departures per airport, Rank 3 (Small Hub) : 0.05% - 0.25% of the total departures per airport, and Rank 4 (NonHub) : <0.05% but more than 100 ﬂights per year.
The training set consists of randomly select 18K data from Rank 4 (Nonhub) airports’ data.
We also randomly select another 20K data from each rank to form 4 testing sets.
It is known that there is a data shift from Rank 1 airports to Rank 4 airports, because the bigger an airport, the longer the Taxi time, the averaged AirTime and the Flight Distance.
Thus, an OOD-aware PI method should be able to identify those data shift.
The setup for PI3NN method and the baselines are given in Appendix.
Table 3 shows the conﬁdence scores (i.e., Eq.
(12) with γ = 0 . 9 ) computed by our method and the baselines.
Our method with the OOD identiﬁcation feature turned on successfully detected the data shift by giving the Rank 1,2,3 testing data lower conﬁdence scores.
In contrast, other methods as well as our method (with OOD identiﬁcation turned off) fail to identify the data shift from the training set to the Rank 1,2,3 testing sets.
[Table]
C ONCLUSION AND DISCUSSION
The limitations of the PI3NN method include: (1) For a target function with multiple outputs, each output needs to have its own PI and OOD conﬁdence score.
The PI and the conﬁdence score cannot oversee all the outputs.
For example, this could make it challenging to apply PI3NN to NN models having image as outputs, (e.g., autoencoders).
(2) The effectiveness of the OOD detection approach depends on that there are sufﬁciently many piecewise linear regions (of ReLU networks) in the
OOD area.
So far, this is achieved by the standard random initialization (ensure uniform distributed piecewise linear regions at the beginning of training) and L 1 /L 2 regularization (ensure the linear regions not collapse together around the training set).
However, there is no guarantee of uniformly distributed piecewise linear regions after training.
Improvement of this requires signiﬁcant theoretical work on how to manipulate the piecewise linear function deﬁned by the ReLU network.
This work is for purely research purpose and will have no negative social impact.
(3) When the noise ε has heavy tails, our method will struggle when the distance between tail quantiles becomes very large.
In this case, the number of training data needed to accurately capture those tail quntiles may be too large to afford.
It is a common issue for all distribution-free PI methods, and reasonable distributional assumption may be needed to alleviate this issue.
A CKNOWLEDGEMENT
This work was supported by the U
S. Department of Energy, Ofﬁce of Science, Ofﬁce of Advanced
Scientiﬁc Computing Research, Applied Mathematics program; and by the Artiﬁcial Intelligence
Initiative at the Oak Ridge National Laboratory (ORNL).
ORNL is operated by UT-Battelle, LLC.
, for the U.S. Department of Energy under Contract DE-AC05-00OR22725.
This manuscript has been authored by UT-Battelle, LLC.
The US government retains and the publisher, by accepting the article for publication acknowledges that the US government retains a nonexclusive, paid-up, irrevocable,worldwide license to publish or reproduce the published form of this manuscript or allow others to do so, for US government purposes.
DOE will provide public access to these results of federally sponsored research in accordance with the DOE Public Access Plan (http://energy.gov/downloads/doepublic-access-plan)
A PPENDIX A T HE PROOF OF L EMMA
Proof.
Substitute y =
f ( x ) + ε into Eq.
(5), we can rewrite Eq.
(5) as ˆ U ( x | α ) =
f ( x ) + M [ ε ] + α E
[( ε − M [ ε ]) 1 ε − M
[ ε ] > 0 ] , where E [( ε − M [ ε ]) 1 ε − M [ ε ] > 0 ] =
E [( y − M
[ y ]) 1 y − M [ y ] > 0 ] is strictly positive and independent of x .
Then, we have that ˆ U ( x | α ) satisﬁes the properties (P1) and (P2).
It is easy to see that, for a ﬁxed x , there exists a unique value ˜
α ( γ, x ) , which depends on both γ and x , such that E [ 1 y>
ˆ U ( x | ˜ α ( γ, x )) ] − (1 − γ ) / 2 = 0 .
On the other hand, since ˆ U ( x | α ) in Eq.
(5) satisﬁes the property (P2), we have that ˆ U ( x | ˜ α ( γ, x ))
− f ( x ) =
M [ ε ] + ˜ α
( γ, x ) E [( ε − M [ ε ])
ε − M [ ε ] > 0 ] is independent of x .
Hence, ˜ α ( γ, x ) is actually independent of x .
Combining the above results, we have that there exists a unique α ( γ ) independent of x , such that
[Equation]
Comparing Eq.
(13) and the deﬁnition of the upper bound in Eq.
(3), we can see that ˆ U ( x | α ( γ )) is also a upper bound of the 100 γ % PI.
Due to the uniqueness of the upper bound, i.e., the property (P3), we have ˆ U ( x | α ( γ ))
=
U true γ
[Equation]
, which concludes the proof.
B T HE PROOF OF L EMMA
Proof.
We only need to prove Q upper ( α ( γ ))
= 0 , and the same derivation can be applied to
Q lower ( β ( γ )) .
Also, for notational simplicity, we assume N is an even number, so that N/ 2 is an integer.
We ﬁrst deﬁne
[Equation]
based on the deﬁnition of Q upper in Eq.
Since N is a ﬁnite integer, g ( α ) can be written as a step function, i.e.,
[Equation]
where 1 A k ( α ) is deﬁned by
[Equation]
with A k deﬁned by
[Equation]
In other words, A k is a sub-interval of [0 , ∞ ) , such that the number of samples in D upper satisfying y i >
U
( x i | α ) is equal to k for α ∈ A k .
Since ( x i , y i ) (cid:54) =
( x j , y j ) for i (cid:54) =
j , the Lebesgue measure of A k , denoted by λ ( A k ) is strictly positive, i.e., λ
( A k ) > 0 .
From classic measure theory, we know that for any set in R with strictly positive Lebesgue measure, there are inﬁnite real numbers in the set.
As such, there are inﬁnite real numbers in each A k for k = 0 , . .
N/ 2 .
Hence, for a given γ , any real number α ( γ ) ∈ A (cid:100) N (1 − γ ) / 2 (cid:101) will satisfy that g ( α ( γ ))
= (cid:100) N (1 − γ ) / 2 (cid:101) , i.e., Q upper ( α ( γ ))
= 0 , which concludes the proof.
C T HE PROOF OF T HEOREM
Proof.
We only need to prove U ( x | α ( γ ))
> U ( x | α ( γ (cid:48) )) , and the same derivation can be applied to
L ( x | β ) .
Since u θ ( x ) ≥ 0 , we have that U ( x | α ) is monotonically increasing with α for any x .
Thus, if α ( γ ) > α ( γ (cid:48) )
then U ( x | α ( γ )) >
U ( x | α ( γ (cid:48) )) .
So we only need to prove α ( γ ) >
α ( γ (cid:48) ) .
We use the proof by contradiction approach to prove α ( γ ) > α ( γ (cid:48) ) , i.e., we will derive a contradiction from the assumption that α ( γ ) ≤ α ( γ (cid:48) ) .
It is easy to see that the function
[Equation]
α ∈ [
[Equation]
∞ ) , (17) is a monotonically decreasing function of α .
Thus, if α ( γ ) ≤ α ( γ (cid:48) ) , we have g ( α ( γ )) ≥ g ( α ( γ (cid:48) )) .
On the other hand, we know from Lemma 2 that α ( γ ) and α ( γ (cid:48) ) satisfy
[Equation]
(cid:101)
[Equation]
g ( α ( γ (cid:48)
[Equation]
= (cid:100) N (1 − γ
[Equation]
/ 2 (cid:101) , (18) which leads to (cid:100) N (1 − γ ) / 2 (cid:101) ≥ (cid:100) N (1 − γ (cid:48) ) /
2 (cid:101) .
This is a contradiction with the condition of the theorem that (cid:100) N (1 − γ ) / 2 (cid:101) < (cid:100) N (1 − γ (cid:48) ) / 2 (cid:101) .
Therefore, the assumption α ( γ ) ≤ α ( γ (cid:48) ) is incorrect, such that we have α ( γ ) >
α ( γ (cid:48) )
⇒ U
( x | α ( γ )) >
U ( x | α ( γ (cid:48) )) , which concludes the proof.
D
E XPERIMENT SETUPS AND PARAMETERS D. S ETUP FOR THE UCI EXAMPLES AND EXTRA RESULTS
We evaluated the performance of the ﬁve method on 9 widely used UCI data sets, including Boston housing (boston), Concrete compressive strength (concrete), Energy efﬁciency (energy), KINematics 8 inputs non-linear medium unpredictability/noise (kin8nm), Combined Cycle Power Plant (power),
Physicochemical Properties of Protein Tertiary Structure (Protein), Wine quality (wine), and yacht
Hydrodynamics (yacht).
Since data splitting will affect the results for those problems, we pre-split the each data set with ﬁxed splitting random seed, and generated 3 train/test (90%/10%) data pairs used for all methods, so as to ensure a fair comparison.
Even different methods are built on top of different ML/DL platform, software versions, we intend to standardize the data pre-processing steps (e.g. data normalization) to ensure same data is imported to all models.
For each method, we test multiple scenarios with different hyper-parameter conﬁgurations, different training-testing data splits and random seeds.
All the methods consider the variation of the hidden layer size.
QD and PIVEN additionally consider the variation of the extra hyper-parameters introduced in their loss functions.
We summarized the modeling results in Table 1 of the main text.
In below Table 4 we listed the mean
PI width (MPIW) for the cases having similar PICPs.
As discussed, it is meaningful to compare the PI width only when the methods have the same PICPs.
So, for the methods having the similar
PICPs (i.e., the best PICP values highlighted in Table 1), we compared their MPIWs; those methods giving the smaller MPIW perform better.
Table 4 indicates that for the similar PICP values, our
PI3NN methods gave the smallest MPIWs for most of the datasets (7 out of 9).
Please note that
PI3NN obtained small MPIWs using the standard MSE loss, while other PI methods such as QD and PIVEN speciﬁcally minimized MPIWs in their loss function.
This customized loss although sometimes gives better MPIWs after careful hyper-parameter tuning, it also results in unreliable prediction performance sensitive to the hyper-parameter conﬁguration (as discussed in Table 1).
In the following, we discuss the model setup for each method in detail.
We use a single hidden layer ReLU NN for all the methods.
For each method, we test multiple scenarios with different hyper-parameter conﬁgurations, different training-testing data splits.
Speciﬁcally, we generate 3 pre-split data pairs for all experiments.
The other universally applied hyperparameter for all methods is the number of hidden neurons: [50, 100, 200].
QD and PIVEN additionally consider the variation of the extra hyper-parameters introduced in their loss functions.
For each scenario, we use the average of 5 runs (with 5 random seeds) to generate the result.
For PI3NN method, we use the hyper-parameters for all experiments: learning rate (0.01), Adam optimizer with MSE loss for all three networks.
For QD method, we include additional two hyper-parameter combinations: soften parameter: [100., 160., 200.] and lambda_in parameter: [5., 15., 25.] which are essential parameters for QD method.
In addition, we keep the default parameters in the original QD code for boston and concrete data
[Table]
sets, and our tuned parameters for rest of 7 data.
Speciﬁcally, the maximum epochs for all data is 300 except for concrete (800); similarly, the learning rate for concrete is 0.03 and 0.02 for other data sets; the decay rate and sigma_in are set to 0.9 and 0.1 respectively for 7 data sets except for concrete (0.98 and 0.2).
The outer layer bias are set to [3., -3].
Adam optimizer is used in the experiments, and we use 100 batch size from the original code.
For DER method, the maximum epochs is set to 40.
We follow the author tuned learning rate and batch size provided in the original code.
The learning rate and batch size are (1e-3, 8) for boston, (5e-3, 1) for concrete, (2e-3, 1) for energy, (1e-3, 1) for kin8nm, (1e-3, 2) for power, (5e-4, 1) for naval, (1e-4, 32) for wine, (1e-3, 64) for protein, and (5e-4, 1) for yacht.
For PIVEN method, similar to QD, we include the lambda_in ([5.0, 15.0, 20.0]) and sigma_in ([0.05, 0.2, 0.4]) for the hyper-parameter combinations.
The rest of the parameters are provided by the original authors in the code, including: batch size (100), outer layer biases [3., -3.], soften parameter (160.0).
Meanwhile, we use the author tuned maximum epochs, learning rate, decay rate for boston (300, 0.02, 0.9), concrete (800, 0.03, 0.98), energy (1200, 0.016, 0.97), kin8nm (800, 0.0134725, 0.993922), naval (1000, 0.006, 0.998), power (500, 0.014075, 0.987099), protein (600, 0.002, 0.999), wine (1000, 0.01, 0.98) and yacht (2000, 0.005, 0.98).
For SQR method, we added three hyper-parameter combinations based on the original paper and code, which are the learning rate [1e-2, 1e-3, 1e-4], dropout rate [0.1, 0.25, 0.5, 0.75] and weight decay [0, 1e-3, 1e-2, 1e-1, 1].
maximum epochs is 5,000 for all data sets by default.
Additional 20% validation data is split from the training data.
These parameter combinations with the split seed, random seed, number of neurons yield much more resutls than other methods, thus, we reduced the results data size by ﬁxing the learning rate (1e-2), dropout rate (0.1) and weight decay (0.1) for the ﬁnal evaluations.
D. S ETUP FOR THE 10D EXAMPLE
The 10-dimensional cubic function is used for generating the synthetic data for demonstrating OOD identiﬁcation capability.
As mentioned in Section 4.2, we generate a training data with 10 input features and size of 5,000, and 1,000 OOD testing data.
For PI3NN method, we use three networks with single layer (100 hidden nodes) with ReLU activation, the MSE loss is used with SGD optimizer (learning rate = 0.01).
Maximum epochs is 3,000.
We use comparable setups for the baseline methods.
Speciﬁcally, we take the hyperparameter values (suggested by the authors of those methods) and perform hyperparameter tuning around those suggested values, and choose the best performance for each baseline method.
The hyperparameters we tune include the hidden layer width, the learning rate and the extra hyperparameters introduced into the baseline method.
For hidden layers, we use 100,200,300 hidden neurons as candidates.
For learning rates, we use 0.0001, 0.001, 0.01 as candidates.
For the exclusive hyperparameters, we choose ﬁve candidate values (including the suggested ones).
For each hyperparameter conﬁguration, we run an ensemble of 5 runs to get the results.
After tuning, we have the following setup for the baseline methods.
For QD method, we use single hidden layer network (200 hidden nodes) with
Adam optimizer (lr=0.02).
Activation function is ReLU, and batch size is 100.
The soften parameter, labmda_in, and sigma_in are set to 160.0, 15.0 and 0.4, respectively.
For PIVEN method, sigma_in (0.2), learning rate (0.01).
It shares the same network structure, softer parameter and lambda_in with
QD method.
For DER method, we use single hidden layer with 200 nodes network, 1e-4 learning rate, 256 batch size.
For SQR method, we use single layer network with 100 neurons network.
We ﬁx the learning rate, dropout rate, weight decay rate to 1e-3, 0.1 and 0, respectively.
We also use the default setting by taking 20% of the training data as validation set in this method.
D. S ETUP FOR THE FLIGHT DELAY EXAMPLE
The ﬂight delay data ( www.kaggle.com/vikalpdongre/us-flights-data-2008 ) contains the ﬂight information in the U.S. in the year 2008.
We separate the data by airports into 4 ranks based on the percentage of departure ﬂights, which including: Large Hub (Rank 1), receives 1% or more of the annual departures; Medium Hub (Rank 2), which receives 0.25%-1% of the annual departures; Small Hub (Rank 3) and Nonhub (rank4) receives 0.05%-0.25% and <0.05% of the departures, respectively.
We select 5% of the Rank 4 data as the training data, another 5% of the Rank 4 is picked as ’test 4’ data, and we consider this as in-distribution data.
Rest of three testing data (’test 3’, ’test 2’, and ’test 1’) are selected from the Rank 3, 2 and 1, respectively with the 5% total amount of data.
We pick the 6 input features (’DayofMonth’, ’DayOfWeek’, ’AirTime’, ’Distance’, ’DepDelay’, ’TaxiOut’), and select ’ArrDelay’ as the output feature.
For PI3NN method, in the experiment, we use the same network architecture (i.e., one hidden layer
ReLU network containing 100 hidden neurons) and as the one used for the UCI datasets.
The Adam optimizer is used with learning rate being 0.01 and the maximum epochs being 50,000.
Conventional
L1 and L2 regularization are implemented with both penalties set to 0.02.
The scalar parameter (i.e. the one controlling the initial bias of the output layer) is set to 10 (the same as the test on the 10D function).
We also perform hyperparameter tuning for each of the baseline methods.
The universal hyperparameter, i.e., the number of hidden neurons come from the pool [50,100,200].
For the exclusive hyperparameters, we choose ﬁve candidate values (including the suggested ones).
For each hyperparameter conﬁguration, we run an ensemble of 5 runs to get the results.
After tuning, we have the following setup for the baseline methods.
For QD method, we use single layer network with 100 neurons, Adam optimizer with 0.02 learning rate, 50 epochs, 160.0 soften parameter, 0.1 sigma_in, 15.0 lambda_in, 100 batch size, 0.9 decay rate.
For DER method, we use single hidden layer with 100 neurons network structure, 512 batch size, 1e-4 learning rate and 100 maximum epochs for the experiments.
For PIVEN method, lambda_in and sigma_in are set to 15.0 and 0.2.
Same single layer 100 nodes network structure is applied.
Soften parameter is 160.0.
Batch size and maximum epochs are 100 and 500, respectively.
We use 0.01 learning rate and 0.99 decay rate
For SQR method, we use same network structure [100 neurons] and maximum epochs (500) with
PIVEN method.
We ﬁxed the learning rate (1e-3), dropout rate (0.1), and weight decay rate (0) in the ﬂight delay experiments.
D. OOD IDENTIFICATION IN A WATERSHED STREAMFLOW DATASET
We test the performance of our method in OOD detection using the streamﬂow dataset measured in East River Watershed, Colorado, United States.
The dataset contains three years of daily data of precipitation, maximum temperature, minimum temperature, and streamﬂow at the catchment outlet.
We use the Long Short-Term Memory (LSTM) network to learn the relationship between the three meteorological forcing (i.e., precipitation, maximum temperature and minimum temperature) and the streamﬂow.
The training data are from the ﬁrst two years (2015-2016) and the third year (2017) of data form the testing set.
Note that 2017 is a wet year with a relatively large amount of precipitation, which causes the streamﬂow patterns in 2017 dramatically different from those in 2015-2016.
In this experiment, the LSTM network consists of two sub-networks, i.e., the recurrent layers and the dense layers.
The recurrent layers extract the temporal feature information and the dense layers learn the rainfall-runoff relationship.
The prediction uncertainty quantiﬁcation focuses on the dense layer training.
In implementation, we ﬁrst train the entire LSTM network to get the mean and the median prediction following Step 1 and 2 in Section 3.2.
Next, we keep the recurrent layers unchanged and extract their outputs for all the LSTM input training samples, and use these output samples as inputs together with the streamﬂow data to train the dense layers and apply the UQ method to quantify the prediction uncertainty.
For PI3NN, we use these samples to train u θ and l ξ as mappings from the feature space (i.e., the input of u θ and l ξ is the input of the dense layers of the LSTM network) to the output of the LSTM network.
For other UQ methods such as QD, PIVEN, SQR, and DER, we use these samples to train the dense layers directly to obtain the uncertainty estimate.
In this way, we make a fair comparison between PI3NN and the baselines where they all use the same calibrated recurrent layers and focus on the training of the dense layers.
Figure 3 shows the predicted value and its 95% PI.
PI3NN can accurately identify the OOD data (i.e., the extreme event in 2017) by giving their predictions a large PI, while other methods fail to identify the OOD patterns by giving the testing data similarly narrow PIs as the training data.
This example demonstrates that our PI3NN method can show a consistent superior performance for a different dataset (time-series data) and a different network architecture (LSTM network).
E C ODE AND DATA AVAILABILITY
We include the code and data for reproducing the results generated in this study.
The data used for generating our table and plots are pre-generated for fast evaluations.
All the code with running instructions are made available for download through the following anonymous URL: https://figshare.com/s/b59c11bfa35b89cd061f
We include detailed instructions on running the code in the uploaded supplemental materials.
The original code for the methods except PI3NN can be found through the following URL: https://github.com/TeaPearce/Deep_Learning_Prediction_Intervals https://github.com/aamini/evidential-deep-learning https://github.com/elisim/piven https://github.com/facebookresearch/SingleModelUncertainty
Note that different methods may require different environment to run the code: PI3NN is based on
TensorFlow 2.0 (for UCI and Flight delay cases), and PyTorch (Cubic1D, Cubic10D), QD is based on TensorFlow 1.0 and can runs under compatibility mode with TF2.0, DER is based on TF2.0,
PIVEN is based on TF1.0, and SQR method is based on PyTorch.
More details are included in the supplemental materials.