#  $\nu$-DBA: Neural Implicit Dense Bundle Adjustment
Enables Image-Only Driving Scene Reconstruction

Yunxuan Mao1, Bingqi Shen1, Yifei Yang1, Kai Wang2, Rong Xiong1, Yiyi Liao1,
and Yue Wang1∗ 1Yunxuan Mao, Bingqi Shen, Yifei Yang, Yiyi Liao, Rong Xiong,
and Yue Wang are with Zhejiang University, Hangzhou, China. 2Kai Wang is with
the Application Innovate Lab, Huawei Incorporated Company, Beijing,
China.*Corresponding author.

###### Abstract

The joint optimization of the sensor trajectory and 3D map is a crucial
characteristic of bundle adjustment (BA), essential for autonomous driving.
This paper presents $\nu$-DBA, a novel framework implementing geometric dense
bundle adjustment (DBA) using 3D neural implicit surfaces for map
parametrization, which optimizes both the map surface and trajectory poses
using geometric error guided by dense optical flow prediction. Additionally,
we fine-tune the optical flow model with per-scene self-supervision to further
improve the quality of the dense mapping. Our experimental results on multiple
driving scene datasets demonstrate that our method achieves superior
trajectory optimization and dense reconstruction accuracy. We also investigate
the influences of photometric error and different neural geometric priors on
the performance of surface reconstruction and novel view synthesis. Our method
stands as a significant step towards leveraging neural implicit
representations in dense bundle adjustment for more accurate trajectories and
detailed environmental mapping.

##  I Introduction

Building a dense map of the driving scene is desirable for autonomous
vehicles, aiding localization, planning, and simulation. Bundle adjustment
(BA) is indispensable for this reconstruction task when using images with
noisy trajectories, which jointly optimizes camera poses and map points.
However, the sparse images and small parallax angles along the driving route
make dense surface mapping challenging using only images and noisy
trajectories in driving scenes.

To investigate this problem, we delve into BA from the perspectives of map
parametrization and measurement metric, respectively. The most popular BA
methods take sparse 3D scene points cloud as the map parametrization, as shown
in Fig. 1 (a). This representation is consistent across different views, yet
falls short in describing the dense geometry. Nevertheless, these sparse BA
methods provide insights into the measurement metric. There are two types of
measurement metrics in sparse BA: geometric error and photometric error.
COLMAP [1] and photometric BA [2] are two representative works, respectively.
Geometric BA utilizes the scene point correspondence across images for
optimization, while photometric BA utilizes the local patch consistency of the
scene point projections. In [3], geometric BA is shown to be more accurate
than photometric BA, which might be induced by sensitivity in illumination and
calibration.

Figure 1: Comparison of BA methods. (a) Traditional geometric sparse BA with
3D point map. (b) Geometric dense BA with 2D keyframes. (c) Photometric dense
BA with the neural implicit surface. (d) $\mathbf{\nu}$-DBA: geometric dense
BA with the neural implicit surface.

In recent years, dense BA has received increasing attention. A representative
work, DROID-SLAM [4], parametrizes the dense map based on a set of 2D
keyframes and their optimizable depth maps, as shown in Fig. 1 (b). A dense
map can be obtained by projecting the depth maps to 3D. However, keyframe
depth might be redundant in 3D, and there are no 3D consistency constraints to
enforce the overlap part to be the same, which may limit the accuracy of the
resultant map. Despite the limitation in the map parameterization, DROID-SLAM
inherits the advantage of geometric BA, as it can be essentially considered as
geometric BA by employing dense optical flow using RAFT [5] as the
measurement. This makes DROID-SLAM a geometric dense BA (DBA), as the scene
points correspondence in geometric sparse BA is akin to sparse optical flow.

Recent advances in neural implicit representation have achieved impressive
high-fidelity novel view synthesis [6] and scene reconstruction [7, 8]. With
the differentiable rendering, the image regression loss can be back-propagated
to learn the 3D representation [7, 8]. Considering such neural mapping from
the perspective of dense BA, we find that the neural implicit representation
acts as a 3D dense map parametrization, avoiding the consistency issue of
keyframe depth maps. The differentiable rendering can be viewed as a
photometric error-based measurement model, yielding a photometric dense BA, as
shown in Fig. 1 (c). Utilizing such a photometric dense BA as the back-end,
several neural implicit representation-based SLAM systems are proposed [9, 10,
11, 12, 13]. Despite some of them are applicable to RGB images for indoor
scenes [10, 13], existing methods in this direction struggle in street scenes
with RGB input, indicating that street scenes pose challenges due to complex
illumination and textureless regions. This raises a question: Can we bridge
the 3D neural implicit representation with the geometric error to improve the
dense BA accuracy?

Following the idea, in this paper, we propose $\nu$-DBA (pronounced as
“neuDBA”), a geometric dense BA framework with 3D neural implicit surface as
map parametrization, which optimizes both the map surface and trajectory poses
using geometric error derived from dense flow, as illustrated in Fig. 1 (d).
Apart from the framework, we investigate the effectiveness of photometric
error and other neural geometric prior on the quality of the surface
reconstruction and the novel view synthesis. Moreover, to relieve the
generalization gap of the flow prior, we further propose to fine-tune the flow
model through per-scene self-supervision. In the experiments, we evaluate our
method on several driving scene datasets and demonstrate superior trajectory
and mapping accuracy. In summary, we make the following contributions:

  * •

We propose a geometric error-based dense BA framework with 3D consistent
representation i.e. neural implicit surface as the map parametrization, for
driving scene reconstruction.

  * •

We propose to self-supervise the optical flow model to narrow the
generalization gap, which further improves the quality of the reconstructed
surface.

  * •

We evaluate the framework on several driving scene datasets, demonstrating
superior performance in reconstruction and trajectory optimization, and
investigating the effect of photometric error and other neural geometric
priors.

##  II Related Works

###  II-A Bundle Adjustment

A comprehensive and precise road map is key for the effective operation of
autonomous vehicles, facilitating their capabilities in self-localization,
trajectory planning, and simulation exercises. Bundle Adjustment (BA) plays a
critical role in this mapping process, especially when dealing with imprecise
trajectories and imagery, by simultaneously adjusting the estimations of
camera orientations and landmark locations. We conduct an in-depth exploration
of Bundle Adjustment (BA) with respect to the dimensions of map
parameterization and measurement metrics. The measurement metrics of existing
mature BA include two main types: geometric error and photometric error.
Methods that use geometric error perform optimization in two steps. First, the
raw sensor measurements are pre-processed to generate an intermediate
representation, solving part of the overall problem, such as computing the
image coordinates of corresponding points. Second, the computed intermediate
values are used to estimate the geometry and sensor poses. Photometric error-
based methods skip the pre-computation step, directly using the actual sensor
data for optimization.

Photometric error-based methods, such as DSO [14], LSD-SLAM [15], and DTAM
[16], rely on minimizing the photometric error between consecutive frames to
estimate the camera pose and reconstruct the scene structure. These methods
suffer from challenges like illumination changes and geometric distortions,
such as rolling shutter artifacts, which can adversely affect their
performance. In contrast, geometric error-based methods, such as MonoSLAM
[17], PTAM [18], and ORB-SLAM3 [3], solve the problems of direct methods by
generating features and estimating a geometry prior before bundle adjustment.
However, in early works, both methods utilize sparse 3D feature point cloud as
the map parametrization due to the sparse feature correspondence across
frames. The sparse bundle adjustment is limited when lacking features.

With the development of hardware, dense mapping has received increasing
attention. DROID-SLAM [4] proposed a geometric dense BA with dense optical
flow. DROID-SLAM builds a dense 3D map by projecting the estimated depth of 2D
keyframes to 3D. might be redundant in 3D, and there are no 3D consistency
constraints. In this paper, we aim to bridge the 3D neural implicit
representation with the geometric error to improve the dense BA.

###  II-B Neural Implicit Scene Representation

Neural implicit representations have gained popularity in 3D reconstruction
[19, 20, 21, 22, 23, 24, 25]. As dense, consistent scene representations,
these methods can extract high-fidelity surfaces useful for autonomous driving
tasks. At the same time, neural radiance field (NeRF) [6] has achieved
impressive novel view synthesis results with volume rendering techniques. The
differentiable volume rendering techniques make it possible to optimize neural
implicit surface representation with 2D information [7, 26]. From the dense BA
perspective, we find that the neural implicit representation acts as a 3D map
parametrization, and the differentiable rendering acts as the measurement
model.

Recently, building upon such photometric dense BA, several neural implicit
representation-based SLAM systems have been proposed [9, 27, 28, 10, 13, 12].
These works enable dense BA with neural implicit representation. However, most
of them focus primarily on indoor scenes with dense viewpoints and utilize the
ground truth depth image for optimization tasks. Yet, ground truth geometric
priors, such as depth images or LiDAR, are not available for all driving
scenes. NICER-SLAM [10] proposes a ground truth geometric prior-free dense
SLAM system for indoor scenes but does not extend to outdoor unbounded scenes
with driving views. The viewpoints are forward-facing with long and narrow
trajectories in the outdoor unbounded driving scenes, which differ
significantly from indoor scenes. StreetSurf [29] proposes a multi-shell
cuboid neural scene representation for street driving views. However, the
monocular geometry cues used in StreetSurf cannot be self-supervised and are
therefore constrained by the training dataset. By contrast, we propose a
geometric dense BA framework with a 3D neural implicit surface as the map
parametrization for RGB input in outdoor driving scenes and fine-tune the
optical flow model for each scene through self-supervision to enhance
performance.

Figure 2: Overview. Our method takes a sequence of RGB images with noisy
camera poses as input. In $\nu$-DBA, the self-supervised model inference
optical flow and disparity as neural geometric priors, which is utilized to
supervise the close-range SDF field and the camera poses with geometric
losses. Moreover, a distant model and a close-range color model are used for
RGB rendering.

##  III $\nu$-Dense Bundle Adjustment

Given a sequence of RGB images $\mathbf{I}=\\{I_{0},I_{1},\dots,I_{k}\\}$ with
noisy camera poses $\mathbf{T}=\\{T_{1},T_{2},\dots,T_{k}\\}$, the proposed
$\nu$-DBA is capable of simultaneously extracting dense and complete surfaces
and optimizing the camera poses. As shown in Fig. 2, there are two core
components: the close-range SDF field as map parameterization, and the flow
loss as the geometric metric. In addition, a self-supervision method is
employed to narrow down the generalization gap of off-the-shelf optical flow
predictor.

###  III-A Close-Range SDF Field

The close-range model represents geometry as a signed distance function (SDF).
Given a 3D point, it returns the point’s distance to the closest surface. In
this work, the SDF function is parameterized by a 3D hash table $h_{\theta}$
as the feature grid, and a single MLP $f_{\theta}$ as the geometry decoder

$\hat{s}=f_{\theta}(h_{\theta}(\mathbf{x}))$ (1)

Here, $\mathbf{x}$ is the 3D point, $\hat{s}$ denotes the corresponding SDF
value, and $\theta$ are learnable parameters.

###  III-B Neural Geometric Prior with Self-Supervision

To build the geometric error, we choose optical flow estimated by a pre-
trained model as the neural geometric prior i.e. observations. When a stereo
pair is available, disparity is also employed.

####  III-B1 Optical Flow

Optical flow finds the 2D-pixel displacement field between two images, which
can be easily obtained using an off-the-shelf flow estimator. We use the
pretrained unimatch model [30] to estimate the optical flow $\mathbf{F}_{i}$
for each input frame pair $\\{I_{i},I_{i+1}\\}$. Compared with monocular
depth, the optical flow infers the correspondences, which is not affected by
the metric scale.

