Smoothness and monotonicity constraints for neural networks using ICEnet
Deep neural networks have become an important tool for use in actuarial
tasks, due to the significant gains in accuracy provided by these techniques
compared to traditional methods, but also due to the close connection of these
models to the Generalized Linear Models (GLMs) currently used in industry.
Whereas constraining GLM parameters relating to insurance risk factors to be
smooth or exhibit monotonicity is trivial, methods to incorporate such
constraints into deep neural networks have not yet been developed. This is a
barrier for the adoption of neural networks in insurance practice since
actuaries often impose these constraints for commercial or statistical reasons.
In this work, we present a novel method for enforcing constraints within deep
neural network models, and we show how these models can be trained. Moreover,
we provide example applications using real-world datasets. We call our proposed
method ICEnet to emphasize the close link of our proposal to the individual
conditional expectation (ICE) model interpretability technique.
Ronald Richman, Mario Wüthrich
# Smoothness and monotonicity constraints for neural networks using ICEnet

###### Abstract

Deep neural networks have become an important tool for use in actuarial tasks, due to the significant gains in accuracy provided by these techniques compared to traditional methods, but also due to the close connection of these models to the Generalized Linear Models (GLMs) currently used in industry. Whereas constraining GLM parameters relating to insurance risk factors to be smooth or exhibit monotonicity is trivial, methods to incorporate such constraints into deep neural networks have not yet been developed. This is a barrier for the adoption of neural networks in insurance practice since actuaries often impose these constraints for commercial or statistical reasons. In this work, we present a novel method for enforcing constraints within deep neural network models, and we show how these models can be trained. Moreover, we provide example applications using real-world datasets. We call our proposed method _ICEnet_ to emphasize the close link of our proposal to the individual conditional expectation (ICE) model interpretability technique.

**Keywords.** Smoothing, Whittaker-Henderson Smoothing, Graduation, Monotonicity, Deep Neural Networks, Constrained Likelihood, Individual Conditional Expectation

## 1 Introduction

Deep neural networks have recently emerged as a promising technique for use in tasks across the various traditional disciplines of actuarial science, including pricing, reserving, experience analysis and mortality forecasting. Moreover, deep learning has been applied in emerging areas of actuarial practice, such as analysis of telematics data, natural language processing and image recognition. These techniques provide significant gains in accuracy compared to traditional methods, while the close connection of these models to the Generalized Linear Models (GLMs) currently used in industry enable easier understanding of these models for classically trained actuaries than other machine learning paradigms such as boosted trees.

On the other hand, one seeming disadvantage of neural network models is that the output from these models may exhibit undesirable characteristics for actuarial purposes. A first issue is that predictions may vary in a rough manner with changes in insurance risk factors. In some contexts, such as general insurance pricing, this may be problematic to explain to customers,
intermediaries or other stakeholders, or may indicate problems with data credibility. For example, consider a general insurance pricing model that uses driver age as a risk factor. Usually, from a commercial perspective, as a customer ages, it is expected that her insurance rates would change smoothly, however, unconstrained output from neural networks may produce rates that vary roughly with age. It is difficult to explain to customers why rates might increase one year, then decrease the next, and, moreover, extra costs might arise from needing to address these types of queries. A second issue is that actuaries often wish to constrain predictions from models to increase (or decrease) in a monotonic manner with some risk factors, for example, increasing sums insured should lead, other things being equal, to higher average costs per claim and worsening bonus-malus scores should imply higher expected frequencies of claims. Whereas constraining GLM parameters relating to insurance risk factors to be smooth or exhibit monotonicity is trivial, since the coefficients of GLMs can be modified directly, methods to introduce these constraints into deep neural networks have not yet been developed. Thus, a significant barrier for the adoption of neural networks in practice exists.

Typical practice when manually building actuarial models is that actuaries will attempt to enforce smoothness or monotonicity constraints within models by modifying model structure or coefficients manually, as mentioned before, by applying relevant functional forms within models, such as parametric functions, regularization or by applying post-hoc smoothing techniques; we mention, e.g., Whittaker-Henderson smoothing (Whittaker, 1922; Henderson, 1924) which adds regularization to parameters. In the case of GLMs for general insurance pricing, the simple linear structure of these models is often exploited by, firstly, fitting an unconstrained GLM, then specifying some simplifications whereby coefficients are forced to follow the desired functional form or meet a smoothness criteria. In more complex models, such as neural networks, operating directly on model coefficients or structure is less feasible.

To overcome this challenge, here we present methods for enforcing smoothness and monotonicity constraints within deep neural network models. The key idea can be summarized as follows: as a first step insurance risk factors that should be constrained are identified, then, the datasets used for model fitting are augmented to produce pseudo-data that reflect the structure of the identified variables. In the next step, we design a multi-input/multi-output neural network that can process jointly the original observation as well as the pseudo-data. Finally, a joint loss function is used to train the network to make accurate predictions while enforcing the desired constraints on the pseudo-data. We show how these models can be trained and provide example applications using a real-world general insurance pricing dataset.

The method we propose can be related to the Individual Conditional Expectation (ICE) model interpretability technique of Goldstein et al. (2015), therefore, we call our proposal the _ICEnet_, to emphasize this connection. To enable the training of neural networks with constraints, the ICEnet structures networks to output a vector of predictions derived from the pseudo-data input to the network; these predictions derived from the network for the key variables of interest on the pseudo-data are exactly equivalent to the outputs used to derive an ICE plot. The selected constraints then constrain these ICEnet outputs from the network to be as smooth or monotonic as required. For this purpose, we will use Fully Connected Networks (FCNs) with embedding layers for categorical variables to perform supervised learning, and, in the process, create the ICEnet outputs for the variables of interest.

**Literature review.** Practicing actuaries have often smoothed results of experience analyses in
both general and life insurance, usually on the assumption that outputs of models that do not exhibit smoothness are anomalous. For example, Goldburd et al. (2016) and Anderson et al. (2007) discuss manual smoothing methods in the context of general insurance pricing with GLMs. In life insurance, two main types of techniques are used to graduate (i.e. smooth) mortality tables; in some jurisdictions, such as the United Kingdom and South Africa, combinations of polynomial functions have often been used to fit mortality data directly, see, for example, Forfar et al. (1987), whereas post-hoc smoothing methods such as Whittaker-Henderson smoothing (Whittaker, 1922; Henderson, 1924) have often been used in the United States. The use of splines and Generalized Additive Models (GAMs) have also been considered for these purposes, see Goldburd et al. (2016) in the context of general insurance and Debon et al. (2006) in the context of mortality data.

