Neural networks have been hitting the ball out of the park for a variety of machine learning problems in pattern recognition, computer vision, natural language processing and time series forecasting. A key concept in deep learning with neural networks has been the discovery of hidden or latent features in the input data, which also lend themselves to interpretation. In this article, we will look at the application of neural nets to the classical nonlinear regression problem, and look at one architecture that lets us bring (somewhat) similar feature discovery and interpretability to this problem. Of course, neural networks have been applied many times to such a setting, but here we will see an interesting (at least to me) approach that combines concepts from residual learning, projection pursuit and latent variable regression to give us an interpretable network architecture. It also gives us some nice by-products such as global sensitivities and a controllable low-dimensional projection of the input feature space that is chosen to best represent the influence on the dependent variable.
You can find the Matlab code for the approach described in this article here.
The problem
Consider the standard regression problem, where we are given a sample set of -dimensional vectors from an -dimensional input space and corresponding values of a dependent variable, and wish to generate a function such that the prediction errors between and are minimized in some sense. Here we will minimize the sum of squared errors
Apart from just obtaining some function that minimizes this error, it is often desired to have be interpretable in some way so as to reveal the structure of the relationship captured by it. One aspect of this structure that is often quite revealing is its true dimensionality. There may be (e.g. 10) dimensions in the input space, but it may be that the dependent variable is only significantly influenced by a small subset of those dimensions. This is what we typically refer to as predictor importance. A more interesting question is whether there is a lower dimensional subspace of the input space that would largely explain the variation of the dependent variable.
This figure shows a simple example with 2 input dimensions, where the dependent variable is varying only along the direction indicated by the green dashed arrow. This direction aligns with the vector . In this case the lower dimensional subspace is the 1-D subspace defined by the vector .

Let us define a variable along this direction. can be considered as a hidden or latent variable. This latent variable is defined by the vector in the original input space. This means that it is more closely aligned to than to by a factor of 2. Since the dependent variable shows all its variation along this latent variable direction, we can infer that in some global sense has twice the influence on compared to the influence of . In one extreme case, if the latent variable direction was defined by , then would have no influence on at all.
Of course, in the general setting we may have more that 1 latent variable required to explain most, if not all, the variance in the dependent variable. Apart from solving the basic regression problem of minimizing the prediction errors, SiLVR lets us discover these latent variables, while at the same time determining the component of that varies along each latent variable direction. We will see how it does this in the following sections.
The architecture
Typical regression network
Let us consider a vanilla fully connected network with 1 hidden layer, as shown in the following figure. This is a common first pick for regression using neural networks.

Each node in the hidden layer has an activation function given by
where is a nonlinearity, often a sigmoidal function. The dot product is projecting the input vector along the weight vector . This projected value is then translated by the bias after which the non-linearity is applied. is then a sigmoidal function that is aligned along the direction of the vector . The output layer is then performing a linear combination of the activations from the hidden layer, as in , where are the weights and is the bias term. Each edge in the network implies a parameter. The dangling input edges of the hidden nodes indicate the biases ().
The SiLVR network
Let us now make a couple of key changes to the typical network architecture, with the goal of making the network parameters more interpretable:
- Replace each hidden node with a small sub-network, which we will call a ridge stack, and
- Make the width of the hidden layer dynamic: add ridge stacks only as needed. Let us see how this works.
The architecture of the -th ridge stack (which replaces the -th node in the hidden layer) is shown in this figure:
It has three layers:
- Projection: This layer simply projects the input vector onto the weight vector via a dot product which is denoted by the variable .
- Nonlinearity: This is then taken through nodes in parallel, each of which scales by a factor , translates it by adding a bias of and then applies a sigmoidal nonlinearity, as in . Each of these sigmoids is aligned along the direction of the projection vector (weight vector) , but each stretched, translated and sometimes flipped in different ways, as needed by the network.
- Composition: Compute a weighted sum of the activations from the nonlinearity layer, with a bias, to give the output of the ridge stack: . This layer puts all the transformed sigmoids together to create a complex (or simple) nonlinear function that varies only along the projection vector. This nonlinear function can take a variety of different shapes, for instance from a ramp, a staircase curve, a peaky curve, a combination of staircase and peaks, and so on.
Let us consider just the ridge stack with for a minute. This ridge stack is essentially trying to identify, with the projection / weight vector , the latent variable direction along which most of the variation in the dependent variable occurs. At the same time it is also trying to fit the curve to best match the component of that is varying along this direction.
The term ridge stack is inspired from the concept of ridge functions. A ridge function is simply a function that varies only along one direction in the input space. It is of the general form , where is a fixed vector and is some univariate function. If we consider a 2-dimensional input space then a ridge function would be contant along one direction (orthogonal to the direction of variation), leading to “ridges” in the topology. A simple example is in this figure, where we can see the ridge in the direction perpendicular to the direction of variation marked by the black arrow.

The parameters of the ridge stack are the elements of the vectors and and the scalar . We will optimize these parameters to minimize the fitting error between the dependent variable and the output of the stack . The fitting error is captured by an appropriate loss function, for example the loss:
Later we will see that we use a slightly modified version of this loss (adding in a regularization loss) to reduce overfitting.
will then be the latent variable direction along which most of the variation of the dependent variable manifests and will be the ridge function that best matches this variation (or shape) of the dependent variable along this direction.
Now once we have a ridge stack fitting the variation of along the first latent variable direction, what do we do about the remaining variation in ? My guess is that you have this figured out by now. This is where the second ridge stack comes in (). Let us compute the residual using this relation : this is the variation in that is not yet explained by the first ridge stack. We tune the parameters of the second ridge stack to minimize the error between its output and the residual - again the error is computed using an appropriate loss function. The weight vector now approximates the second most important latent variable direction in the input space, and the ridge function captures the variation in along this direction.
We can repeat this same procedure on the new residual , and so on, until we do not see any further improvement in the loss. The resulting network architecture then looks like this:

The final prediction, given an input vector, is the sum of the outputs from the ridge stacks.
There are parallels between this approach and the Projection Pursuit Regression method proposed by Friedman and Stuetzle in this paper, in the way we pursue projections and ridge functions. These parallels and differences are explored in detail here.
Interpreting the model
Let us take a close look at the first latent variable direction () discovered by the network. We know from our earlier discussion above that input dimensions with largee weight magnitudes have a larger influence on the dependent variable. We can quantify this notion of global influence of the -th dimension in terms of the normalized weight of the dimension, given the weight vector :
Let us see the model in action, using a real-world example. We generate a data set by running simulations of a CMOS operational amplifier (opamp) circuit, wherein for each simulation we use a randomly generated vector of values for 13 parameters of the circuit (if you are curious - these are the threshold voltages of the transistors and the gate oxide thickness). From each simulation, we measure five dependent variables:
- DC gain
- Unity gain frequency (UGF)
- Phase margin (PM)
- Settling time (ST)
- DC input offset These variables are commonly used to quantify different performance aspects of an opamp design.
We train a SiLVR network for each of these dependent variables. While the MAPE is quite good (less than 2% in all cases), lets take a look at some of the inferences we can draw from these learnt networks. For details of the experiment you can look at this paper.
Let us take a look at the first latent variable discovered for each of these dependent variables:

We can start to interpret these learnt model parameters in terms of the modeled system’s behavior. For example, the weight vectors show us the relative influence of each of the input variables on the dependent variables.
We see that Gain, PM and Offset have near identical weight vectors. This suggests that they are largely varying along the same direction. In fact, if we plot them against the first latent variable for Gain, we can see this in action:

They all show crisp curves instead of point clouds. Gain and PM show some nice nonlinearlity, and despite that we are able to discover this interdependence or correlation between them. If we try to quantify this correlation using simple measures such as Pearson’s correlation coefficient, or even Spearman’s rank correlation coefficient, we completely miss its strength.
| Output pair | |Pearson’s corr. coeff.| |
|Spearman’s corr. coeff. | |
IRC |
|---|---|---|---|
PM - Offset |
0.119 | 0.161 | 1.000 |
Gain - PM |
0.871 | 0.986 | 1.000 |
Gain - Offset |
0.054 | 0.099 | 1.000 |
Digging a little deeper into the weight vectors, we see a nice way to quantify this relationship using the normalized inner product of the first latent variable vectors () of the dependent variables. We call this measure the input-referred correlation (IRC):
The IRC nicely captures the strong correlation between Gain, PM and Offset, as shown in the table above.
To summarize the SiLVR architecture provides these goodies, apart from doing a decent job of nonlinear regression:
- Latent variables that describe most of the variation in the dependent variable.
- Measure of global influence of each input variable on the dependent variable.
- Measure of (nonlinear) correlation between different variables that are dependent on the same input variables.
- A neat way to visualize the hidden structure of the variation of the dependent variable, by plotting against the discovered latent variables.
Training
It is worth noting some key aspects of how each of the ridge stacks may be trained. We use the Levenberg-Marquardt (LM) algorithm for training since it is well suited for a least-squared error ( loss) formulation. I leave a detailed description of the method to the famous and original paper by Marquardt, any give an intuitive overview of this very elegant adaptive method here. Two well-known non-linear optimization methods are Steepest Descent and Gauss-Newton. Roughly speaking, steepest descent (SD) computes the local gradient of the loss function with respect to the search parameters, and takes a step along the (negative) gradient to achieve a reduction in the loss. It repeats this procedure until some stopping criterion is achievesd, such as stagnation of the loss function. Gauss-Newton (GN) instead computes a quadratic representation of the local neighborhood, based on the local Jacobian (gradient amtrix) and takes a step to the minimum of this quadratic. GN has the advantage of must faster convergence when compared to SD, however, SD tends to be a lot more robust especially when the loss surface is non-convex and the search is far from the solution. The LM algorithm nicely combines both these methods by taking a step () in a direction that is, roughly speaking, a weighted combination of the step proposed by GN and the step proposed by SD:
represents the point in the parameter search space, at the -th step of the search, and is the step vector to reach that point from the previous point. The weight is adaptively increased by some factor (more SD-like) if the loss is increased by the step, and decreased by the same factor (more GN-like) if the loss if decreased.
The loss captures the fitting error, but adding in a regularization loss helps keep overfitting in check. The actual loss function we use is:
where is the sum of squares of the ridge stack parameters. The weights and are determined adaptively through the search via a Bayesian formulation. The details of this formulation are described in this paper. Roughly speaking, we recognize that the best values for these weights would depend on both the model architecture () and the training data (). There is no general way to compute these optimal values. The Bayesian formulation tries to maximize the probability . The really cool thing is that candidate values for these weights can be proposed, under certain reasonable assumptions on the distribution of noise in the training data. The candidate values depend on the Hessian of the regularized loss , which in turn is naturally estimated by the LM search algorithm. Hence, at each step of the LM search, we can compute a reasonable guess for both and .