####  III-B2 Stereo Matching

Stereo matching can be regarded as correspondence between the left and right
cameras, of which the relative pose is known, thus reducing the correspondence
space to epipolar lines. The unimatch model also estimates disparity
$D_{disp}$ for a given stereo pair $I^{l}_{i},I^{r}_{i}$. The accuracy of
stereo matching is often higher than that of optical flow, but it is
applicable only in scenes where a stereo pair is available.

####  III-B3 Self-supervised Fine-tune

One benefit of flow is that the model can be self-supervised using only RGB
image inputs, which is able to narrow down the generalization gap of the
optical flow inference model. Therefore, we follow [26] to fine-tune the
inference result of the optical flow model in a per-scene manner. Similar to
[31], we apply census loss, smoothness loss, and self-supervision loss to the
optical flow model.

####  III-B4 Other Neural Geometric Priors

Following [8, 29], the proposed model can also be supervised by the monocular
geometry cues i.e. monocular depth and normal. Note that compared with flow,
the monocular depth and normal can only be self-supervised when camera poses
are given, which may limit the generalization performance of monocular cues.
In addition, we consider that noise in flow prediction is more uniform in near
and far regions than that in monocular depth and normal prediction, which
makes flow more aligned with the uniform weighting in loss terms.

###  III-C Optimization

The $\nu$-DBA optimizes the SDF field and the camera poses together with the
supervision of 2D neural geometric prior estimated by the model in Section
III-B.

####  III-C1 Volume Rendering

Following recent work [6], we employ volume rendering as a measurement model,
to learn the pose and map supervised by estimated optical flow. Given the
camera’s intrinsic parameters and current camera pose, we cast a ray
$\mathbf{r}$ from the camera center $\mathbf{o}$ through the pixel along its
normalized view direction $\mathbf{v}$. We sample $N$ points along a ray,
denoted as $\mathbf{x}_{i}=\mathbf{o}+d_{i}\mathbf{v}$, where $d_{i}$ is the
depth of point $\mathbf{x}_{i}$, and $i\in{1,\cdots,N}$.

Given an image pair $\\{I_{k},I_{j}\\}$ and a ray $\mathbf{r}_{j}$ from the
pixel $\mathbf{p}_{j}$ in image $I_{j}$, we can calculate the pixel location
of every sample $\mathbf{x}^{\mathbf{r}_{j}}_{i}$ in the ray $\mathbf{r}_{j}$
on another image via differentiable tomography as in [32]

$H(d)=K_{k}R_{k}\left(I-\frac{(R_{k}^{-1}\mathbf{t}_{k}-R_{j}^{-1}\mathbf{t}_{j})\mathbf{n}^{\top}_{j}R_{j}}{d}\right)R_{j}^{-1}K_{j}^{-1}$
(2)

that $\\{K_{j},R_{j},\mathbf{t}_{j}\\}$ are the camera intrinsics, rotations,
and translations of frames $\\{I_{j}\\}$, $\mathbf{n}$ is the principle axis
of the reference camera, and $d$ is the depth of the point in reference view
$I_{j}$. Then, we can get the pixel location of sample
$\mathbf{x}^{\mathbf{r}_{j}}_{i}$ on image $I_{k}$: $\mathbf{p}^{i}_{k}\sim
H(d_{i})\cdot\mathbf{p}_{j}$ where ’$\sim$’ denotes the projective equality.

For volume rendering, following NeuS [7], we first query the SDF value
$\hat{s}_{i}$ of sample $\mathbf{x}_{i}$ and convert the SDF values into
density values ${\sigma_{i}}$. The optical flow $\hat{\mathbf{F}}$ of pixel
$\mathbf{p}_{j}$ from frame $I_{j}$ to frame $I_{k}$ can be calculated as

$\hat{\mathbf{F}}(\mathbf{r}_{j})=\sum_{i=1}^{N}T_{i}\alpha_{i}\mathbf{p}^{i}_{k}-\mathbf{p}_{j}$
(3)

where

$T_{i}=\prod_{j=1}^{i}(1-\alpha_{j})~{}\text{and}~{}\alpha_{i}=1-\exp(-\sigma_{i}\delta_{i})$
(4)

Similarly to optical flow, we can render the disparity when given a stereo
pair. We can calculate the disparity of a sample ray $\mathbf{r}$

$\hat{D}_{disp}(\mathbf{r})=\sum_{i=1}^{N}T_{i}\alpha_{i}\frac{f\cdot
b}{d_{i}}$ (5)

where $f$ is the focal length of the camera and $b$ is the baseline of the
stereo pair.

####  III-C2 Loss Function

To perform $\nu$-DBA, we define the geometric error loss function over optical
flow and disparity

$\mathcal{L}_{f}=\sum_{\mathbf{r}\in
R}\|\hat{\mathbf{F}}(\mathbf{r})-{\mathbf{F}}(\mathbf{r})\|_{2},~{}\mathcal{L}_{d}=\sum_{\mathbf{r}\in
R}\|\hat{D}_{disp}(\mathbf{r})-{D}_{disp}(\mathbf{r})\|_{2}$ (6)

Following common practice, we also add an Eikonal term on the sampled points
to regularize SDF values in 3D space and sparsity loss to penalize the
uncontrollable free surfaces:

$\mathcal{L}_{eik}=\sum_{\mathbf{x}\in\mathcal{X}}(\|\nabla\mathcal{S}_{\theta}(\mathbf{x})\|_{2}-1)^{2}$
(7)
$\mathcal{L}_{spa}=\sum_{\mathbf{x}\in\mathcal{X}}\exp(-\tau\cdot\|\mathcal{S}_{\theta}(\mathbf{x})\|)$
(8)

where $\tau$ is a hyperparameter to rescale the SDF value.

To eliminate ambiguous occupancy of the close-range SDF field, an entropy
regularization term is added

$\mathcal{L}_{ent}=f_{ent}(\hat{O}_{c}(\mathbf{r})),~{}f_{ent}(x)=-(x\ln
x+(1-x)\ln(1-x))$ (9)

where $\hat{O}(\mathbf{r})$ is the opacity of close-range SDF field along ray
$\mathbf{r}$ that can be calculated as
$\hat{O}(\mathbf{r})=\sum_{i=1}^{N}T_{i}\alpha_{i}$.

The overall loss used for $\nu$-DBA is

$\mathcal{L}_{\nu
DBA}=\mathcal{L}_{f}+\lambda_{1}\mathcal{L}_{d}+\lambda_{2}\mathcal{L}_{eik}+\lambda_{3}\mathcal{L}_{spa}+\lambda_{4}\mathcal{L}_{ent}$
(10)

###  III-D Road Surface Initialization

As discussed in [29], the disentanglement of close-range and distant view is
an unsupervised and ill-posed problem with almost no constraints. The road
surface initialization, wherein the close-range SDF field is pre-trained to
possess a zero-level set approximately aligned with the road surface, is
crucial for addressing this issue in driving scenes. To get the road surface,
we leverage the corresponding information provided by the estimated optical
flow. The corresponding points are triangulated with the preprocessed camera
poses to obtain a 3D point cloud. Subsequently, we identify the plane with the
maximal support within the point cloud by employing the Random Sample
Consensus (RANSAC) algorithm. This best-fitting plane serves as the initial
reference for the close-range SDF model.

###  III-E Voxel-based Sampling

The sampling strategy is important for neural implicit field training. Recent
works [33, 12, 26, 29] have proved that the octree structure can significantly
improve sampling efficiency. As a result, we employ the octree to sample
points along the rays in the close-range model. The octree is first
initialized by the triangulated point cloud in subsection III-D and is updated
iteratively throughout the training of the close-range model. We uniformly
sample $N$ points each voxel intersected by the ray. To further improve the
sampling efficiency, we discard those sampling points whose SDF value is
higher than the threshold after $60\%$ of the total number of training
iterations. These sampling strategies ensure that the selected points are in
proximity to the surface, thereby enhancing the model’s accuracy.

###  III-F Color Rendering

In this work, we consider color rendering optional as our geometric error
provides sufficient guidance for the DBA task. As discussed in [9, 10], when
applying color-related loss and geometric-related loss together, the loss
terms may conflict, degenerating the performance. Therefore, we decouple the
color model from the geometry model and only learn the color model if novel
view synthesis is required in addition.

In the color model, we employ a shader for close-range view and a distant
model that represents the scene hundreds or even thousands of meters away from
the camera as well as the sky.

(a)

(b)

(c)

Figure 3: Ablation study on Self-supervised Fine-tuning. Self-supervised (ss)
fine-tuning improves the details of the model and achieves a better
reconstruction.

####  III-F1 Close-Range Color Field

Given point $\mathbf{x}$ and a view direction $\mathbf{v}$, the function of
RGB color $\mathcal{C}$ can be defined as

$\hat{\mathbf{c}}=\mathcal{C}_{\theta}(\mathbf{v},\hat{\mathbf{z}})$ (11)

The feature vector $\hat{\mathbf{z}}$ is the output of the geometry decoder of
the SDF model.

####  III-F2 Distant Model

To handle unbounded scene rendering, we leverage a scene parameterization
similar to [29]. The distant model is a hyper 4D hash table. Given the 4D
input $\mathbf{x}^{\prime}$, the network directly outputs the density
$\hat{\sigma}$ and RGB color $\hat{\mathbf{c}}$ of the sample point.

$[\hat{\sigma},\hat{\mathbf{c}}]=h^{d}_{\theta}(\mathbf{x}^{\prime})$ (12)

To form a 4D input, we sample on cuboid shells and apply inverse cuboid
warping. Samples of the distant-view model lie on cuboid shells. The cuboid
shells are scaled proportionally from the cuboid shell of the close-range
space with inverse-proportionally increasing scales. The warped point
$\mathbf{x}^{\prime}$ of the sample $\mathbf{x}$ on the $i$th cuboid shell can
be expressed as

$\mathbf{x}^{\prime}=\left[r_{i}\cdot\mathbf{x},r_{i}\right],~{}r_{i}=\frac{1}{(1-i/n)+(i/n)(1/r_{max})}$
(13)

where $n$ is the number of cuboid shells and $r_{max}$ is the scale of the
largest cuboid shell relative to the close-range shell.

####  III-F3 Optimization

Given a sample $x_{i}$, the color model outputs the RGB color value
$\mathbf{c}$. Similar to the section. III-C1, the color $\hat{\mathbf{C}}$ for
the given ray $\mathbf{r}$ is computed via numerical integration

$\hat{\mathbf{C}}(\mathbf{r})=\sum_{i=1}^{N}T_{i}\alpha_{i}\mathbf{c}_{i}$
(14)

Then, we can optimize the color model with a simple photometric loss

$\mathcal{L}_{photo}=\sum_{\mathbf{r}\in
R}\|\hat{\mathbf{C}}(\mathbf{r})-{\mathbf{C}}(\mathbf{r})\|_{2}$ (15)

##  IV Experiments

In this section, we validate our method on various real-world outdoor
datasets. We perform ablation study wrt. different geometry cues and provide
qualitative and quantitative comparisons against state-of-the-art baselines
and perform ablation study wrt. different geometry cues.

###  IV-A Experiment Setup

####  IV-A1 Datasets

In this work, we mainly focus on outdoor unbounded scenes with monocular input
or stereo pair input. Thus we consider 3 real-world datasets for evaluation:
KITTI-360 [34], Waymo [35], and a self-collected dataset from an autonomous
driving mine truck with more unstructured views.