More recently, penalized regression techniques have been utilized for variable selection and categorical level fusion for general insurance pricing. These are often based on the Least Absolute Shrinkage and Selection Operator (LASSO) regression of Tibshirani (1996) and its extensions (Hastie et al., 2015); here we mention the fused LASSO which produces model coefficients that vary smoothly, see Tibshirani et al. (2005), which is particularly useful for deriving smoothly varying models for ordinal categorical data. In the actuarial literature, example applications of the constrained regression approach are Devriendt et al. (2021), who propose an algorithm for incorporating multiple penalties for complex general insurance pricing data and Henckaerts et al. (2018), who provide a data-driven binning approach designed to produce GLMs which closely mirror smooth GAMs.

Within the machine and deep learning literature, various methods for enforcing monotonicity constraints within Gradient Boosting Machines (GBM) and neural network models have been proposed. Monotonicity constraints are usually added to GBMs by modifying the process used to fit decision trees when producing these models; an example of this can be found in the well-known XGBoost library of Chen and Guestrin (2016). Since these constraints are implemented specifically by modifying how the decision trees underlying the GBM are fit to the data, the same process cannot be applied for neural network models. Within the deep learning literature, monotonicity constraints have been addressed by constraining the weights of neural networks to be positive, see, for example, Sill (1997) and Daniels and Velikova (2010), who generalize the earlier methods of Sill (1997), or by using specially designed networks, such as the lattice networks of You et al. (2017). In the finance literature, Kellner et al. (2022) proposes a method to ensure monotonicity of multiple quantiles output from a neural network, by adding a monotonicity constraint to multiple outputs from the network; this idea is similar to what we implement below. Another approach to enforcing monotonicity involves post-processing the outputs of machine learning models with a different algorithm, such as isotonic regression; see Wuthrich and Ziegel (2023) for a recent application of this to ensure that outputs of general insurance pricing models are autocalibrated.

On the other hand, the machine and deep learning literature seemingly has not addressed the issue of ensuring that predictions made with these models vary smoothly, and, moreover, the methods proposed within the literature for monotonicity constraints cannot be directly applied to enforce smoothness constraints. Thus, the ICEnet proposal of this work, which adds flexible penalties to a specially designed neural network, fills a gap in the literature by showing how both monotonicity and smoothness constraints can be enforced with the same method in deep
learning models.

**Structure of the manuscript.** The rest of the manuscript is structured as follows. Section 2 provides notation and discusses neural networks and machine learning interpretability. Section 3 defines the ICEnet, which is applied to the French Motor Third Party Liability data in Section 4. A local approximation to the ICEnet is presented in Section 5. Discussion of the results and conclusions are given in Section 6. The supplementary provides the code and further numerical analysis of the ICEnet.

## 2 Neural networks and Individual Conditional Expectations

We begin by briefly introducing supervised learning with neural networks, expand these definitions to FCNs using embedding layers and discuss their training process. With these building blocks, we then present the ICEnet proposal in the next section.

### Supervised learning and neural networks

We work in the usual setup of supervised learning. Independent observations \(y_{n}\in\mathbb{R}\) of a variable of interest have been made for instances (insurance policies) \(1\leq n\leq N\). In addition, covariates \(\mathbf{x}_{n}\) have been collected for all instances \(1\leq n\leq N\). These covariates can be used to create predictions \(\widehat{y}_{n}\in\mathbb{R}\) of the variable of interest. In what follows, note that we drop the subscript from \(\mathbf{x}_{n}\) for notational convenience. The covariates in \(\mathbf{x}\) are usually of two main types in actuarial tasks: the first of these are real-valued covariates \(\mathbf{x}^{[r]}\in\mathbb{R}^{q_{r}}\), where the superscript \([\cdot]\) represents the subset of the vector \(\mathbf{x}\), \(r\) is the set of real-valued covariates and where there are \(q_{r}\) real-valued variables. The second type of covariates are categorical, which we assume have been coded as positive integers; we represent these as \(\mathbf{x}^{[c]}\in\mathbb{N}^{q_{c}}\), where the set of categorical covariates is \(c\). Thus, \(\mathbf{x}=(\mathbf{x}^{[r]},\mathbf{x}^{[c]})\). In actuarial applications, often predictions are proportional to a scalar unit of exposure \(v_{n}\in\mathbb{R}^{+}\), thus, each observation is a tensor \((y,\mathbf{x}^{[r]},\mathbf{x}^{[c]},v)\in\mathbb{R}\times\mathbb{R}^{q_{r}}\times \mathbb{N}^{q_{c}}\times\mathbb{R}^{+}\). In this work, we will use deep neural networks, which are efficient function approximators, for predicting \(y\). We represent the general class of neural networks as \(\Psi_{W}(\mathbf{x})\), where \(W\) are the network parameters (weights and biases). Using these, we aim to study the regression function

\[\Psi_{W}:\mathbb{R}^{q_{r}}\times\mathbb{N}^{q_{c}}\rightarrow\mathbb{R}, \qquad\mathbf{x}\ \mapsto\ \widehat{y}=\Psi_{W}(\mathbf{x})\,v.\]

We follow Chapter 7 of Wuthrich and Merz (2023) for the notation defining neural networks. Neural networks are machine learning models constructed by composing non-linear functions (called layers) operating on the vector \(\mathbf{x}\), which is the input to the network. A network consisting of only a single layer of non-linear functions has depth \(d=1\), and is called a shallow network. More complex networks consisting of multiple layers with depth \(d\geq 2\) are called deep networks. We denote the \(i\)-th layer by \(\mathbf{z}^{(i)}\). These non-linear functions (layers) transform the input variables \(\mathbf{x}\) into new representations, which are optimized to perform well on the supervised learning task, using a process called representation learning. Representation learning can be denoted as the composition

\[\mathbf{x}\ \mapsto\ \mathbf{z}^{(d:1)}(\mathbf{x})\ \stackrel{{\text{\tiny def }}}{{=}}\ \left(\mathbf{z}^{(d)}\circ\cdots\circ\mathbf{z}^{(1)}\right)(\mathbf{x})\ \in\ \mathbb{R}^{q_{d}},\]
where \(d\in\mathbb{N}\) is the number of layers \(\mathbf{z}^{(i)}\) of the network and \(q_{i}\in\mathbb{N}\) are the dimensions of these layers for \(1\leq i\leq d\). Thus, each layer \(\mathbf{z}^{(i)}:\mathbb{R}^{q_{i-1}}\to\mathbb{R}^{q_{i}}\) transforms the representation at the previous stage to a new, modified representation.

FCNs define the \(j\)-th component (called neuron or unit) of each layer \(\mathbf{z}^{(i)}\), \(1\leq j\leq q_{i}\), as the mapping

\[\mathbf{z}=(z_{1},\ldots,z_{q_{i-1}})^{\top}\in\mathbb{R}^{q_{i-1}}\quad\mapsto \quad z_{j}^{(i)}(\mathbf{z})=\phi\left(\sum_{k=1}^{q_{i-1}}w_{j,k}^{(i)}z_{k}+b_{ j}^{(i)}\right), \tag{2.1}\]

for a non-linear activation function \(\phi:\mathbb{R}\to\mathbb{R}\), and where \(z_{j}^{(i)}(\cdot)\) is the \(j\)-th component of layer \(\mathbf{z}^{(i)}(\cdot)\), \(w_{j,k}^{(i)}\in\mathbb{R}\) is the regression weight of this \(j\)-th neuron connecting to the \(k\)-th neuron of the previous layer, \(z_{k}=z_{k}^{(i-1)}\), and \(b_{j}^{(i)}\in\mathbb{R}\) is the intercept or bias for the \(j\)-th neuron in layer \(\mathbf{z}^{(i)}\). It can be seen from (2.1) that the neurons \(z_{j}^{(i)}(\cdot)\) of a FCN connect to all of the neurons \(z_{k}^{(i-1)}(\cdot)\) in the previous layer \(\mathbf{z}^{(i-1)}\) through the weights \(w_{j,k}^{(i)}\), explaining the description of these networks as "fully-connected".

Combining these layers, a generic FCN regression function can be defined as follows

\[\mathbf{x}\ \mapsto\ \Psi_{W}(\mathbf{x})\ \overset{\text{\tiny def}}{=}\ g^{-1} \left(\sum_{k=1}^{q_{d}}w_{k}^{(d+1)}z_{k}^{(d:1)}(\mathbf{x})+b^{(d+1)}\right), \tag{2.2}\]

where \(g^{-1}(\cdot)\) is a suitably chosen inverse link function that transforms the outputs of the network to the scale of the observations \(y\). The notation \(W\) in \(\Psi_{W}(\mathbf{x})\) indicates that we collect all the weights \(w_{j,k}^{(i)}\) and biases \(b_{j}^{(i)}\) in \(W\), giving us a network parameter of dimension \((q_{d}+1)+\sum_{i=1}^{d}(q_{i-1}+1)q_{i}\), where \(q_{0}\) is the dimension of the input \(\mathbf{x}\).

For most supervised learning applications in actuarial work, a neural network of the form (2.1)-(2.2) is applied to the covariate \(\mathbf{x}\) to create a single prediction \(\widehat{y}=\Psi_{W}(\mathbf{x})v\). Below, we will define how the same network \(\Psi_{W}(\cdot)\) can be applied to a vector of observations to produce multiple predictions, which will be used to constrain the network.

State-of-the-art neural network calibration is performed using a Stochastic Gradient Descent (SGD) algorithm, performed on mini-batches of observations. To calibrate the network, an appropriate loss function \(L(\cdot,\cdot)\) must be selected. For general insurance pricing, the loss function is often the deviance loss function of an exponential-family distribution, such as the Poisson distribution for frequency modelling or the Gamma distribution for severity modelling. For more details on the SGD procedure, we refer to Goodfellow et al. (2016), and for a detailed explanation of exponential-family modelling for actuarial purposes see Chapters 2 and 4 of Wuthrich and Merz (2023).

### Pre-processing covariates for FCNs

For the following, we assume that the \(N\) instances of \(\mathbf{x}_{n}\), \(1\leq n\leq N\), have been collected into a matrix \(X=[X^{[r]},X^{[c]}]\in\mathbb{R}^{N\times(q_{r}+q_{c})}\), where \(X^{[\cdot]}\) represents a subset of the columns of \(X\). Thus, to select the \(j\)-th column of \(X\), we write \(X^{[j]}\) and, furthermore, to represent the \(n\)-th row of \(X\), we will write \(X_{n}=\mathbf{x}_{n}\). We also assume that all of the observations of \(y_{n}\) have been collected into a vector \(\mathbf{y}=(y_{1},\ldots,y_{N})^{\top}\in\mathbb{R}^{N}\).
#### 2.2.1 Categorical covariates

The types of categorical data comprising \(X^{[c]}\) are usually either qualitative (nominal) data with no inherent ordering, such as type of motor vehicle, or ordinal data with an inherent ordering, such as bad-average-good driver. Different methods for pre-processing categorical data for use within machine learning methods have been developed, with one-hot encoding being a popular choice for traditional machine learning methods. Here, we focus on the categorical embedding technique (entity embedding) of Guo and Berkhahn (2016); see Richman (2021) and Delong and Kozak (2023) for a brief overview of other options and an introduction to embeddings. Assume that the \(t\)-th categorical variable, corresponding to column \(X^{[c_{t}]}\), for \(1\leq t\leq q_{c}\), can take one of \(K_{t}\geq 2\) values in the set of levels \(\{a_{1}^{t},\ldots,a_{K_{t}}^{t}\}\). An embedding layer for this categorical variable maps each member of the set to a low-dimensional vector representation of dimension \(b_{t}<K_{t}\), i.e.,

\[\mathbf{e}:\{a_{1}^{t},\ldots,a_{K_{t}}^{t}\}\rightarrow\mathbb{R}^{b_{t}},\qquad a _{k}^{t}\ \mapsto\ \mathbf{e}(a_{k}^{t})\stackrel{{\text{\tiny def}}}{{=}}\mathbf{e}^{t(k)}, \tag{2.3}\]

meaning to say that the \(k\)-th level \(a_{k}^{t}\) of the \(t\)-th categorical variable receives a low dimensional vector representation \(\mathbf{e}^{t(k)}\in\mathbb{R}^{b_{t}}\). When utilizing an embedding layer within a neural network, we calibrate the \(K_{t}b_{t}\) parameters of the embedding layer as part of fitting the weights \(W\) of the network \(\Psi_{W}(\mathbf{x})\). Practically, when inputting a categorical covariate to a neural network, each level of the covariate is mapped to a unique natural number, thus, we have represented these covariates as \(\mathbf{x}^{[c]}\in\mathbb{N}^{q_{c}}\), and these represenations are then embedded according (2.3) which can be interpreted as an additional layer of the network; this is graphically illustrated in Figure 7.9 of Wuthrich and Merz (2023).

#### 2.2.2 Numerical covariates

To enable the easy calibration of neural networks, numerical covariates must be scaled to be of similar magnitudes. In what follows, we will use the min-max normalization, where each raw numerical covariate \(\dot{X}^{[r_{t}]}\) is scaled to

\[X^{[r_{t}]}=\frac{\dot{X}^{[r_{t}]}-\min(\dot{X}^{[r_{t}]})}{\max(\dot{X}^{[r_ {t}]})-\min(\dot{X}^{[r_{t}]})},\]

where \(\dot{X}^{[r_{t}]}\) is \(t\)-th raw (i.e., unscaled) continuous covariate and the operation is performed for each element of column \(\dot{X}^{[r_{t}]}\) of the matrix of raw continuous covariates, \(\dot{X}^{[r]}\).

We note that the continuous data comprising \(\dot{X}^{[r]}\) can also easily be converted to ordinal data through binning, for example, by mapping each observed covariate in the data to one of the quantiles of that covariate. We do not consider this option for processing continuous variables in this work, however, we will use quantile binning to discretize the continuous covariates \(X^{[r]}\) for the purpose of estimating the ICEnets used here.