####  IV-A2 Baselines

We compare our method to 1) state-of-the-art neural implicit surfaces methods:
NeuS-facto [36] and StreetSurf [29]. 2) neural radiance field methods:
NeRFacto [36] and F2-NeRF [37]. 3) state-of-the-art SLAM system: ORB-SLAM3 [3]
and DROID-SLAM [4].

####  IV-A3 Metrics

To evaluate the reconstruction accuracy, we report Accuracy [cm], Completion
[cm], and Completion Ratio with a threshold of 20cm of the extracted meshes
compared with ground truth LiDAR data. For a fair comparison, we remove unseen
regions that are not inside any camera’s viewing frustum and crop the meshes
with the oriented bounding box of LiDAR data. For appearance, we evaluate the
PSNR, SSIM, and LPIPS for rendered color images averaging on the training set
and test set the same as [29]. To evaluate the tracking accuracy, we use ATE
[m].

####  IV-A4 Implementation Details

We implement our method in PyTorch [38]. We use the cuboid hash-grids in nr3d
[29] as the hash table in scene representation. We sample 8192 rays per
iteration and train our model for 20k iterations for about 30 minutes on a
single NVIDIA RTX 4090 GPU.

###  IV-B Ablation Study

We verify whether the self-supervised fine-tuning of the optical flow model
can improve the performance of the method and ablate the impact of different
geometric cues on reconstruction quality. To avoid interference caused by
incorrect pose, the comparison is conducted using ground truth trajectories.
The data is averaged over four different scenes in the KITTI-360 dataset [34].

|  | Acc. $\downarrow$ | Comp. $\downarrow$ | Comp. Ratio $\uparrow$
---|---|---|---|---
KITTI-360 | w/o ss | 40.92 | 25.38 | 73.42
w/ ss | 38.40 | 23.82 | 74.78
Waymo | w/o ss | 48.06 | 81.95 | 63.87
w/ ss | 45.98 | 72.89 | 73.96
TABLE I: Ablation Study on Self-Supervised (ss) Fine-tuning.

####  IV-B1 Self-Supervised Fine-tuning

We compare the reconstruction quality before and after self-supervised fine-
tuning and report metrics averaged over the KITTI-360 and Waymo datasets in
TABLE I. Thanks to the narrower generalization gap, we observe that self-
supervised fine-tuning improves the reconstruction accuracy. It is worth
noting that the pre-trained models without (w/o) fine-tuning can also achieve
relatively good results, but as shown in Fig. 3, self-supervised fine-tuning
can improve the details of the model and achieve better reconstruction.

Geometry cues | Acc. $\downarrow$ | Comp. $\downarrow$ | Comp. Ratio $\uparrow$
---|---|---|---
m-depth | 82.71 | 32.80 | 61.73
m-depth+m-normal | 63.45 | 27.92 | 64.80
flow | 36.79 | 25.65 | 71.14
ss-flow | 31.21 | 23.93 | 74.44
stereo | 27.17 | 20.27 | 78.71
stereo+ss-flow | 23.95 | 19.96 | 80.34
TABLE II: Ablation Study on Different Geometry Cues. ss-flow denotes self-
supervised optical flow, m- denotes monocular geometry cues.

####  IV-B2 Different Geometry Cues

We now investigate the effectiveness of different geometric cues. To avoid
interference from RGB cues, we do not use photometric loss in this experiment.
We conducted monocular and stereo-pair experiments on the KITTI-360 dataset.
Note that we also ablate monocular depth and normal cues with our model, and
the loss function is the same as [8]. As shown in TABLE II, the results
indicate that for monocular input, self-supervised flow outperforms monocular
cues as expected. For stereo pair input, optical flow further helps stereo
improve the reconstruction performance. Comparing monocular and stereo pair
inputs, stereo pair provides better geometry, which is obvious with more
information.

|  | Acc. $\downarrow$ | Comp. $\downarrow$ | Comp. Ratio $\uparrow$
---|---|---|---|---
ss-flow | w/ $\mathcal{L}_{p}$ | 38.40 | 23.82 | 74.78
w/o $\mathcal{L}_{p}$ | 31.21 | 23.93 | 74.44
stereo+ss-flow | w/ $\mathcal{L}_{p}$ | 26.42 | 19.67 | 80.53
w/o $\mathcal{L}_{p}$ | 23.95 | 19.96 | 80.34
TABLE III: Ablation Study on Photometric Loss.

####  IV-B3 Photometric Loss

In this experiment, we investigated the impact of photometric loss on
reconstruction. As shown in TABLE III, photometric loss increases completeness
at the cost of a significant decrease in accuracy. This result derives the
conflict and ambiguity mentioned in [9, 10]. We consider that the photometric
loss hurts the geometry in the way of more parameters to learn, and
illumination disturbance to color loss as found in sparse bundle adjustment
literature [3].

###  IV-C Dense Bundle Adjustment

####  IV-C1 Trajectory and Mapping

In this experiment, we demonstrate the effectiveness of our method as a dense
geometric bundle adjustment with noisy camera poses. The results are averaged
over four different scenes in the KITTI-360 dataset. We compare our method
with the back-end of DROID-SLAM and StreetSurf. The input camera poses for all
methods are obtained from the front-end of DROID-SLAM. ORB-SLAM3 is also
utilized as a reference for tracking comparison. As shown in Table IV, we
compare the accuracy of the trajectory as well as that of the resultant
surface. All other methods outperform ORB-SLAM3, illustrating that dense
geometric bundle adjustment is more effective than traditional sparse
geometric bundle adjustment. DROID-SLAM is not as effective as the other two
methods based on neural implicit surfaces, indicating the effectiveness of the
3D consistency provided by neural implicit representation. Compared with
StreetSurf, our method employs a purely geometric BA without a photometric
loss. Our method achieves the best performance in both tasks by eliminating
color task disturbance and utilizing a 3D-consistent map parametrization. For
qualitative comparison, as shown in Fig. 4, our method reconstructs more
accurate and detailed surfaces.

(a)

(b)

(c)

(d)

Figure 4: Reconstruction results on the KITTI-360 dataset. Since no ground truth mesh is given, the ground truth LiDAR point cloud is displayed.  Method | ATE $\downarrow$ | Acc. $\downarrow$ | Comp. $\downarrow$ | Comp. Ratio $\uparrow$
---|---|---|---|---
ORB-SLAM3 [3] | 0.186 | - | - | -
DROID-SLAM [4] | 0.084 | 87.01 | 81.31 | 40.07
StreetSurf [29] | 0.078 | 75.52 | 38.63 | 56.51
Ours | 0.073 | 41.63 | 30.62 | 62.48
Ours (w/ stereo) | 0.071 | 29.77 | 25.35 | 73.40
TABLE IV: Quantitative comparison of bundle adjustment results.

(a)

(b)

(c)

(d)

Figure 5: Rendering results on the KITTI-360 dataset. | Appearance | Geometry
---|---|---
Method | PSNR $\uparrow$ | SSIM $\uparrow$ | LPIPS $\downarrow$ | Acc. $\downarrow$ | Comp. $\downarrow$ | Comp. Ratio $\uparrow$
NeRFacto [36] | 17.02 | 0.593 | 0.412 | - | - | -
F2-NeRF [37] | 26.70 | 0.725 | 0.359 | - | - | -
NeuS-Facto [36] | 14.27 | 0.533 | 0.437 | 446.93 | 201.86 | 9.92
StreetSurf [29] | 30.25 | 0.887 | 0.342 | 62.56 | 74.84 | 70.19
Ours (ss-flow) | 30.54 | 0.891 | 0.298 | 45.98 | 72.89 | 72.96
TABLE V: Quantitative comparison of appearance and geometry on Waymo dataset.

####  IV-C2 Trajectory and Colored Mapping

In the previous subsection, we evaluate the results of $\nu$-DBA: camera
tracking accuracy and reconstruction quality. In addition to $\nu$-DBA, our
method, as a neural implicit scene representation, can render high-quality
color images.

Continuing with the above experiment, we compare the two neural implicit-based
methods, StreetSurf and our method, with other neural implicit scene
representation methods: NeRFacto [36], F2-NeRF [37], and NeuS-Facto [36]. For
a fair comparison, the camera pose inputs for these three methods are also
obtained from the front-end of DROID-SLAM, which is the same as Section IV-C.
As shown in TABLE VI, both our methods with only self-supervised optical flow
prior and with additional stereo pair outperform other methods. The
qualitative experimental results are shown in Fig. 5, where our method
achieves a sharper reconstruction than other methods.

Method | PSNR $\uparrow$ | SSIM $\uparrow$ | LPIPS $\downarrow$
---|---|---|---
NeRFacto [36] | 16.89 | 0.580 | 0.421
F2-NeRF [37] | 22.24 | 0.781 | 0.365
NeuS-Facto [36] | 16.23 | 0.550 | 0.432
StreetSurf [29] | 24.37 | 0.816 | 0.329
Ours | 25.14 | 0.830 | 0.324
Ours w/ stereo | 25.93 | 0.840 | 0.316
TABLE VI: Quantitative comparison of appearance on KITTI-360 dataset.

###  IV-D Colored Mapping-only Bundle Adjustment

The above experiment utilizes the noisy camera pose input, which means the
accuracy of camera poses after BA will influence the experimental results. To
eliminate interference caused by incorrect pose, we conduct a reconstruction
experiment using ground truth camera pose input on the Waymo dataset. As shown
in TABLE V, our method still performs better than other methods when the pose
is accurate.

Method | PSNR $\uparrow$ | SSIM $\uparrow$ | LPIPS $\downarrow$
---|---|---|---
StreetSurf [29] | 26.92 | 0.766 | 0.389
Ours | 27.33 | 0.823 | 0.385
TABLE VII: Quantitative comparison of appearance on Mine dataset.

GT

(a)

StreetSurf [29]

(b)

Ours

(c)

Figure 6: Rendering and reconstruction results on the Mine dataset. The convex
obstacle is about 30cm high and the concave obstacle is about 20cm deep.

KITTI-360 and Waymo are both driving scene datasets in street view. To
validate the generalization of our method, we utilize a monocular outdoor
dataset on a more unstructured view self-collected from an autonomous driving
mine truck. Since the dataset lacks ground truth geometry data and camera
poses, we only quantitatively analyzed the rendering results in TABLE VII. The
rendering results and reconstruction results are shown in Fig. 6. On this
challenging dataset, our method rendered higher-fidelity RGB images and
extracted more precise meshes with challenging obstacles.

All the experiment results above demonstrate that our method achieves better
performance on camera tracking and reconstruction thanks to our $\nu$-DBA and
eliminating color task disturbance.

##  V Conclusion

In this paper, we propose $\nu$-DBA, a novel geometric dense BA framework that
utilizes a 3D neural implicit surface representation as the map
parametrization. This framework simultaneously optimizes the neural implicit
map surface and the camera trajectory poses by minimizing geometric error
derived from dense optical flow across consecutive frames, thereby bridging
the 3D neural implicit representation with geometric error minimization to
enhance the accuracy of dense bundle adjustment.

In addition, we investigate the effects of photometric error and other neural
geometric prior on the accuracy of surface reconstruction and novel view
synthesis. Moreover, we refine the flow model through per-scene self-
supervision for better performance. Compared with other bundle adjustment
methods and neural implicit reconstruction methods, our method achieves better
performance in pose optimization and reconstruction.

## References

  * [1] J. L. Schönberger and J.-M. Frahm, “Structure-from-motion revisited,” in _Conference on Computer Vision and Pattern Recognition (CVPR)_ , 2016.
  * [2] H. Alismail, B. Browning, and S. Lucey, “Photometric bundle adjustment for vision-based slam,” in _Computer Vision–ACCV 2016: 13th Asian Conference on Computer Vision, Taipei, Taiwan, November 20-24, 2016, Revised Selected Papers, Part IV 13_. Springer, 2017, pp. 324–341.
  * [3] C. Campos, R. Elvira, J. J. G. Rodríguez, J. M. Montiel, and J. D. Tardós, “Orb-slam3: An accurate open-source library for visual, visual–inertial, and multimap slam,” _IEEE Transactions on Robotics_ , vol. 37, no. 6, pp. 1874–1890, 2021.
  * [4] Z. Teed and J. Deng, “Droid-slam: Deep visual slam for monocular, stereo, and rgb-d cameras,” _Advances in neural information processing systems_ , vol. 34, pp. 16 558–16 569, 2021.
  * [5] ——, “Raft: Recurrent all-pairs field transforms for optical flow,” in _Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part II 16_. Springer, 2020, pp. 402–419.
  * [6] B. Mildenhall, P. P. Srinivasan, M. Tancik, J. T. Barron, R. Ramamoorthi, and R. Ng, “Nerf: Representing scenes as neural radiance fields for view synthesis,” _Communications of the ACM_ , vol. 65, no. 1, pp. 99–106, 2021.
  * [7] P. Wang, L. Liu, Y. Liu, C. Theobalt, T. Komura, and W. Wang, “Neus: Learning neural implicit surfaces by volume rendering for multi-view reconstruction,” _arXiv preprint arXiv:2106.10689_ , 2021.
  * [8] Z. Yu, S. Peng, M. Niemeyer, T. Sattler, and A. Geiger, “Monosdf: Exploring monocular geometric cues for neural implicit surface reconstruction,” _Advances in Neural Information Processing Systems (NeurIPS)_ , 2022.
  * [9] Z. Zhu, S. Peng, V. Larsson, W. Xu, H. Bao, Z. Cui, M. R. Oswald, and M. Pollefeys, “Nice-slam: Neural implicit scalable encoding for slam,” in _Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition_ , 2022, pp. 12 786–12 796.
  * [10] Z. Zhu, S. Peng, V. Larsson, Z. Cui, M. R. Oswald, A. Geiger, and M. Pollefeys, “Nicer-slam: Neural implicit scene encoding for rgb slam,” _arXiv preprint arXiv:2302.03594_ , 2023.
  * [11] M. M. Johari, C. Carta, and F. Fleuret, “Eslam: Efficient dense slam system based on hybrid representation of signed distance fields,” _arXiv preprint arXiv:2211.11704_ , 2022.
  * [12] Y. Mao, X. Yu, K. Wang, Y. Wang, R. Xiong, and Y. Liao, “Ngel-slam: Neural implicit representation-based global consistent low-latency slam system,” _arXiv preprint arXiv:2311.09525_ , 2023.
  * [13] Y. Zhang, F. Tosi, S. Mattoccia, and M. Poggi, “Go-slam: Global optimization for consistent 3d instant reconstruction,” in _Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)_ , October 2023.
  * [14] J. Engel, V. Koltun, and D. Cremers, “Direct sparse odometry,” _IEEE Transactions on Pattern Analysis Machine Intelligence_ , pp. 1–1, 2016.
  * [15] J. Engel, T. Schöps, and D. Cremers, “Lsd-slam: Large-scale direct monocular slam,” in _Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part II 13_. Springer, 2014, pp. 834–849.
  * [16] R. A. Newcombe, S. J. Lovegrove, and A. J. Davison, “Dtam: Dense tracking and mapping in real-time,” in _2011 international conference on computer vision_. IEEE, 2011, pp. 2320–2327.
  * [17] A. J. Davison, I. D. Reid, N. D. Molton, and O. Stasse, “Monoslam: Real-time single camera slam,” _IEEE transactions on pattern analysis and machine intelligence_ , vol. 29, no. 6, pp. 1052–1067, 2007.
  * [18] G. Klein and D. Murray, “Parallel tracking and mapping for small ar workspaces,” in _2007 6th IEEE and ACM international symposium on mixed and augmented reality_. IEEE, 2007, pp. 225–234.
  * [19] J. J. Park, P. Florence, J. Straub, R. Newcombe, and S. Lovegrove, “Deepsdf: Learning continuous signed distance functions for shape representation,” in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ , 2019, pp. 165–174.
  * [20] L. Mescheder, M. Oechsle, M. Niemeyer, S. Nowozin, and A. Geiger, “Occupancy networks: Learning 3d reconstruction in function space,” in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ , 2019, pp. 4460–4470.
  * [21] V. Sitzmann, J. Martel, A. Bergman, D. Lindell, and G. Wetzstein, “Implicit neural representations with periodic activation functions,” _Advances in Neural Information Processing Systems_ , vol. 33, pp. 7462–7473, 2020.
  * [22] M. Oechsle, S. Peng, and A. Geiger, “Unisurf: Unifying neural implicit surfaces and radiance fields for multi-view reconstruction,” in _Proceedings of the IEEE/CVF International Conference on Computer Vision_ , 2021, pp. 5589–5599.
  * [23] A. Chen, Z. Xu, F. Zhao, X. Zhang, F. Xiang, J. Yu, and H. Su, “Mvsnerf: Fast generalizable radiance field reconstruction from multi-view stereo,” in _Proceedings of the IEEE/CVF International Conference on Computer Vision_ , 2021, pp. 14 124–14 133.
  * [24] J. Wang, T. Bleja, and L. Agapito, “Go-surf: Neural feature grid optimization for fast, high-fidelity rgb-d surface reconstruction,” _arXiv preprint arXiv:2206.14735_ , 2022.
  * [25] X. Yu, Y. Liu, S. Mao, S. Zhou, R. Xiong, Y. Liao, and Y. Wang, “Nf-atlas: Multi-volume neural feature fields for large scale lidar mapping,” _arXiv preprint arXiv:2304.04624_ , 2023.
  * [26] X. Long, C. Lin, P. Wang, T. Komura, and W. Wang, “Sparseneus: Fast generalizable neural surface reconstruction from sparse views,” in _European Conference on Computer Vision_. Springer, 2022, pp. 210–227.
  * [27] E. Sucar, S. Liu, J. Ortiz, and A. J. Davison, “imap: Implicit mapping and positioning in real-time,” in _Proceedings of the IEEE/CVF International Conference on Computer Vision_ , 2021, pp. 6229–6238.
  * [28] H. Wang, J. Wang, and L. Agapito, “Co-slam: Joint coordinate and sparse parametric encodings for neural real-time slam,” in _CVPR_ , 2023.
  * [29] J. Guo, N. Deng, X. Li, Y. Bai, B. Shi, C. Wang, C. Ding, D. Wang, and Y. Li, “Streetsurf: Extending multi-view implicit surface reconstruction to street views,” _arXiv preprint arXiv:2306.04988_ , 2023.
  * [30] H. Xu, J. Zhang, J. Cai, H. Rezatofighi, F. Yu, D. Tao, and A. Geiger, “Unifying flow, stereo and depth estimation,” _IEEE Transactions on Pattern Analysis and Machine Intelligence_ , 2023.
  * [31] R. Jonschkowski, A. Stone, J. T. Barron, A. Gordon, K. Konolige, and A. Angelova, “What matters in unsupervised optical flow,” in _Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part II 16_. Springer, 2020, pp. 557–572.
  * [32] Y. Yao, Z. Luo, S. Li, T. Fang, and L. Quan, “Mvsnet: Depth inference for unstructured multi-view stereo,” _European Conference on Computer Vision (ECCV)_ , 2018.
  * [33] T. Müller, A. Evans, C. Schied, and A. Keller, “Instant neural graphics primitives with a multiresolution hash encoding,” _ACM Transactions on Graphics (ToG)_ , vol. 41, no. 4, pp. 1–15, 2022.
  * [34] Y. Liao, J. Xie, and A. Geiger, “Kitti-360: A novel dataset and benchmarks for urban scene understanding in 2d and 3d,” _IEEE Transactions on Pattern Analysis and Machine Intelligence_ , vol. 45, no. 3, pp. 3292–3310, 2022.
  * [35] P. Sun, H. Kretzschmar, X. Dotiwalla, A. Chouard, V. Patnaik, P. Tsui, J. Guo, Y. Zhou, Y. Chai, B. Caine, _et al._ , “Scalability in perception for autonomous driving: Waymo open dataset,” in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ , 2020, pp. 2446–2454.
  * [36] M. Tancik, E. Weber, E. Ng, R. Li, B. Yi, J. Kerr, T. Wang, A. Kristoffersen, J. Austin, K. Salahi, A. Ahuja, D. McAllister, and A. Kanazawa, “Nerfstudio: A modular framework for neural radiance field development,” in _ACM SIGGRAPH 2023 Conference Proceedings_ , ser. SIGGRAPH ’23, 2023.
  * [37] P. Wang, Y. Liu, Z. Chen, L. Liu, Z. Liu, T. Komura, C. Theobalt, and W. Wang, “F2-nerf: Fast neural radiance field training with free camera trajectories,” _CVPR_ , 2023.
  * [38] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala, “Pytorch: An imperative style, high-performance deep learning library,” in _Advances in Neural Information Processing Systems 32_. Curran Associates, Inc., 2019, pp. 8024–8035. [Online]. Available: http://papers.neurips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library.pdf


:
LEAVE UNSET 2020 LEAVE UNSET LEAVE UNSET Machine Learning for Health (ML4H)
2020

# Trust Issues: Uncertainty Estimation Does Not Enable Reliable OOD Detection
On Medical Tabular Data

Dennis Ulmer<EMAIL_ADDRESS>
Lotta Meijerink<EMAIL_ADDRESS>
Giovanni Cinà<EMAIL_ADDRESS>
Pacmed BV - Amsterdam  Netherlands

###### Abstract

When deploying machine learning models in high-stakes real-world environments
such as health care, it is crucial to accurately assess the uncertainty
concerning a model’s prediction on abnormal inputs. However, there is a
scarcity of literature analyzing this problem on medical data, especially on
mixed-type tabular data such as Electronic Health Records. We close this gap
by presenting a series of tests including a large variety of contemporary
uncertainty estimation techniques, in order to determine whether they are able
to identify out-of-distribution (OOD) patients. In contrast to previous work,
we design tests on realistic and clinically relevant OOD groups, and run
experiments on real-world medical data. We find that almost all techniques
fail to achieve convincing results, partly disagreeing with earlier findings.

###### keywords:

Uncertainty Estimation, OOD Detection, Electronic Health Records

##  1 Introduction

In healthcare, tremendous potential has been identified for applications deep
learning methods for e.g. prediction, screening, finding or designing better
treatments for patients (Sheikhalishahi et al., 2019; Esteva et al., 2019).
However, safe deployment in practice demands certain properties from models:
in the context of healthcare, models have to prove to be interpretable and
deliver trustworthy predictions (He et al., 2019). In particular, a
trustworthy application should be able to identify new samples outside the
training population. Although we always hope for models to generalize to novel
data points, a significant shift in the data can render the current predictor
unreliable. The COVID-19 pandemic offers an example of this phenomenon on a
large scale: the training data used for models deployed before the outbreak
might not have contained patients with these new combinations of symptoms.
Thus, the predictions of said models on COVID-patients should have a lower
degree of certainty to avoid misleading end-users like doctors and nurses. The
same could happen due to other, more common factors such as changes in the
patient demographics, evolving clinical protocols or scaling of a device
(Curth et al., 2019).