### Individual Conditional Expectations and Partial Dependence Plots

Machine learning interpretability methods are used to explain how a machine learning model, such as a neural network, has estimated the relationship between the covariates \(\mathbf{x}\) and the predictions \(\widehat{y}\); for an overview of these, see Biecek and Burzykowski (2021). Two related methods for interpreting machine learning models are the Partial Dependence Plot (PDP) of Friedman (2001) and the Individual Conditional Expectations (ICE) method of Goldstein et al. (2015).
The ICE method estimates how the predictions \(\widehat{y}_{n}\) for each instance \(1\leq n\leq N\) change as a single component of the covariates \(\mathbf{x}_{n}\) is varied over its observed range of possible values, while holding all of the other components of \(\mathbf{x}_{n}\) constant. The PDP method is simply the average over all of the individual ICE outputs of the instances \(1\leq n\leq N\) derived in the previous step. By inspecting the resultant ICE and PDP outputs, the relationship of the predictions with a single component of \(\mathbf{x}\) can be observed; by performing the same process for each component of \(\mathbf{x}\), the relationships with all of the covariates can be shown.

To estimate the ICE for a neural network, we now consider the creation of pseudo-data that will be used to create the ICE output of the network. We consider one column of \(X\), denoted as \(X^{[j]}\), \(1\leq j\leq q_{r}+q_{c}\). If the selected column \(X^{[j]}\) is categorical, then, as above, the range of values which can be taken by each element of \(X^{[j]}\) are simply the values in the set of levels \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\).

If the selected column \(X^{[j]}\) is continuous, then we assume that a range of values for the column has been selected using quantile binning or another procedure, and we denote the set of these values using the same notation, i.e., \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\), where \(K_{j}\in\mathbb{N}\) is the number of selected values \(a_{u}^{j}\in\mathbb{R}\) and where we typically assume that the continuous variables in \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\) are ordered in increasing order.

We define \(\tilde{X}^{[j]}(u)\) as a copy of \(X\), where all of the components of \(X\) remain the same, except for the \(j\)-th column of \(X\), which is set to the \(u\)-th value of the set \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\), \(1\leq u\leq K_{j}\). By sequentially creating predictions using a (calibrated) neural network applied to the pseudo-data, \(\Psi_{W}(\tilde{X}^{[j]}(u))\) (where the network is applied in a row-wise manner), we are able to derive the ICE outputs for each variable of interest, as we vary the value of \(1\leq u\leq K_{j}\). In particular, by allowing \(a_{u}^{j}\) to take each value in the set \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\), for each instance \(1\leq n\leq N\) separately, we define the ICE for covariate \(j\) as a vector of predictions on the artificial data, \(\widetilde{\mathbf{y}}_{n}^{[j]}\), as

\[\widetilde{\mathbf{y}}_{n}^{[j]}=\left[\Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(1))v_{n},\ldots,\Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(K_{j}))v_{n}\right], \tag{2.4}\]

where \(\tilde{\mathbf{x}}_{n}^{[j]}(u)\) represents the vector of covariates for instance \(n\), where the \(j\)-th entry has been set equal to the \(u\)-th value \(a_{u}^{j}\) of that covariate, which is contained in the appropriate set \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\).

The PDP can then be derived from (2.4) by averaging the ICE outputs over all instances. We set

\[\widehat{\mathbb{E}}[\widetilde{\mathbf{y}}_{n}^{[j]}]=\left[\frac{\sum_{n=1}^{N} \Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(1))v_{n}}{N},\ldots,\frac{\sum_{n=1}^{N} \Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(K_{j}))v_{n}}{N}\right]. \tag{2.5}\]

This can be interpreted as an empirical average, averaging over all instances \(1\leq n\leq N\).

## 3 ICEnet

### Description of the ICEnet

We start with a colloquial description of the ICEnet proposal before defining it rigorously. The main idea is to augment the observed data \((y_{n},\mathbf{x}_{n},v_{n})_{n=1}^{N}\) with pseudo-data, so that output equivalent to that used for the ICE interpretability technique (2.4) is produced by the network, for each variable that requires a smoothness or monotonicity constraint. This is done be creating pseudo-data that varies for each possible value of the variables to be constrained. For continuous variables, we use quantiles of the observed values of the continuous variables to produce the ICE
output while, for categorical variables, we use each level of the categories. The same neural network is then applied to the observed data, as well as each of the pseudo-data. Applying the network to the actual observed data produces a prediction that can be used for pricing, whereas applying the network to each of the pseudo-data produces outputs which vary with each of the covariates which need smoothing or require monotonicity to be enforced. The parameters of the network are trained (or fine-tuned) using a compound loss function: the first component of the loss function measures how well the network predicts the observations \(y_{n}\), \(1\leq n\leq N\). The other components ensure that the desired constraints are enforced on the ICEs for the constrained variables. After training, the progression of predictions of the neural network will be smooth or monotonically increasing with changes in the constrained variables. A diagram of the ICEnet is shown in Figure 1.

### Definition of the ICEnet

To define the ICEnet, we assume that some of the variables comprising the covariates \(X\in\mathbb{R}^{N\times(q_{r}+q_{c})}\) have been selected as requiring smoothness and monotonicity constraints. We collect all those variables requiring smoothness constrains into a set \(\mathcal{S}\subset\{1,\ldots,q_{r}+q_{c}\}\) with \(S\) members of the set and those variables requiring monotonicity constraints into another set \(\mathcal{M}\subset\{1,\ldots,q_{r}+q_{c}\}\), with \(M\) members of the set. As we have discussed above, we will rely on FCNs with appropriate pre-processing of the input data \(\mathbf{x}\) for predicting the response \(y\) with \(\widehat{y}\). For each instance \(n\in\{1,\ldots,N\}\), the ICEnet is comprised of two main parts. The first of these is simply a prediction \(\widehat{y}_{n}=\Psi_{W}(\mathbf{x}_{n})v_{n}\) of the outcome \(y_{n}\) based on covariates \(\mathbf{x}_{n}\). For the second part of the ICEnet, we now will create the pseudo-data using the definitions from Section 2.3 that will be used to create the ICE output of the network for each of the columns requiring constraints. Finally, we assume that the ICEnet will be trained with a compound loss function \(L\), that balances the good predictive performance of the predictions \(\widehat{y}_{n}\) together with satisfying constraints to enforce smoothness and monotonicity.

The compound loss function \(L\) of the ICEnet consists of three summands, i.e., \(L=L_{1}+L_{2}+L_{3}\). The first of these is set equal to the deviance loss function \(L^{D}\) that is relevant for the considered regression problem, i.e., \(L_{1}\stackrel{{\mbox{\tiny{set}}}}{{=}}L^{D}(y_{n},\widehat{y} _{n})\).