Deep neural networks are notorious for delivering predictions in an
overconfident manner, be it by confidently predicting the wrong class after
minimal perturbation of an input (Goodfellow et al., 2015), assigning high
probability to OOD samples (Nalisnick et al., 2018) or simply being badly-
calibrated in general (Guo et al., 2017). Such observations have motivated the
development of a series of techniques to more accurately estimate the
uncertainty about an outcome (Gal and Ghahramani, 2016; Lakshminarayanan et
al., 2017; Blundell et al., 2015). Alas, there is still a limited volume of
experiments on tabular data and classification tasks, a context of particular
importance for health care applications. Notably, Ovadia et al. (2019)
conducted an extensive study of the quality of uncertainty estimates under
covariate shift, by artificially constructing corrupted OOD samples. We argue
that this procedure is insufficient to evaluate these techniques in a real-
world healthcare application: the generalization of performance to OOD
examples in an artificial scenario is no guarantee of robustness, especially
if the model in question is unable to detect OOD reliably. Inability to
recognize OOD could result in confident predictions on abnormal data points
for which the model actually under-performs.

We study the efficacy of a large array of uncertainty estimation methods for
OOD detection in the context of a binary classification task with clinical
significance, i.e. prediction of mortality for ICU patients, by running
experiments on two large mixed-type, highly unbalanced tabular data sets. We
provide three main contributions.111All code is publicly available under
https://github.com/Pacmed/ehr_ood_detection. First, we design a number of
clinically relevant OOD experiments, including scenarios for changing patient
population, variation of clinical protocol and data corruption. Second, we
show that all tested uncertainty estimation techniques for neural
discriminators fail to reliably detect OOD samples across experiments. Lastly,
we provide novel benchmarks for OOD detection on two large tabular medical
data sets.

##  2 Related Work

Uncertainty from a modelling perspective is often separated into aleatoric and
epistemic uncertainty. While the former usually refers to _non-reducible_
uncertainty, e.g. uncertainty inherent in the data generating process, the
latter denotes _reducible_ uncertainty. This encompasses both the lack of
knowledge about the ideal model for a problem, as well as about its best
parameters (Der Kiureghian and Ditlevsen, 2009; Hüllermeier and Waegeman,
2019). In our case, we are concerned with methods that try to estimate either
only the epistemic or both types of uncertainty in a post-hoc manner.

One method to appraise uncertainty estimation methods is the study of their
behaviour in presence of OOD samples (Ovadia et al., 2019). The topic of OOD
detection has been studied extensively; we present here a selection of
articles. A simple baseline for discriminators for the task was introduced by
Hendrycks and Gimpel (2017). Lee et al. (2018) fit a generative model on the
pre-softmax outputs of neural discriminators and employ the Mahalanobis
distance of data samples as a confidence metric. Jiang et al. (2018) employ
the distance between a sample and the next sample of another class as a non-
probabilistic trust score. Other articles use density estimation models
instead (Xiao et al., 2020; Choi et al., 2018), while some identify their
shortcomings when it comes to detecting OOD samples in the image domain
(Nalisnick et al., 2018; Kirichenko et al., 2020). Eduardo et al. (2020)
introduce a variant of the variational autoencoder for tabular data, which is
able to assign OOD scores to both single cells (i.e. features) and row entries
(i.e. whole data points) alike. A related line of work investigates the
phenomenon of covariate shift: Ovadia et al. (2019) conduct a large study to
analyze model calibration under increasing shift. Park et al. (2020) propose a
procedure to explicitly adapt models to shifting data distributions. There is
also some work in the medical context about this topic, with e.g. Curth et al.
(2019) deriving formal guarantees for domain adaptation procedures and testing
them on clinical data sets.

Given the importance of the reliability of models in a health care setting,
the application of such methods to tabular medical data sets constitutes
important related work. However, the literature on the topic is scarce. Myers
et al. (2020) introduce a model-independent reliability metric based on the
difference between the model’s prediction and predictions for patients of the
same class. Ruhe et al. (2019) and Meijerink et al. (2020) test different
models for mortality prediction on electronic health records, albeit with
limited experiments, while Dusenberry et al. (2020) also test models and their
uncertainty in predicting diagnoses. The latter work however restricts its
scope to only two types of models and does not evaluate uncertainty estimates
for novel patient groups.

##  3 Background

First of all, we lay out some relevant definitions and notations. Let
$p:\mathbb{R}^{D}\rightarrow[0,1]$ denote a probability density function from
which data samples $\vec{x}_{i}\in\mathbb{R}^{D}$ stem from and let
$p(\vec{x},y):\mathbb{R}^{D}\times\\{0,1\\}\rightarrow[0,1]$ denote the joint
distribution of points and labels with $y\in\\{0,1\\}$ in a binary
classification setting. We indicate with $\mathcal{D}$ the set of tuples
contained in a data set. We consider a data point out-of-distribution if its
underlying distribution $q$ underwent a _covariate shift_ relative to our
model’s training distribution $p$, namely if $p(\vec{x})$ and $q(\vec{x})$ are
different.222Other authors such as Shimodaira (2000) and Moreno-Torres et al.
(2012) give more restrictive definitions of covariate shift (e.g. assuming
$p(y|\vec{x})=q(y|\vec{x})$) that do not apply in our setting. Covariate shift
is especially prevalent in non-stationary environments (Moreno-Torres et al.,
2012), which abound in healthcare (Curth et al., 2019).

We consider the following metrics for OOD detection: the maximum softmax
probability baseline by Hendrycks and Gimpel (2017) and the standard deviation
of probabilities of class $1$ aggregated from multiple different sources, e.g.
different members of an ensembles or predictions produced under distinct sets
of weights samples from a posterior distribution. In these cases, we also
compute the predictive entropy (Gal, 2016) or mutual information (Smith and
Gal, 2018) across different predictions. Due to space limitations, we refer
the reader to Appendix A for a more in-depth explanation of these methods.

##  4 Methodology

We describe the experimental setup, the models employed and the evaluation
metrics.

###  4.1 Experimental Design

##### Mortality Prediction Task

As we are interested in testing the OOD-detection capabilities of models
trained on a clinically relevant classification task, we focused only on
prediction of in-hospital mortality based on the first $48$ hours of data from
intensive care admissions. This task has already been investigated extensively
as a relevant task for clinical prediction models (Sheikhalishahi et al.,
2019; Ruhe et al., 2019; Curth et al., 2019; Harutyunyan et al., 2019;
Meijerink et al., 2020) and provides a clear example of binary classification
with unbalanced outcome.

##### Clinical Data Sets

We performed experiments on the MIMIC-III data set (Johnson et al., 2016),
which comprises health data from ICU admissions from the Beth Israel Deaconess
Medical Center in Boston, Massachusetts. From the $46476$ patients and $61532$
ICU stays in the MIMIC-III data set, data points are selected based on patient
age ($\geq 18$ years) and length of stay ($\geq 48$ hours). Furthermore, stays
were excluded when there was no data in the first $48$ hours or when there
were multiple IC transfers within one hospital admission. After selection, the
cohort consisted of $21139$ IC stays corresponding to $18094$ patients, with a
mortality rate of $13.23\%$. We also employed the eICU data set (Pollard et
al., 2018), which contains ICU data from patients admitted to different
hospitals in the United States in 2014 and 2015. We pre-processed the data
using the general pipeline presented in the work of Sheikhalishahi et al.
(2019) and applied the same filtering criteria used for MIMIC-III, resulting
in $38072$ ICU stays, with one unique patient per stay and a mortality rate of
$12.53\%$.

##### Feature Engineering

To simplify our experimental pipeline and allow more direct comparisons
between the two data sets, we only keep clinical variables that were present
in both data sets (see appendix Table LABEL:tab:variable-names). We then
engineered features calculating six statistics on seven sub-sequences of a
time series, in line with the feature engineering for the logistic regression
model of Harutyunyan et al. (2019). The sub-sequences consist of the full time
series, the first $10\%$ and last $10\%$, the first and last $25\%$, and the
first and last $50\%$. The statistics are minimum, maximum, mean, standard
deviation, skew and the number of measurements, which were all standard-scaled
and mean-imputed if necessary, resulting in $588$ different features. In both
cases, the data sets were split into 70 $\%$ training, 15 $\%$ validation and
15 $\%$ test set.

##### Clinically Relevant OOD Groups

Using the help of medical professionals, we select clinically relevant patient
groups on both datasets. We first extract groups of patients based on age
(newborns for MIMIC-III333We were unable to identify enough newborns matching
our filter criteria in eICU.), on ethnicity (white, black) and on gender, to
test the model’s behavior under changing patient demographics. We also
separate patients by admission type (elective vs. emergency admissions) to
simulate change in protocol and according to diagnosis (acute and unspecified
renal failure, epilepsy, hypertension with complications and secondary
hypertension and thyroid disorders) as we also envision novel sets of symptoms
to emerge in patients in practice. To ensure that the resulting patients
groups are sufficiently different, we perform a feature-wise Welch’s t-test
and report the percentage of features that differ in a statistically
significant manner from the rest of the training set; the percentages are
reported in the plots of the results in Section 5.

###  4.2 Models

In the following, we briefly discuss the models and corresponding OOD
detection metrics used for our experiments. Due to space constraints we refer
to the cited papers for a more detailed description of the models.

##### Single Models

We consider different variations of a standard feed-forward neural network
with a final sigmoid activation function. Besides a normal network with ReLU
activation functions and intermediate dropout layers, we also consider a model
which was additionally calibrated with temperature scaling (Guo et al., 2017)
on the validation set. As uncertainty metrics, the model’s entropy over the
class distribution as well as its maximum softmax probability are considered.
We also add a logistic regression baseline.

##### Bayesian Models

We include models using MC Dropout (Gal and Ghahramani, 2016) and Bayes-by-
Backprop (BBB, Blundell et al., 2015). As uncertainty metrics, we consider the
standard deviation, their predictive entropy as well as their mutual
information. We also attempted to train Gaussian Processes as a Bayesian
baseline, but it could not scale to the size of the data set and did not
converge to useful solutions on subsets.

##### Ensemble Models

We furthermore investigate the performance of different ensemble models,
namely a group of standard feed-forward neural networks (Lakshminarayanan et
al., 2017), a bootstrapped ensemble, meaning that every member is trained on a
different (but not disjoint) subset of the data, as well as the anchored
bayesian ensembles introduced by Pearce et al. (2020). The same metrics are
employed as for the bayesian models.

##### Density Estimation Baselines

Lastly, we train two simple density estimation models: Probabilistic principal
component analysis (PPCA; Bishop, 1999), where we simply use the log-
probability of a sample as an indication of its novelty, as well as an auto-
encoder (AE). For the latter, its reconstruction error serves as uncertainty
metric, since we expect the model to reconstruct samples closer to the
training distribution in a more reliable way. Although AEs are not explicitly
estimating the data density, there is a known connection to PPCA as they
project samples into a latent space, albeit in a non-linear fashion (cp. e.g.
Valpola, 2015).

###  4.3 Model Training & Evaluation

Random hyperparameter search (Bergstra and Bengio, 2012) was performed for all
model types on MIMIC-III and eICU separately. The options considered, number
of trials and best found hyperparameters are reported in Appendix C. All
models were generally trained for at most $10$ epochs using the adam optimizer
(Kingma and Ba, 2014) and dropout (Srivastava et al., 2014) regularization,
with early stopping if the validation loss did not decrease after $3$ epochs.
Logistic regression was trained using $l_{2}$ regularization.

To evaluate all the models enumerated in the last section, we consider the
area under the receiver operating characteristic curve (AUC-ROC). In the case
of mortality prediction, AUC-ROC is used as a standard classification metric.
In the case of OOD detection, AUC-ROC is calculated for a classification task
in which the classes are in-distribution and out-of-distribution. Here, the
model is not evaluated based on its predicted class probabilities (about a
patient’s mortality), but rather on the uncertainty about its prediction. In
short, AUC-ROC is employed to measure whether uncertainty helps in
discriminating OOD samples.

##  5 Results

In this section we describe the main experimental findings on mortality
prediction and OOD detection.

###  5.1 Mortality Prediction

Before delving deeper into OOD detection, we compare the models’ performances
on the mortality prediction task, the results of which are given in Table 1.
Almost all models are able to solve the task well, achieving very similar
results across data sets. Neural models slightly outperform the logistic
regression baseline. One exception is the anchored ensemble, which seems to
perform slightly worse. We attribute this effect to the regularization
procedure using sampled anchored points, which might prevent ensemble members
to converge to the same local minimum. This seems to constitute a trade-off
between the bayesian guarantees and performance, which will become relevant
again in the following section. Furthermore, BBB performs considerably worse
than the other models while also displaying a comparatively high standard
deviation in results. We observed this even after an extensive hyperparameter
search (for details see Appendix C). We note that previous work applied BBB to
similar data sets, but either using less features (Ruhe et al., 2019) or more
homogeneous ones (MNIST in the case of Blundell et al., 2015); we hypothesize
that a mixture prior of only two gaussian distributions for the weights might
not be expressive enough to find a suitable weight distribution for the high
number and complexity of features we employ.444The sensitivity of variational
methods - including Bayes-by-Backprop - towards the choice of prior is part of
an ongoing discussion, refer e.g. to the blog post by Gelada and Buckman
(2020).

tab:mortality prediction  Model MIMIC eICU AnchoredNNEnsemble $0.837\pm 0.006$
$0.832\pm 0.004$ BBB $0.628\pm 0.081$ $0.611\pm 0.066$ BootstrappedNNEnsemble
$0.847\pm 0.000$ $0.847\pm 0.000$ LogReg $0.835\pm 0.000$ $0.823\pm 0.000$
MCDropout $0.849\pm 0.002$ $0.844\pm 0.001$ NNEnsemble $0.847\pm 0.000$
$0.847\pm 0.000$ NN $0.847\pm 0.002$ $0.842\pm 0.002$ PlattScalingNN $0.847\pm
0.002$ $0.844\pm 0.002$

Table 1: Mortality prediction AUC-ROC on MIMIC-III and eICU. Results are
averaged over $n=5$ runs.

###  5.2 OOD Experiments

fig:perturbation_eicu

Figure 1: Perturbation experiment results for eICU measured via the OOD
detection AUC-ROC. Scales are given on the y-axis, tested models and metrics
on the x-axis. Results are averaged over $n=100$ different, randomly selected
perturbed features.

We conduct a series of experiments to determine whether the presented
uncertainty estimation techniques are able to successfully detect OOD data. In
a clinical setting, a change in the patient population is often more complex
than the shift in a single feature, but it rather appears as a new
configuration of covariates. A model may encounter OOD examples for a variety
of reasons: a change in protocol that modifies the provenance of the patients,
an intrinsic shift in the patient population, or corruption in the data due to
machine or human error, to name a few. To simulate these scenarios we confront
our models with novel data obtained via three methods. First, data corruption:
we shift the data artificially, scaling one feature at a time by an
increasingly large degree. Second, changing patient population: some
clinically relevant patient groups (based on demographics, provenance or
pathology), are excluded from the training set and reintroduced later for
testing (such as in Meijerink et al., 2020). Third, changing data source: we
repeat the same procedure, but this time using patient stays from eICU as OOD
data for models trained on MIMIC-III, and vice versa.

####  5.2.1 Artificial Data Corruption

We investigate the ability of models to identify novel data points with
abnormal feature values. To simulate extreme or possibly corrupted feature
values, we scale features by a factor of $10$, $100$, $1000$ and $10000$. This
is achieved by selecting a single feature at random and scaling it by the
chosen factor across the whole test set. The corrupted test set and the
original one are then compared in terms of uncertainty using AUC-ROC, to check
whether uncertainty helps in identifying OODs. For each factor, we repeat this
procedure one hundred times per model, sampling without replacement the
feature to scale. We then report the average OOD detection AUC-ROC score on
these samples, which is depicted for eICU in Figure
LABEL:fig:perturbation_eicu; due to their similarity, the results for MIMIC-
III were moved to Figure LABEL:fig:perturbation_mimic in the appendix. In this
case, we would like to see the AUC-ROC increase as the scaling of a random
feature increases, i.e. the covariate of a sample becomes more and more
abnormal compared to the training distribution. However, we see quite the
opposite in most models regardless of the applied uncertainty estimation
technique, as AUC-ROC actually _decreases_ , resulting in scores much worse
than random guessing. In practice, this would result in a model being overly
confident in a prediction for a corrupt data point. The only notable
exceptions to this trend are AE and PPCA, which can be sorted into an entirely
different family of methods and, surprisingly, the anchored ensemble and BBB.

####  5.2.2 Clinical OOD Groups

fig:ood_mimic

Figure 2: OOD AUC-ROC score for different models and uncertainty metrics for
groups in the MIMIC-III data set. _size_ denoted the relative size of the OOD
group compared to the full training set, _diff_ the percentage of OOD features
that were different in a statistically significant manner compared to the
remaining training set, using a Welch’s t-test and $p<0.01$. Results are
averaged over $n=5$ runs.

Several articles testing OOD detection capabilities employ images from other
data sets as OOD samples (e.g. Pearce et al., 2020 or Kirichenko et al.,
2020). In these cases, the OOD property is constituted by a disjunct set of
class labels, e.g. when models are trained on MNIST digits but tested on
clothing items. We deem this to be an inapplicable methodology for our
predictive task, as it is very unlikely that new classes would be introduced
in a clinical binary classification problem. We thus use the clinically
relevant groups defined earlier, separate them from the training set and treat
them as OOD during inference, staying within the same classification
framework.

The results in Figure LABEL:fig:ood_mimic paint a discouraging
picture:555Results for eICU are displayed in Figure LABEL:fig:ood_eicu in the
appendix, while mortality prediction AUC-ROC scores for the OOD groups are
given in Figure LABEL:fig:ood-both-mortality. except for newborns in the
MIMIC-III data sets, which have the highest percentage of significantly
different features among all OOD groups, all models fail to discern in-
distribution from out-of-distribution samples. This even holds for AE and
PPCA. The difference between the model families is that density estimation
models do seem to struggle for many groups, but do not fail as spectacularly
as discriminators (see e.g. the “Elective admissions” group in Figure
LABEL:fig:ood_mimic).

####  5.2.3 Clinical data sets as OOD

fig:ood-da

Figure 3: OOD detection AUC-ROC for models trained on eICU and tested on
MIMIC-III (first row) and vice versa (second row). Results are averaged over
$n=5$ runs.

Lastly, we treat the whole of eICU as OOD examples for models trained on
MIMIC-III and vice versa. This is different from a domain adaptation problem
for mortality prediction, where we test the generalization of model
performance on data from a different source.666These results are given in tab.
LABEL:tab:da-mortality in the appendix. We are instead interested to see
whether models can identify the data as having a different origin. In the
medical domain, this is especially relevant, as e.g. changing hospital
protocols could have impact on patients’ covariates and therefore influence a
model’s prediction.

The results in Figure LABEL:fig:ood-da illustrate the intricacies of the
problem: again, the density estimation baselines perform best in both cases.
By plotting both data sets in the same feature space, it becomes apparent that
they are almost completely disjoint, exemplifying a clear case where
$p(\vec{x})\neq q(\vec{x})$ (see Figure LABEL:fig:eicu-mimic-manifold in the
appendix). Furthermore, this fact also underlines the importance of this issue
for medical applications: models trained on either data set might produce
unreliable results for patients originating from a different source, whence
the need to carefully assess the scaling of medical devices. In our case,
classification performance generalizes well across both data sets (see Table
LABEL:fig:ood-both-mortality in the appendix), however, there are documented
cases in the literature where this is not the case (Curth et al., 2019). There
are some notable exceptions in the MIMIC-III to eICU case, namely BBB and
anchored ensemble , but also some slightly improved scores in the case of the
bootstrapped ensemble and the MC Dropout model. Nonetheless, the fact that
these scores cannot be reproduced in the reverse case - eICU to MIMIC-III -
shows that these results cannot be seen as reliable but rather due to the
idiosyncrasies of the training data and contingent model weights.

##  6 Discussion

For several deep neural discriminators, we have demonstrated that the tested
uncertainty estimation methods do not detect OOD samples reliably on medical
tabular data. The intuition behind this shortcoming can be explained by the
toy example in Figure LABEL:fig:single_uncertainty: By separating the feature
space into potentially open-ended decision regions, neural discriminators will
create large areas with high confidence where no training data were observed,
making them prone to failure when presented with OOD samples. Every method
aggregating multiple predictions will only enlarge the areas with low
confidence due to the overlap of slightly different decision boundaries, but
is unlikely to remove this effect entirely and reliably. We did see a few
methods stand out in some experiments, but they were not able to do so
consistently. In particular, the BBB and anchored ensemble performed
comparatively well in the perturbation experiments.

For the latter model, we conjecture that this is due to the special
regularization, namely the $l_{2}$ distance to anchor points, which are
sampled in the beginning of the training. This seems to incentivize the
ensemble members to diversify,777Such a trade-off between diversity and
regularization has also been noted by the original authors in a follow-up work
(Pearce et al., 2018). an effect that we could also observe when comparing the
predictive entropy scores for normal and anchored ensembles on toy data (cp.
Figure LABEL:fig:compare-ensembles in the appendix). When different models
arrive at diverse solutions, their decision regions have less overlap,
creating areas where combined discordant predictions produce higher
uncertainty. A similar effect might be at play for BBB, although the diversity
that seems to enable the model to identify OODs is more likely due to
underfitting.888BBB generally struggled to converge during training, even
under various hyperparameter configurations (see Section 5 for further
discussion).

fig:single_uncertainty

Figure 4: Predictive entropy of a single neural classifier for a toy multi-
class classification problem.

For simple density-estimation models, many clinically-relevant patient groups
also seem to be hard to identify as OOD. This may be because said groups
appear to be interspersed with the remaining training population, even if a
lot of their feature values differ significantly (cp. Figure
LABEL:fig:eicu_elective_admissions in the appendix for the “elective
admissions” group in the eICU data set). An explanation could be that the
ability to distinguish samples probably does not only depend on the number of
differently distributed features, but also on the features themselves, as
models are likely learning to prioritize some features over others in terms of
importance. More powerful density-estimation models might be able to
distinguish these patients; it is an exciting direction for future work to
assess whether models such as the one presented in Eduardo et al. (2020),
which are tailored towards tabular data, or hybrid models, e.g. in the work of
Grathwohl et al. (2020), can achieve better OOD detection on such patient
groups.