The second of these losses is a smoothing constraint applied to each covariate in the set \(\mathcal{S}\). For smoothing, actuaries have often used the Whittaker-Henderson smoother (Whittaker, 1922; Henderson, 1924), which we implement here as the square of the third difference of the predictions \(\widetilde{\mathbf{y}}_{n}^{[j]}\) given in (2.4). We define the difference operator of order 1 as

\[\Delta^{1}(\Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(u)))=\Psi_{W}(\tilde{\mathbf{x}}_{n} ^{[j]}(u))-\Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(u-1)),\]

and the difference operator of a higher order \(\tau\geq 1\) recursively as

\[\Delta^{\tau}(\Psi_{W}(\tilde{\mathbf{x}}_{n}^{[j]}(u)))=\Delta^{\tau-1}(\Psi_{W} (\tilde{\mathbf{x}}_{n}^{[j]}(u)))-\Delta^{\tau-1}(\Psi_{W}(\tilde{\mathbf{x}}_{n}^{[ j]}(u-1))).\]

Thus, the smoothing loss \(L_{2}\) for order 3 is defined as

\[L_{2}(n)\,\stackrel{{\mbox{\tiny{def}}}}{{=}}\sum_{j\in\mathcal{ S}}\sum_{u=4}^{K_{j}}\lambda_{s_{j}}\left[\Delta^{3}(\Psi_{W}(\tilde{\mathbf{x}}_{n}^ {[j]}(u)))\right]^{2}, \tag{3.1}\]

where \(\lambda_{s_{j}}\geq 0\) is the penalty parameter for the smoothing loss for the \(j\)-th member of the set \(\mathcal{S}\).
Finally, to enforce monotonicity, we add the absolute value of the negative components of the first difference of \(\widetilde{\mathbf{y}}_{n}^{[j]}\) to the loss, i.e., we define \(L_{3}\) as:

\[L_{3}(n)\,\stackrel{{\text{\tiny def}}}{{=}}\,\sum_{j\in\mathcal{M} }\sum_{u=2}^{K_{j}}\lambda_{m_{j}}\max\left[\delta_{j}\Delta^{1}(\Psi_{W}( \tilde{\mathbf{x}}_{n}^{[j]}(u))),0\right], \tag{3.2}\]

where \(\lambda_{m_{j}}\geq 0\) is the penalty parameter for the smoothing loss for the \(j\)-th member of the set

Figure 1: Diagram explaining the ICEnet. The same neural network \(\Psi_{W}\) is used to produce both the predictions from the model, as well as to create predictions based on pseudo-data. These latter predictions are constrained, ensuring that the outputs of the ICEnet vary smoothly or monotonically with changes in the input variables \(\mathbf{x}\). In this graph, we are varying variable \(x_{1}\) to produce the ICEnet outputs which are \(\Psi_{W}(\tilde{\mathbf{x}}^{[1]}(\cdot))\).
\(\mathcal{M}\), and where \(\delta_{j}=\pm 1\) depending on whether we want to have a monotone increase \((-1)\) or decrease \((+1)\) in the \(j\)-the variable of \(\mathcal{S}\).

**Assumptions 3.1** (ICEnet architecture): _Assume we have independent responses and covariates \((y_{n},\mathbf{x}_{n}^{[r]},\mathbf{x}_{n}^{[c]},v_{n})_{n=1}^{N}\) as defined in Section 2.1, and we have selected some covariates requiring constraints into sets \(\mathcal{S}\) and \(\mathcal{M}\). Assume we have a neural network architecture \(\Psi_{W}\) as defined in (2.2) having network weights \(W\). For the prediction part of the ICEnet, we use the following mapping provided by the network_

\[\mathbf{x}_{n}\ \mapsto\ \widehat{y}_{n}=\Psi_{W}(\mathbf{x}_{n})v_{n},\]

_which produces the predictions required for the regression task. In addition, the ICEnet also produces the following predictions made with the same network on pseudo-data defined by_

\[\tilde{\mathbf{x}}_{n}\ \mapsto\ \left[\widetilde{\mathbf{y}}_{n}^{[s_{1}]},\ldots, \widetilde{\mathbf{y}}_{n}^{[s_{S}]},\widetilde{\mathbf{y}}_{n}^{[m_{1}]},\ldots, \widetilde{\mathbf{y}}_{n}^{[m_{M}]}\right], \tag{3.3}\]

_where all definitions are the same as those defined in Section 2.3 for \(s_{l}\in\mathcal{S}\) and \(m_{l}\in\mathcal{M}\), respectively. Finally, to train the ICEnet, we assume that a compound loss function, applied to each observation \(n\in\{1,\ldots,N\}\) individually is specified as follows_

\[L(n)\ \overset{\text{\tiny def}}{=}\ L^{D}(y_{n},\widehat{y}_{n})+L_{2}(n)+L_{3 }(n), \tag{3.4}\]

_for smoothing loss \(L_{2}(n)\) and montonicity loss \(L_{3}(n)\) given in (3.1) and (3.2), respectively, for non-negative penalty parameters collected into a vector \(\lambda=(\lambda_{s_{1}},\ldots,\lambda_{s_{S}},\lambda_{m_{1}},\ldots,\lambda _{s_{M}})^{\top}\)._

We briefly remark on the ICEnet architecture given in Assumptions 3.1.

**Remark 3.2**:
* To produce the ICE outputs from the network under Assumptions 3.1, we apply the same network \(\Psi_{W}(\cdot)\) multiple times to pseudo-data that have been modified to vary for each value that a particular variable can take, see (3.3). Applying the same network multiple times is called a point-wise neural network in Vaswani et al. (2017), and it is called a time-distributed network in the Keras package; see Chollet et al. (2017). This application of the same network multiple times is also called a one-dimensional convolutional neural network.
* Common actuarial practice when fitting general insurance pricing models is to consider PDPs to understand the structure of the fitted coefficients of a GLM and smooth these manually. Since we cannot smooth the neural network parameters \(W\) directly, we have rather enforced constraints (3.1) for the ICE produced by the network \(\Psi_{W}(\cdot)\); this in particular applies if we smooth ordered categorical variables.
* Enforcing the same constraints as those in (3.4) in a GLM will automatically smooth/constrain the GLM coefficients similar to LASSO and fused LASSO regularization; we refer to Hastie et al. (2015). We also mention that similar ideas have been used in enforcing monotonicity in multiple quantile estimation; see Kellner et al. (2022).
* Since the PDP of a model is nothing more than the average over the ICE outputs of the model for each instance \(n\), by enforcing the constraints for each instance also enforces the constraints on the PDP. Moreover, the constraints in (3.4) could be applied in a slightly different manner, by first estimating a PDP using (2.5) for all of the observations in a batch, then applying the constraints to the estimated PDP.
* We have used a relatively simple neural network within the ICEnet; of course, more complex network architectures could be used.

## 4 Applying the ICEnet

### Introduction and exploratory analysis

In this section, we apply the ICEnet to the French Motor Third Party Liability (MTPL) dataset included in the CASdatasets package in the R language (Dutang and Charpentier, 2020), with the aim of predicting claims frequency. We follow the same data pre-processing, error correction steps and splitting of the data into learning and testing sets (in a 9:1 ratio), as those described in Appendix B of Wuthrich and Merz (2023), to which we also refer for an exploratory data analysis of this dataset. Table 1 shows the volumes of data in each of the learning and testing sets, illustrating that the observed claims rate is quite similar between the two sets.

The MTPL data contain both unordered and ordinal categorical covariates, as well as continuous covariates. To apply the ICEnet, we select all of the ordinal categorical and continuous covariates in the dataset for constraints; these are the Bonus-Malus Level, Density, Driver Age, Vehicle Age and Vehicle Power fields. Figure 2 shows the empirical claims frequency in the learning set, considering each fields in turn, i.e., this is a univariate (marginal) analysis. Note that for the continuous density variable, we are showing the frequency and exposure calculated at the percentiles of this variable. It can be seen that the empirical frequency varies with each variable somewhat erratically, especially in those parts of the domain of the variable when there is small exposure. In particular, for the bonus-malus level and density variables, there is quite a significant vertical spread of empirical frequencies, indicating that the univariate analysis presented here may not suitably capture the relationships between the covariates and the response, i.e., we need a more complex model to make predictions on this data.

In what follows, we impose the following constraints on these variables. Smoothing constraints are applied to all five of the variables. Among these five smoothed variables, ensuring that smoothness is maintained for driver age, vehicle age and bonus-malus level will be the most important constraints needed in this model from a commercial perspective, since the values of these variables will likely be updated each year that a policy is in force. Since we expect that claims frequency will increase with increasing bonus-malus scores, density and vehicle power, we also apply constraints to ensure that the model predicts monotonically increasing claims frequency for each of these variables. Table 2 shows these penalty parameters for each variable. These constraint values were selected heuristically by experimenting with different values until acceptably smooth and monotonic ICE outputs were produced, however, the impact on predictive performance was not considered when selecting these. Note that the table includes a