Although the generalization capabilities of deep neural networks have been
hailed tremendously in the past - and often rightfully so - they might produce
a false sense of security in users for applications with critical outcomes.
This is why we advocate to put into context results like those of Ovadia et
al. (2019) or Smith and Gal (2018), which suggest that some of these models
are relatively robust under covariate shift. Such robustness was only shown in
a limited circumstances and does not imply the ability to _detect_ covariate
shift, as proven in this work. Our results should serve as a cautionary tale,
since a strong belief in robustness to OOD coupled with a failure in OOD
detection can cause serious problems in practice. We illustrate this with an
example. Consider the emergency/urgent admission group in MIMIC-III. The
models are barely as good as random guessing when trying to identify the group
as OOD. Moreover, the performance on mortality prediction for this group is
significantly worse than performance on general population or elective
admissions (mortality prediction AUC-ROC of $.71-.74$, see Figure
LABEL:fig:ood-both-mortality in the appendix). Thus, in a scenario in which
this group is OOD, the models in question would confidently give poor
predictions. Such a discrepancy would take a considerable time to detect in
practice – several OOD patients would have to be treated before realizing that
the performance of the model is declining – time in which the model’s
mispredictions could already produce harm.

As advocated by Thagaard et al. (2020), a more mindful application of
uncertainty estimation techniques is required, especially in safety-critical
domains such as health care. This work provides a suite of tests for OOD
detection to benchmark uncertainty estimation techniques on two large public
medical data sets; more investigation will be necessary to enable safe
applications.

## References

  * Bergstra and Bengio (2012) James Bergstra and Yoshua Bengio.  Random search for hyper-parameter optimization.  _The Journal of Machine Learning Research_ , 13(1):281–305, 2012.
  * Bishop (1999) Christopher M Bishop.  Bayesian pca.  In _Advances in neural information processing systems_ , pages 382–388, 1999.
  * Blundell et al. (2015) Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra.  Weight uncertainty in neural networks.  _arXiv preprint arXiv:1505.05424_ , 2015.
  * Choi et al. (2018) Hyunsun Choi, Eric Jang, and Alexander A Alemi.  Waic, but why? generative ensembles for robust anomaly detection.  _arXiv preprint arXiv:1810.01392_ , 2018.
  * Curth et al. (2019) Alicia Curth, Patrick Thoral, Wilco van den Wildenberg, Peter Bijlstra, Daan de Bruin, Paul Elbers, and Mattia Fornasa.  Transferring clinical prediction models across hospitals and electronic health record systems.  In _Joint European Conference on Machine Learning and Knowledge Discovery in Databases_ , pages 605–621. Springer, 2019.
  * Der Kiureghian and Ditlevsen (2009) Armen Der Kiureghian and Ove Ditlevsen.  Aleatory or epistemic? does it matter?  _Structural safety_ , 31(2):105–112, 2009.
  * Dusenberry et al. (2020) Michael W Dusenberry, Dustin Tran, Edward Choi, Jonas Kemp, Jeremy Nixon, Ghassen Jerfel, Katherine Heller, and Andrew M Dai.  Analyzing the role of model uncertainty for electronic health records.  In _Proceedings of the ACM Conference on Health, Inference, and Learning_ , pages 204–213, 2020.
  * Eduardo et al. (2020) Simao Eduardo, Alfredo Nazábal, Christopher KI Williams, and Charles Sutton.  Robust variational autoencoders for outlier detection and repair of mixed-type data.  In _International Conference on Artificial Intelligence and Statistics_ , pages 4056–4066, 2020.
  * Esteva et al. (2019) Andre Esteva, Alexandre Robicquet, Bharath Ramsundar, Volodymyr Kuleshov, Mark DePristo, Katherine Chou, Claire Cui, Greg Corrado, Sebastian Thrun, and Jeff Dean.  A guide to deep learning in healthcare.  _Nature medicine_ , 25(1):24–29, 2019.
  * Gal (2016) Yarin Gal.  Uncertainty in deep learning.  _University of Cambridge_ , 1(3), 2016.
  * Gal and Ghahramani (2016) Yarin Gal and Zoubin Ghahramani.  Dropout as a bayesian approximation: Representing model uncertainty in deep learning.  In _Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016_ , pages 1050–1059, 2016.  URL http://proceedings.mlr.press/v48/gal16.html.
  * Gelada and Buckman (2020) Carles Gelada and Jacob Buckman.  Bayesian neural networks need not concentrate.  https://jacobbuckman.com/2020-01-22-bayesian-neural-networks-need-not-concentrate/, 2020\.
  * Goodfellow et al. (2015) Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy.  Explaining and harnessing adversarial examples.  In _3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings_ , 2015.  URL http://arxiv.org/abs/1412.6572.
  * Grathwohl et al. (2020) Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, and Kevin Swersky.  Your classifier is secretly an energy based model and you should treat it like one.  In _8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020_ , 2020.  URL https://openreview.net/forum?id=Hkxzx0NtDB.
  * Guo et al. (2017) Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger.  On calibration of modern neural networks.  In _Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017_ , pages 1321–1330, 2017.  URL http://proceedings.mlr.press/v70/guo17a.html.
  * Harutyunyan et al. (2019) Hrayr Harutyunyan, Hrant Khachatrian, David C Kale, Greg Ver Steeg, and Aram Galstyan.  Multitask learning and benchmarking with clinical time series data.  _Scientific data_ , 6(1):1–18, 2019.
  * He et al. (2019) Jianxing He, Sally L Baxter, Jie Xu, Jiming Xu, Xingtao Zhou, and Kang Zhang.  The practical implementation of artificial intelligence technologies in medicine.  _Nature medicine_ , 25(1):30–36, 2019.
  * Hendrycks and Gimpel (2017) Dan Hendrycks and Kevin Gimpel.  A baseline for detecting misclassified and out-of-distribution examples in neural networks.  In _5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings_ , 2017.  URL https://openreview.net/forum?id=Hkg4TI9xl.
  * Hüllermeier and Waegeman (2019) Eyke Hüllermeier and Willem Waegeman.  Aleatoric and epistemic uncertainty in machine learning: A tutorial introduction.  _arXiv preprint arXiv:1910.09457_ , 2019.
  * Jiang et al. (2018) Heinrich Jiang, Been Kim, Melody Y. Guan, and Maya R. Gupta.  To trust or not to trust A classifier.  In _Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, 3-8 December 2018, Montréal, Canada_ , pages 5546–5557, 2018.  URL http://papers.nips.cc/paper/7798-to-trust-or-not-to-trust-a-classifier.
  * Johnson et al. (2016) Alistair EW Johnson, Tom J Pollard, Lu Shen, H Lehman Li-Wei, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark.  Mimic-iii, a freely accessible critical care database.  _Scientific data_ , 3(1):1–9, 2016.
  * Kingma and Ba (2014) Diederik P Kingma and Jimmy Ba.  Adam: A method for stochastic optimization.  _arXiv preprint arXiv:1412.6980_ , 2014.
  * Kirichenko et al. (2020) Polina Kirichenko, Pavel Izmailov, and Andrew Gordon Wilson.  Why normalizing flows fail to detect out-of-distribution data.  _arXiv preprint arXiv:2006.08545_ , 2020.
  * Lakshminarayanan et al. (2017) Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell.  Simple and scalable predictive uncertainty estimation using deep ensembles.  In _Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA_ , pages 6402–6413, 2017.  URL http://papers.nips.cc/paper/7219-simple-and-scalable-predictive-uncertainty-estimation-using-deep-ensembles.
  * Lee et al. (2018) Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin.  A simple unified framework for detecting out-of-distribution samples and adversarial attacks.  In _Advances in Neural Information Processing Systems_ , pages 7167–7177, 2018.
  * Meijerink et al. (2020) Lotta Meijerink, Giovanni Cinà, and Michele Tonutti.  Uncertainty estimation for classification and risk prediction in medical settings.  _arXiv preprint arXiv:2004.05824_ , 2020.
  * Moreno-Torres et al. (2012) Jose G Moreno-Torres, Troy Raeder, RocíO Alaiz-RodríGuez, Nitesh V Chawla, and Francisco Herrera.  A unifying view on dataset shift in classification.  _Pattern recognition_ , 45(1):521–530, 2012.
  * Myers et al. (2020) Paul D Myers, Kenney Ng, Kristen Severson, Uri Kartoun, Wangzhi Dai, Wei Huang, Frederick A Anderson, and Collin M Stultz.  Identifying unreliable predictions in clinical risk models.  _NPJ digital medicine_ , 3(1):1–8, 2020.
  * Nalisnick et al. (2018) Eric T. Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Görür, and Balaji Lakshminarayanan.  Do deep generative models know what they don’t know?  _CoRR_ , abs/1810.09136, 2018.  URL http://arxiv.org/abs/1810.09136.
  * Ovadia et al. (2019) Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek.  Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift.  In _Advances in Neural Information Processing Systems_ , pages 13991–14002, 2019.
  * Park et al. (2020) Sangdon Park, Osbert Bastani, James Weimer, and Insup Lee.  Calibrated prediction with covariate shift via unsupervised domain adaptation.  In _The 23rd International Conference on Artificial Intelligence and Statistics, AISTATS 2020, 26-28 August 2020, Online [Palermo, Sicily, Italy]_ , pages 3219–3229, 2020.  URL http://proceedings.mlr.press/v108/park20b.html.
  * Pearce et al. (2018) Tim Pearce, Nicolas Anastassacos, Mohamed Zaki, and Andy Neely.  Bayesian inference with anchored ensembles of neural networks, and application to exploration in reinforcement learning.  _arXiv preprint arXiv:1805.11324_ , 2018.
  * Pearce et al. (2020) Tim Pearce, Felix Leibfried, and Alexandra Brintrup.  Uncertainty in neural networks: Approximately bayesian ensembling.  In _International Conference on Artificial Intelligence and Statistics_ , pages 234–244, 2020.
  * Pollard et al. (2018) Tom J Pollard, Alistair EW Johnson, Jesse D Raffa, Leo A Celi, Roger G Mark, and Omar Badawi.  The eicu collaborative research database, a freely available multi-center database for critical care research.  _Scientific data_ , 5:180178, 2018.
  * Ruhe et al. (2019) David Ruhe, Giovanni Cina, Michele Tonutti, Daan de Bruin, and Paul Elbers.  Bayesian modelling in practice: Using uncertainty to improve trustworthiness in medical applications.  _International Conference on Machine Learning, 9-15 June 2019, Long Beach, California, USA, AI for Social Good Workshop_ , 2019.
  * Sheikhalishahi et al. (2019) Seyedmostafa Sheikhalishahi, Vevake Balaraman, and Venet Osmani.  Benchmarking machine learning models on multi-centre eicu critical care dataset, 2019.
  * Shimodaira (2000) Hidetoshi Shimodaira.  Improving predictive inference under covariate shift by weighting the log-likelihood function.  _Journal of statistical planning and inference_ , 90(2):227–244, 2000.
  * Smith and Gal (2018) Lewis Smith and Yarin Gal.  Understanding measures of uncertainty for adversarial example detection.  In _Proceedings of the Thirty-Fourth Conference on Uncertainty in Artificial Intelligence, UAI 2018, Monterey, California, USA, August 6-10, 2018_ , pages 560–569, 2018.  URL http://auai.org/uai2018/proceedings/papers/207.pdf.
  * Srivastava et al. (2014) Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov.  Dropout: a simple way to prevent neural networks from overfitting.  _The journal of machine learning research_ , 15(1):1929–1958, 2014.
  * Thagaard et al. (2020) Jeppe Thagaard, Søren Hauberg, Bert van der Vegt, Thomas Ebstrup, Johan D Hansen, and Anders B Dahl.  Can you trust predictive uncertainty under real dataset shifts in digital pathology?  In _23rd International Conference on Medical Image Computing and Computer Assisted Intervention,_ , 2020.
  * Valpola (2015) Harri Valpola.  From neural pca to deep unsupervised learning.  In _Advances in independent component analysis and learning machines_ , pages 143–171. Elsevier, 2015.
  * Xiao et al. (2020) Zhisheng Xiao, Qing Yan, and Yali Amit.  Likelihood regret: An out-of-distribution detection score for variational auto-encoder.  _arXiv preprint arXiv:2003.02977_ , 2020.

##  Appendix A Uncertainty metrics

In the following, we denote a neural network as a function
$p_{\operatorname*{\bm{\theta}}}:\mathbb{R}^{D}\rightarrow[0,1]$ parameterized
by a parameter vector $\operatorname*{\bm{\theta}}$. The baseline for OOD
detection introduced by Hendrycks and Gimpel (2017) involves reporting the
highest softmax probability across all classes:

$y_{\text{max}}=\max_{c\in C}p_{\operatorname*{\bm{\theta}}}(y=c|\vec{x}_{i})$

The underlying intuition is that the model would predict more uniform
distributions for samples with higher uncertainty, therefore producing a lower
$y_{\text{max}}$ score. The uncertainty estimation techniques we consider in
this work try to approximate the uncertainty by retrieving a set of $K$
predictions $p_{\operatorname*{\bm{\theta}}}^{(k)}(y|\vec{x}_{i})$ for a
sample $\vec{x}_{i}$ from either independently trained models in an ensemble,
multiple forward passes with different dropout masks or models with distinct
weights sampled from a (variational) posterior. These can then be aggregated
in different manners. One of the simplest ways in a binary classification
setting is to compute the standard deviation of the positive class:

$\sigma_{\mathcal{P}}=\mathbb{E}_{#1}\Big{[}p_{\operatorname*{\bm{\theta}}}(y=1|\vec{x}_{i})-\mathbb{E}_{#1}\big{[}p_{\operatorname*{\bm{\theta}}}(y=1|\vec{x}_{i})\big{]}\big{]}$

where
$\mathbb{E}_{#1}\big{[}p_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})\big{]}$
is commonly evaluated as a Monte-Carlo estimate using a set of model weights
$\mathcal{P}=\\{{\operatorname*{\bm{\theta}}_{1}},\ldots,{\operatorname*{\bm{\theta}}_{K}}\\}$
s.t.
$\frac{1}{K}\sum_{k=1}^{K}p_{\operatorname*{\bm{\theta}}}^{(k)}(y|\vec{x}_{i})\approx\mathbb{E}_{#1}\big{[}p_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})\big{]}$.
Thus, a high standard deviation can be interpreted as a large degree of
disagreement or uncertainty between classifiers. Another common metric is the
predictive entropy (Gal, 2016):

$\tilde{\mathbb{H}}[p_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})]=\mathbb{H}\Big{[}\mathbb{E}_{#1}\big{[}p_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})\big{]}\Big{]}$

where $\mathbb{H}$ denotes Shannon entropy. As the entropy is computed on the
averaged aggregated predictions, the entropy is low when probability mass is
distributed uniformly across all classes, implying that all predictions where
not able to single out a clear candidate class. Conversely, entropy is high
when all classifiers accumulate mass on a single class, showing a low degree
of uncertainty about the current sample. Lastly, we also consider mutual
information approximated as in Smith and Gal (2018):

$\mathbb{I}(y,{\operatorname*{\bm{\theta}}}|\vec{x}_{i})\approx\mathbb{H}\Big{[}\overline{p}_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})\Big{]}-\mathbb{E}_{#1}\Big{[}\mathbb{H}\big{[}p_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})\big{]}\Big{]}$

where
$\overline{p}_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})=\mathbb{E}_{#1}\big{[}p_{\operatorname*{\bm{\theta}}}(y|\vec{x}_{i})\big{]}$.
Intuitively, this is supposed to measure the information gain about the ideal
model parameters by receiving a label $y$. If the possible gain is low, that
means that current parameters are close to the optimal ones, demonstrating a
low uncertainty. While other metrics capture both aleatoric and epistemic
uncertainty of the model, approximate mutual information is exclusively
concerned with the latter.

##  Appendix B MIMIC-III and eICU Clinical Variables

tab:variable-names  Description MIMIC eICU Diastolic Blood Pressure Diastolic
blood pressure Invasive BP Diastolic Systolic Blood Pressure Systolic blood
pressure Invasive BP Systolic Fraction of inspired oxygen Fraction inspired
oxygen FiO2 Glasgow coma scale (verbal) Glasgow coma scale verbal response
Verbal Glasgow coma scale (eyes) Glasgow coma scale eyes opening Eyes Glasgow
coma scale (motor functions) Glasgow coma scale motor response Motor Glasgow
coma scale (total) Glasgow coma scale total GSC Total Blood glucose level
Glucose glucose Heart rate Heart Rate Heart Rate Mean arterial pressure Mean
blood pressure MAP (mmHg) Blood oxygen saturation Oxygen saturation O2
Saturation Respiratory rate Respiratory rate Respiratory Rate Body temperature
Temperature Temperature (C) Blood pH value pH pH

Table 2: Overview of all clinical variables used for the mortality prediction
task, including their names in the MIMIC-III and the eICU data set.

An overview of the used clinical features and their corresponding names in
MIMIC-III and eICU is given in Table LABEL:tab:variable-names. In all
experiments, only features engineered based on those variables were used.

##  Appendix C Hyperparameter Search

For the hyperparameter search, a random search procedure (Bergstra and Bengio,
2012) is employed, sampling hyperparameters for every run from scratch from
the options / distributions listed in Table LABEL:tab:hyperparameters-search-
space. Per data set, we test $40$ runs for the autoencoder, vanilla neural
network and MC Dropout model, while BBB receives a total of $60$ runs each. We
also test all configurations for C for logistic regression on both data sets.
The same hyperparameters found for the neural network model is then also used
for its platt-scaling variant and all the ensemble models. The prior scale
parameter $\lambda$ for the anchored ensemble (Pearce et al., 2020) is set to
$\sqrt{2/k}$, where $k$ refers to the number of rows of a weight matrix /
bias. The number of components for PPCA was set to $15$ for both data sets to
be comparable with the autoencoder. All models were trained exclusively on
CPU.

The best hyperparameters found (excluding the cases above where the same
hyperparameters were reused for similar models) are listed in Table
LABEL:tab:best_hyperparameters.

tab:best_hyperparameters  Model Hyperparameter Value MIMIC-III Value eICU AE
hidden_sizes $75$ $100$ AE latent_dim $15$ $15$ AE lr $0.006897$ $0.005216$
LogReg C $10$ $1000$ NN hidden_sizes $30$ $75$ NN dropout_rate $0.157483$
$0.381918$ NN lr $0.000538$ $0.000904$ MCDropout hidden_sizes $50$ $50$
MCDropout dropout_rate $0.333312$ $0.333312$ MCDropout lr $0.000526$
$0.000526$ BBB hidden_sizes $[25,25,25]$ $[30,30]$ BBB dropout_rate $0.177533$
$0.038759$ BBB lr $0.002418$ $0.002287$ BBB posterior_mu_init $0.22187$
$0.518821$ BBB posterior_rho_init $-5.982621$ $-4.475038$ BBB prior_pi
$0.233419$ $0.858602$ BBB prior_sigma_1 $0.740818$ $0.904837$ BBB
prior_sigma_2 $0.606531$ $0.67032$

Table 3: Best hyperparameters found on the MIMIC-III and eICU data set.

tab:hyperparameters-search-space  Hyperparameter Description Used in Chosen
from C Inverse $l_{2}$ regularization weight LogReg $\\{10,100,1000,10000\\}$
hidden_sizes Number / size of hidden layers All NN models, AE 1-4 layers of
either $25$, $30$, $50$, $75$, $100$ units latent_dim Dimensionality of latent
space AE $\\{5,10,15,20\\}$ lr Learning rate All models except PPCA
$\mathcal{U}(\log(10^{-4}),\log(0.1))$ dropout_rate Dropout rate All NN models
$\mathcal{U}(0,0.5)$ posterior_rho_init Variance parameter of weight
posterior(∗) BBB $\mathcal{U}(-8,-2)$ posterior_mu_init Mean parameter of
weight posterior(∗) BBB $\mathcal{U}(-0.6,0.6)$ prior_pi Mixture component of
prior(∗) BBB $\mathcal{U}(\exp(0.1),\exp(0.9))$ prior_sigma_1 Variance of
prior mixture component 1(∗) BBB $\mathcal{U}(\exp(-0.8),\exp(0.1))$
prior_sigma_2 Variance of prior mixture component 2(∗) BBB
$\mathcal{U}(\exp(-0.8),\exp(0.1))$

Table 4: Distributions or options that hyperparameters were sampled from
during the random hyperparameter search. (∗)For more information about these
hyperparameters the reader is referred to the work of Blundell et al. (2015).

##  Appendix D Additional Results

This section contains additional results and plots that were omitted due to
spatial constraints.

fig:eicu_elective_admissions

Figure 5: Plot of patients by elective admissions in eICU, projected into a
two-dimensional space using t-SNE.

fig:eicu-mimic-manifold

Figure 6: Joint plot of the eICU and MIMIC-III manifolds, projected into a
two-dimensional space using t-SNE.

tab:da-mortality  Model eICU $\rightarrow$ MIMIC MIMIC $\rightarrow$ eICU
AnchoredNNEnsemble $0.91\pm 0.00$ $0.88\pm 0.00$ BBB $0.66\pm 0.02$ $0.67\pm
0.03$ BootstrappedNNEnsemble $0.87\pm 0.00$ $0.87\pm 0.00$ LogReg $0.84\pm
0.00$ $0.86\pm 0.00$ MCDropout $0.87\pm 0.00$ $0.87\pm 0.00$ NNEnsemble
$0.87\pm 0.00$ $0.87\pm 0.00$ NN $0.87\pm 0.00$ $0.87\pm 0.00$ PlattScalingNN
$0.87\pm 0.00$ $0.87\pm 0.00$

Table 5: Mortality prediction AUC-ROC on the domain adaptation task. Results
are taken over $n=5$ runs.

fig:ood_eicu

Figure 7: OOD detection AUC-ROC for different models and metrics given pre-
defined groups in the eICU data set. _size_ denoted the relative size of the
OOD group compared to the full training set, _diff_ the percentage of OOD
features that were statistically significant compared to the remaining
training set, using a Welch’s t-test and $p<0.01$. Results are averaged over
$n=5$ runs.

fig:perturbation_mimic

Figure 8: Perturbation experiment results for MIMIC-III measured via the OOD
detection AUC-ROC. Scales are given on the y-axis, tested models and metrics
on the x-axis. Results are averaged over $n=100$ different, randomly selected
perturbed features.

fig:compare-ensembles

Figure 9: Comparing the predictive entropy scores across a feature space for a
multi-class toy example for a single neural discriminator (left), an ensemble
of discriminators (center) and an anchored ensemble (right; Pearce et al.
(2020)). While the single discriminator produces open regions with low
uncertainty even far away from the training data, this effect is somewhat
mitigated by ensembling, where overlapping slightly different decision
boundaries create regions of higher uncertainty. In the case of the anchored
ensemble, this effect is even more pronounced due to the diversity of ensemble
members.

fig:ood-both-mortality

Figure 10: Mortality prediction AUC-ROC scores for different OOD groups of the
MIMIC-III (left) and eICU (right) data set. Results are averaged over $n=5$
runs.