\begin{table}
\begin{tabular}{l r r r r} \hline \hline Set & \(N\) & Exposure & Claims & Frequency \\ \hline learn & \(610,206\) & \(322,392\) & \(23,737\) & \(0.0736\) \\ test & \(67,801\) & \(35,967\) & \(2,644\) & \(0.0735\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Number of records, total exposure and observed claims frequency in the French MTPL dataset, split into learning and testing sets
direction column to show that we are enforcing monotonically increasing constraints to \(\delta_{j}=-1\); setting the direction parameter to \(\delta_{j}=1\) would produce monotonically decreasing constraints (see Listing 1 in Appendix A). Of course, these parameters could also be selected to produce optimal predictive performance using, for example, an out-of-sample validation set, or \(K\)-fold cross-validation.

### Fitting the ICEnet

We select a \(d=3\) layer neural network for the FCN component of the ICEnet, with the following layer dimensions (\(q_{1}=32,q_{2}=16,q_{3}=8\)) and set the activation function \(\phi(\cdot)\) to the Rectified Linear Unit (ReLU) function. The link function \(g(\cdot)\) was chosen to be the exponential function

Figure 2: Empirical claims frequency (top panel) and observed exposures (bottom panel) in the French MTPL dataset for each of the Bonus-Malus Level, Density, Driver Age, Vehicle Age and Vehicle Power covariates (univariate analysis only), learning set only. Note that the \(y\)-scales for each variable are not comparable.
(which is the canonical link of the Poisson model). To perform early-stopping to regularize the network, we further split the learning set into a new learning set \(\mathcal{L}\), containing 95% of the original learning set, and a small validation set \(\mathcal{V}\), containing 5% of the original learning set. We assign an embedding layer to each of the unordered categorical variables (Vehicle Gas, Vehicle Brand, Region and Area Code), and, for simplicity, select the dimension of the real-valued embedding to be \(b=5\) for each of these variables. For the rest of the variables, we apply mix-max scaling (see Section 2.2) and then directly input these into the FCN; this explains how the vector of covariates \(\mathbf{x}\) has been constructed.

For comparison with the ICEnet, we begin with training several simple FCNs for comparison; 10 training runs of these were performed. This was fit using the Adam optimizer for 50 epochs, using a learning rate of 0.001 and a batch size of 1024 observations. The network training was early stopped by selecting the epoch with the best out-of-sample score on the validation set \(\mathcal{V}\). To train this FCN network, we use only the deviance loss \(L^{D}\), i.e., the first component of the loss function (3.4). Since neural network training involves some randomness arising from the random initialization of the network weights \(W\) and the random selection of training data to comprise each mini-batch, the results of each training run will vary in terms of predictive performance; furthermore the exact relationships learned between the covariates and the predictions will vary by training run. In the first two lines of Table 3, we show the average of the Poisson deviance loss and the Poisson deviance loss produced using the nagging predictor of Richman and Wuthrich (2020), which is the predictor produced by averaging over the outputs of several neural network training runs. The standard deviation of the Poisson deviance loss across training runs is shown in the table in parentheses.

The ICEnet was fit using the Keras in the R programming language;1 for the Keras package see Chollet et al. (2017). The implementation of the ICEnet is explained in more detail in Appendix A in the supplementary material. Similar to the FCNs, 10 training runs of the ICEnet were performed. Since the ICEnet requires many outputs to be produced for each input to the network, the computational burden of fitting this model is quite heavy, nonetheless, this can be done easily using a Graphics Processing Unit (GPU) and the relevant GPU optimized versions of deep learning software. The ICEnet results are on Lines 3-4 of Table 3, showing the average results and the nagging predictor, respectively. We note that training runs of the FCN and ICEnet take about 3 and 12 minutes to complete, respectively, the former running without a GPU and the latter running on a GPU.

\begin{table}
\begin{tabular}{l r r r} \hline \hline Covariate & Smoothing Constraint & Monotonicity Constraint & Direction \\ \hline Driver Age & 10 & 0 & \(-1\) \\ Vehicle Age & 1 & 0 & \(-1\) \\ Bonus Malus & 1 & 100 & \(-1\) \\ Density & 1 & 100 & \(-1\) \\ Vehicle Power & 1 & 100 & \(-1\) \\ \hline \hline \end{tabular}
\end{table}
Table 2: Smoothing and monotonicity constraints applied within the ICEnet
It can be observed that adding smoothing and monotonicity constraints to the ICEnet has resulted in only marginally worse performance of the model on both the training and testing set, compared to the FCN results. Interestingly, whereas the FCN has a relatively large performance gap between the training and testing sets (both on average and when comparing the nagging predictor), the ICEnet has a much smaller gap, implying that these constraints are regularizing the network, at least to some extent. Finally, while the nagging predictor improves the performance of both the FCN and the ICEnet, the performance improvement is somewhat larger for the former than the latter, which can be explained by the nagging predictor performing regularization over the different fitting runs.

We approximately decompose the reduction in performance between the smoothness constraints on the one hand, and the monotonicity constraints on the other, by refitting the ICEnet with the smoothing constraints only, and then with the monotonicity constraints only. These results are shown in Table 4.

The results show that the smoothing constraints are the primary cause of the decline in performance of the ICEnet, compared with the FCN. The monotonicity constraints, on the other hand, improve the out-of-sample performance of the ICEnet to surpass the FCN, whether on average, or when using the nagging predictor. Furthermore, the small gap between the training and testing results for the ICEnet with monotonicity constraints only, shows that these successfully regularize the model. These results suggest that adding monotonicity constraints to actuarial deep learning models based on expert knowledge can lead to enhanced performance. Whether the somewhat decreased performance of a model that produces smoothed outputs is acceptable, will depend on whether these constraints are necessary for commercial purposes. Moreover, the

\begin{table}
\begin{tabular}{l l|l l|l l} \hline \hline Description & Constraints & Learn & \multicolumn{2}{c}{Test} \\ \hline \hline ICEnet & Smoothing + Monotonicity & 0.2386 & (0.000180) & 0.2388 & (0.000236) \\ ICEnet & Smoothing & 0.2385 & (0.000423) & 0.2388 & (0.000385) \\ ICEnet & Montonicity & 0.2384 & (0.000214) & 0.2385 & (0.000140) \\ \hline ICEnet (nagging) & Smoothing + Monotonicity & 0.2384 & & 0.2385 & \\ ICEnet (nagging) & Smoothing & 0.2382 & & 0.2385 & \\ ICEnet (nagging) & Monotonicity & 0.2381 & & 0.2382 & \\ \hline \hline \end{tabular}
\end{table}
Table 4: Poisson deviance loss for the ICEnet, learning and testing sets. For multiple runs, the average and standard deviation (in parentheses) are reported. Constraints are varied as described in the relevant column.

\begin{table}
\begin{tabular}{l|l l|l l} \hline \hline Description & Learn & \multicolumn{2}{c}{Test} \\ \hline FCN & 0.2381 & (0.000211) & 0.2387 & (0.000351) \\ FCN (nagging) & 0.2376 & & 0.2383 & \\ \hline ICEnet & 0.2386 & (0.000180) & 0.2388 & (0.000236) \\ ICEnet (nagging) & 0.2384 & & 0.2385 & \\ \hline \hline \end{tabular}
\end{table}
Table 3: Poisson deviance loss for the FCN and the ICEnet, learning and testing losses. For multiple runs, the average and standard deviation (in parentheses) are reported.
values of the constraint parameters could be (further) varied so that an acceptable trade-off of smoothness and performance is achieved; for an example of this, see Section 4.4, below.

### Exploring the ICEnet predictions

We start with considering the global impact of applying constraints within the ICEnet by considering the PDPs derived from the FCN and ICEnet models in each of the 10 training runs of these models. The ICE outputs were constrained when fitting the network by using loss function (3.4) applied to each of the observations in the training set. The PDPs are shown in Figure 3 with blue lines for FCN and red lines for ICEnet.

Figure 3: PDPs for each of the Bonus-Malus Level, Density, Driver Age, Vehicle Age and Vehicle Power fields shown in separate panels, test set only. Blue lines are PDPs from the FCNs (unsmoothed) and red lines are PDPs from the ICEnet (smoothed). Bold lines relate to the PDPs from the first of 10 runs; the lighter lines relate to the remaining runs. Note that the scale of the \(y\)-axis varies between each panel.
The PDPs from the unconstrained FCNs models exhibit several undesirable characteristics: for the bonus-malus level, density and vehicle age covariates, these exhibit significant roughness which would translate into unacceptable changes in rates charged to policyholders as, for example, bonus-malus scores are updated, or as the policyholder's vehicle ages. Also, in some parts of the PDPs, it can be observed that monotonicity has not been maintained by the FCNs. Finally, the PDPs for the driver age and vehicle power covariates exhibit different shapes over the different runs, meaning that the FCNs have learned different relationships between the covariates and the predictions. On the other hand, the PDPs from the ICEnets are significantly smoother for all of the variables and runs, appear to be monotonically increasing in all cases and finally, exhibit more similar shapes across the different runs. Interestingly, the relationships learned by the constrained ICEnets are quite different for the bonus-malus level, vehicle age and driver age variables than those learned by the FCN, with the PDPs of the ICEnet for the first two variables arguably more commercially reasonable than the those from the FCN.

Focusing on the first training run of the FCNs and the ICEnets, we now show some examples of the effect of the constraints on individual observations. To estimate the monotonicity and smoothness of the ICE outputs of the FCN and ICEnets, these components of the ICEnet loss function (3.4) were evaluated for each observation in the test set. Figure 4 shows density plots of the difference (smoothed model minus unsmoothed model) between these scores for each of these models, for each variable separately.

All of these densities have a long left tail, meaning to say, that the ICE outputs produced by the ICEnet are significantly more monotonic and smooth than those produced by the FCN. Also, the densities usually peak around zero, meaning to say that adding the constraints has generally not significantly "damaged" outputs from the FCN that already satisfied the monotonicity or smoothness constraints. For the densities of the monotonicity scores for the bonus-malus level and density variables, it can be seen that there is a short right tail as well, which we have observed to occur when the original FCN model produces some outputs that are already monotonic and these are altered somewhat by the ICEnet.

Figures 5 and 6 show ICE plots for several instances \(n\), which have been specially chosen as those that are the least monotonic and smooth ones, based on the monotonicity and smoothness scores evaluated for each observation in the test set on the outputs of the FCN only. These figures show that, in general, the ICE plots of predictions from the ICEnet are more reasonable. For example, for instance \(n=4282\) in Figure 5, it can be seen that the FCN produces predictions that decrease with density, whereas the opposite trend is produced by the ICEnet; another example is instance \(n=41516\) where the FCN predictions decrease with vehicle power and the ICEnet reverses this. A nice side effect of the constraints is that some of the exceptionally large predictions produced by the FCN, for example, for instance \(n=16760\) in Figure 6, are reduced significantly by the ICEnet; in general it would be highly unlikely to underwrite policies with such an elevated frequency of claim.
done by fitting exactly the same FCN as before, with the same covariates, but with the aim of approximating the nagging predictor derived using the 10 FCN predictions. Then, the weights of the meta-network were used as a starting point for fitting an ICEnet, where the strength of the constraints was varied over a wide range from \(10^{-5}\) to \(10^{5}\). The results of fitting these models, as well as the PDPs from the meta-model and the ICEnets are shown in Table 5 and Figure 7, respectively. The minimum value of the test set Poisson deviance loss is reached when setting the value of the constraints equal to \(10^{-3}\), however, the validation set minimum is reached when setting the value of the constraints to unity; in this case the validation set identifies an almost optimal value of the constraints as measured by the test set performance. It can also be seen that the highest value of the constraints leads to models with a poor test and validation set performance. The PDPs show that the ICEnet with the optimal value of the constraints maintains many of the features of the PDPs of the meta-model, while being smoother and less

Figure 4: Density plots of the difference between the monotonicity and smoothness components of the ICEnet loss function (3.4) evaluated for each observation in the test set.
extreme than the meta-model. The ICEnets with the most extreme values of the constraint parameters become much flatter for the bonus-malus level, vehicle age and density variables, whereas the PDPs for driver age and vehicle power maintain significant variation over the range of these variables.

Here, we have considered quite simple variations of the constraint parameters by varying the constraints for all variables together; using other techniques, one could also attempt to find an optimal set of constraints where the values of these differed by variables and type of constraint.

Figure 5: ICE plots of the output of the FCN and the ICEnet for instances \(n\) chosen to be the least monotonic based on the monotonicity score evaluated for each instance in the test set on the outputs of the FCN. Note that the smoothed model is the ICEnet and unsmoothed model is the FCN.
## 5 Local approximations to the ICEnet

In the previous section, the constraints on the network have been enforced by creating ICE outputs from the FCN for each value that the covariates with constraints can take, see Assumptions 3.1. However, this creates quite some computational overhead when fitting the ICEnet. Thus, we now explore a local approximation to the ICEnet, where the ICE outputs from the FCN are created only for a small subset of the values that the covariates with constraints can take. In particular, we define a window size parameter \(\omega\) and only produce the ICE outputs in a window of \(\frac{\omega-1}{2}\) around the actual value of each covariate. To ensure that the third difference used for smoothing remains defined, we set the window parameter to have a value of \(\omega=5\) in what follows. To define the Local ICEnet approximation, all that is needed is to modify the ICEnet

Figure 6: ICE plots of the output of the FCN and the ICEnet for instances \(n\) chosen to be the least smooth based on the smoothness score evaluated for each instance in the test set on the outputs of the FCN. Note that the smoothed model is the ICEnet and unsmoothed model is the FCN.
Figure 7: PDPs of the meta-model and ICEnets with the constraint parameters varied from \(10^{-5}\) to \(10^{5}\). The PDPs of the meta-model are in black and the PDP of the optimal model - with smoothing parameters set equal to 1 - based on the validation set is shown in red.
to produce outputs for an observation to return outputs only in the window around the actual observed value. Furthermore, for instances that are at the extremes of the observed value of \(j\)-th covariate, e.g., for the youngest drivers, we produce outputs from the ICEnet for only the first or last \(\omega\) observations of the set \(\{a_{1}^{j},\ldots,a_{K_{j}}^{j}\}\). Since the Local ICEnet needs to produce significantly fewer outputs than the global ICEnet presented earlier, the computational burden of fitting this model is dramatically decreased and the model can be fit without a GPU.

A Local ICEnet was fit to the same data as above. To enforce the constraints more strongly over the range of the constrained variables, slightly stronger values for these were found to work well; these are shown in Table 7. A Local ICEnet takes about 12 minutes to run without a GPU; this is similar to the global ICEnet running on a GPU.

The results of fitting the Local ICEnet are shown in Table 6. In this case, the ICEnet outperforms the FCN, both on average and for the nagging predictor and, comparing these results to those in Table 3, it appears that the Local ICEnet allows constraints to be enforced with a smaller loss of predictive performance than the global ICEnet shown above.

We show plots of the outputs of the Local ICEnet in Appendix B of the supplementary material. From Figure 8 it can be seen that the global effect of applying the Local ICEnet is quite similar

\begin{table}
\begin{tabular}{l|l|l l} \hline \hline Description & Learn & \multicolumn{2}{c}{Test} \\ \hline FCN & 0.2381 & (0.000211) & 0.2387 & (0.000351) \\ FCN (nagging) & 0.2376 & & 0.2383 & \\ \hline ICEnet & 0.2385 & (0.000301) & 0.2386 & (0.000215) \\ ICEnet (nagging) & 0.2381 & & 0.2383 & \\ \hline \hline \end{tabular}
\end{table}
Table 6: Poisson deviance loss for an FCN and the Local ICEnet, learning and testing sets. For multiple runs, the average and standard deviation (in parentheses) are reported.

\begin{table}
\begin{tabular}{l r r r} \hline \hline Regularization Parameter (\(\log_{10}\)) & Learn & Validation & Test \\ \hline meta-model & 0.23835 & 0.23232 & 0.23829 \\ -5 & 0.23838 & 0.23276 & 0.23856 \\ -4 & 0.23833 & 0.23245 & 0.23847 \\ -3 & 0.23791 & 0.23243 & 0.23837 \\ -2 & 0.23831 & 0.23263 & 0.23855 \\ -1 & 0.23816 & 0.23241 & 0.23856 \\ **0** & **0.23785** & **0.23236** & **0.23840** \\ 1 & 0.23924 & 0.23332 & 0.23947 \\ 2 & 0.24093 & 0.23484 & 0.24099 \\ 3 & 0.24341 & 0.23684 & 0.24375 \\ 4 & 0.24659 & 0.23965 & 0.24744 \\ 5 & 0.24903 & 0.24212 & 0.25018 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Poisson deviance loss for the ICEnet, learning, validation and testing sets. The magnitude of the constraints is varied as described in the first column; “meta-model” denotes the results of the meta-model with no constraints applied.
to that of the global ICEnet, however, the PDPs shown in this figure are a little less smooth than those of the global ICEnet. In Figure 9 it can be seen that the Local ICEnet approximation has been moderately successful at enforcing the required constraints with most of the variables showing improved monotonicity and smoothness scores, except for the bonus-malus level and density covariates. The examples shown in Figures 10 and 11 illustrate that for the most extreme examples of the non-monotonic and rough results produced by the FCN, the Local ICEnet appears to produce outputs that are similar to the global ICEnet.

## 6 Conclusions

We have presented a novel approach, the ICEnet, to constrain neural network predictions to be monotonic and smooth using the ICE model interpretability technique. We have shown how the global ICEnet can be approximated using a less computationally intensive version, the Local ICEnet, that enforces constraints on locally perturbed covariates. Fitting these models to a real-world open-source dataset has shown that the monotonicity constraints enforced when fitting the ICEnet can improve the out-of-sample performance of actuarial models, while fitting models with a combination of smoothing and monotonic constraints allows the models to produce predicted frequencies of claim that accord with intuition and are commercially reasonable. In this work, we have focused on smoothing the predictions of networks with respect to individual observations; as we have noted above it is easy to rather impose constraints on the global behaviour of networks instead. Moreover, other formulations of smoothing constraints could be imposed, for example, instead of squaring the third differences of model outputs, which will lead to minimizing the larger deviations from smoothness, rather absolute differences could be smoothed.
