6 ML-PWS: Quantifying Information Transmission Using Neural Networks
This chapter is co-authored by Manuel Reinhardt, Gašper Tkačik (IST Austria), and Pieter Rein ten Wolde.
Understanding the flow of information in natural and engineered systems is crucial for their design and analysis. The mutual information rate is the fundamental measure to describe the transmission of information for systems with time-varying signals. Yet, computing it accurately is extremely challenging due to the high-dimensional nature of trajectories. Previous methods include the Gaussian approximation which is limited to linear systems with Gaussian noise. A recent technique, Path Weight Sampling (PWS), in principle addresses these limitations, but it requires a stochastic model, which is often not available for the systems of interest. We propose leveraging recent advances in machine learning to obtain such a stochastic model directly from data, and provide a general-purpose tool for estimating the mutual information rate. Specifically, using unsupervised learning, we estimate the probability distribution of trajectories by training a neural stochastic model on time-series data. We demonstrate that by combining machine learning with PWS (ML-PWS) we can accurately compute the information transmission rate of nonlinear systems, even in the absence of a known mechanistic or phenomenological model. This approach represents a significant advance for data-driven quantification of information transmission in general nonlinear and non-Gaussian systems.
6.1 Introduction
Information theory is the most general framework for studying signal processing systems and quantifying their performance. Shannon [1] introduced the mutual information as a measure to quantify how much information is communicated between two random variables, such as the input and output of a system at a given time. However, for most systems the mapping from input to the output cannot be directly described as a sequence of independent transmissions, rather information can generally be contained in temporal correlations within the input or output signals. Therefore, the mutual information between signal values at a given instant is in general ill-suited for measuring the amount of information transmission. To correctly quantify the information transmitted via time-varying signals requires computing the mutual information between the entire input and output trajectories of the system [2]. The rate at which this trajectory mutual information increases with the trajectory duration in the long-time limit defines the mutual information rate [1]. This rate represents the speed at which distinct messages are transmitted through the system, and it depends not only on the accuracy of the input-output mapping but also on the correlations within the input and output signals. In the absence of feedback this rate also equals the multi-step transfer entropy [3,4].
The mutual information rate is the key measure to quantify information flow in dynamical systems. It is used to quantify biochemical signaling performance [5–7], to perform model reduction [8], to detect the causality of interactions [9,10] or to test for nonlinearities in time series [11]. This includes applications such as financial markets, to assess dependencies between stock prices or market indices over time [12–14], or neuroscience, where it is used to measure the amount of information exchanged between different regions of the brain [15,16]. Being one of the key performance measures in information theory, the mutual information rate is thus of paramount practical relevance.
Yet, computing the mutual information rate poses a significant challenge because trajectories are high-dimensional objects, making its accurate estimation difficult. Traditional techniques first estimate the joint probability distribution of input and output, e.g. via histograms or kernel density estimates, and then compute the mutual information from the distribution estimate [17,18]. However, these distribution estimates are typically infeasible in high-dimensional spaces [19,20], and have only been successfully used for computing the mutual information between trajectories in very simple systems [21]. Non-parametric estimators, such as the k-nearest-neighbor estimator [22] attempt to circumvent some of these issues but require selecting an appropriate metric in trajectory space and still suffer from uncontrolled biases for high-dimensional data [20,23]. For systems that exhibit approximately Gaussian dynamics, the mutual information can be estimated directly from correlation functions [2,24], though this method is limited to linear systems.1 Finally, analytical and numerical approaches have been developed to accurately compute or approximate the trajectory mutual information from a dynamical model of the system [2,7,25–27]. In particular, we recently introduced Path Weight Sampling (PWS), a model-based Monte Carlo technique to exactly compute the mutual information rate [26]. But, since all these techniques require an accurate stochastic model describing the system, they cannot be directly applied to data.
Neural network-based methods offer a promising alternative. By leveraging gradient descent for learning complex high-dimensional distributions, we can potentially estimate the mutual information more accurately. So far, most of these approaches have primarily focused on training neural networks to optimize variational bounds of the mutual information [28–33], often with the goal of learning effective latent state representations. However, these variational bounds are frequently not tight due to limited amounts of training data and the difficulty of optimizing over high-dimensional spaces [20,33–36], leading to significant underestimation of the mutual information. The Difference-of-Entropies (DoE) estimator by McAllester and Stratos [34] neither provides an upper nor a lower bound on the mutual information, but often results in more accurate mutual information estimates. As discussed in Section 6.4, this estimator shares some similarities with PWS. Given the effectiveness of neural networks for modeling sequential data, we thus asked whether machine learning could be combined with PWS to create a robust, data-driven estimator for the mutual information rate.
In this chapter, we present ML-PWS, an extension of PWS for computing the mutual information rate directly from experimental time-series data. By leveraging current machine learning methods, and combining them with PWS, we obtain a flexible architecture for computing the mutual information rate. We demonstrate that neural autoregressive sequence prediction models, which have been used in speech synthesis [37] or text generation [38], can be trained to learn a nonlinear stochastic model directly from data consisting of many input-output pairs of time-series. The model is trained by minimizing the Kullback-Leibler divergence between the model predictions and the observed trajectories. With this approach, the model learns the stochastic properties of the trajectories, enabling the computation of the mutual information rate using PWS. Here, the neural network is both used to generate stochastic trajectories, as well as to compute the path weights required for the PWS Monte Carlo estimate. Moreover, we show that by leveraging variational techniques we can significantly improve the PWS estimator itself, employing neural importance sampling [39] to efficiently marginalize the joint distribution of input and output—a key step in the algorithm. We posit that these advances lead to a generic, flexible, and efficient framework for computing the mutual information rate directly from experimental data.
We test our approach by computing the mutual information rate for a minimal nonlinear model and comparing our results against the true mutual information as well as against the Gaussian approximation. We find that the autoregressive sequence model effectively learns the stochastic dynamics of the nonlinear system, and that PWS yields accurate mutual information estimates, including in regimes where the widely-used Gaussian approximation fails. Notably, we find that even for approximately linear systems, our model combined with PWS provides more accurate mutual information estimates than the Gaussian approximation because it suffers less from bias caused by using a finite-size dataset.
6.2 Methods
6.2.1 The Mutual Information Rate for Discrete-time Processes
The mutual information between two random variables and is defined as
or, equivalently, using Shannon entropies
In the context of a noisy communication channel, and represent the messages at the sending and receiving end, respectively. Then, is the amount of information about that is communicated when only is received. If can be perfectly reconstructed from , then . On the contrary, if and are independent, . The mutual information thus is always non-negative and quantifies the degree of statistical dependence between two random variables.
For systems that repeatedly transmit information, this concept must be extended to sequences of messages and . The mutual information between random sequences is defined analogously as
where the expected value is taken with respect to the full joint probability of both sequences. This quantity can be interpreted as the total information that is communicated via transmissions .
Note that, unless the individual messages are independent, the total amount of information communicated is not equal to the sum of the mutual information between individual messages. Thus, in general
Intuitively, this makes sense. On one hand, auto-correlations within the input or output sequences reduce the amount of information transmitted per message such that the left term of the inequality may become smaller than the right term. On the other hand, information can be encoded in temporal features of the sequences, such that the left term could become larger than the right term. These observations show that generally the instantaneous mutual information at any given time does not provide a meaningful measure of information flow, as has been pointed out before [21,40]. To correctly quantify the amount of information transmitted per unit time we must take the whole sequence of messages over time into account.
For that reason, the relevant performance measure for an information processing system is the mutual information rate. Let the input and output of an information processing system be given by two discrete-time stochastic processes and . Then, the mutual information rate between and is
The mutual information rate quantifies the amount of information that can reliably be transmitted per unit time.
The definitions above however do not provide an obvious way of how to compute the mutual information rate in practice. Path Weight Sampling is a Monte Carlo estimator introduced recently for exactly computing the mutual information between trajectories [26].
6.2.2 Path Weight Sampling
In the previous chapters, we developed Path Weight Sampling, which addresses many of the shortcomings of previous techniques for computing the mutual information. PWS is an exact technique that supports nonlinear systems and, in contrast to the Gaussian approximation, correctly takes into account higher-order correlations that may be present. Given a mechanistic model that describes the stochastic dynamics of a system, PWS makes it possible to directly compute the mutual information rate for this model.
PWS is based on the exact evaluation of conditional path probabilities and requires that we have a model of the system as well as its input statistics. Specifically, it has three requirements. To compute the Monte Carlo estimate of the mutual information one needs to
sample from the input distribution ,
sample from the conditional output distribution , and
evaluate the conditional probability density , i.e., the path weight.
We thus require a model of the system, that describes how the output evolves stochastically for a given input sequence , as well as a model that describes the stochastic input to the system. Note, that we only need an estimate of the probability density for the output , but not for the input.
Given these models for input and output, the mutual information is computed using a Monte Carlo estimate of Equation 6.3
where are pairs of input-output trajectories that need to be drawn independently from the full joint distribution of trajectories, given by . Such draws can be realized by first generating an input sequence , and subsequently generating an output from the conditional model . As this estimate converges to the true mutual information , making PWS an exact Monte Carlo scheme. Equation 6.6 requires evaluating the conditional probability density , as well as the marginal probability density for a potentially large set of Monte Carlo samples. How to evaluate these densities efficiently is the crux of PWS.
The first important observation is that we can typically directly evaluate the conditional probability density of output sequences from the stochastic model of our system. For instance, suppose the output model is given by a Langevin equation with delta-correlated unit white noise . A discretized path sampled from the model, can be represented by the initial state and the sequence of random numbers that were used to generate the path with a stochastic integration scheme. The conditional probability density of the path can then be written as
A similar formula exists if the model is given by a master equation [20,26], which is based on the random numbers drawn in the Gillespie algorithm. There is also a class of deep generative models with tractable probability distributions. More generally, it is known that efficiently evaluating the conditional probability density of sequences is tractable for any autoregressive sequence model without latent (unobserved) variables [41]. In this chapter we will exclusively deal with tractable conditional distributions, allowing us to evaluate the numerator in Equation 6.6.
Unfortunately, the for denominator of Equation 6.6, i.e., the marginal probability , no simple formulae like Equation 6.7 typically exist. Yet, is required for the Monte Carlo estimate of the mutual information. The only way of computing exactly from the conditional probability density is via marginalization over the input paths:
In practice, directly evaluating this integral is typically infeasible. A simple “brute force” Monte Carlo estimate of Equation 6.8 can be obtained by sampling from and computing
For this estimate converges to . This direct Monte Carlo estimate forms the basis of Direct PWS, the simplest variant of PWS, and can be sufficiently accurate for short trajectories. However, due to the combinatorial explosion, the required amount of samples to achieve an accurate result grows exponentially with trajectory length, and thus for long trajectories the brute force estimate becomes intractable. The problem is that for a given most of the density will typically be concentrated in a very small region of -space. Therefore, for longer trajectories more sophisticated Monte Carlo samplers must be used to achieve good results. Two more powerful variants of PWS were introduced in Chapter 3.
While PWS is a powerful exact method to compute the mutual information between trajectories, it cannot be applied directly to experimental data. The need for a stochastic model that provides an expression for represents the most significant challenge for the use of PWS in practice. In many cases, a detailed mechanistic or phenomenological model of the experimental system is not available. To overcome this problem, we learn a stochastic model from data which can then be used in combination with PWS to compute the mutual information rate directly from experimental time series data.
6.2.3 Autoregressive neural networks for stochastic sequence modeling
For computing the mutual information between trajectories using PWS, we require a generative sequence model that specifies the stochastic dynamics of the input-output mapping. We assume that the input distribution is known and can be sampled from. In experimental practice, we often have control over the input that is delivered to the system. The challenge is thus in accurately modeling the unknown stochastic dynamics of the system.
Hence, we require a model which, given an input sequence , models the statistics of the stochastic output sequence , i.e., we want a generative model for the distribution . However, for large the space of multivariate distributions in is vast, and we need to make simplifying assumptions to be able to fit a stochastic model to observed data. We develop a trainable machine learning model to obtain a generative sequence model from experimental data that meets the requirements for using PWS.
We can factorize the joint probability of a sequence as
i.e., the stochastic dynamics are fully specified by the conditional stepping probabilities. Note that in a physical system obeying causality, the output cannot depend on future inputs. Thus, we can simplify Equation 6.10 to
A common approach for modeling stochastic sequences is to assume Markov statistics, meaning each element depends only on its immediate predecessor, simplifying the conditional to . In the case of a stationary system, the transition probability is the same for all , such that only one scalar distribution needs to be specified to define the Markovian process. While this assumption significantly reduces the complexity of the distribution space, Markov models are severely limited in that they cannot accurately model sequences with long-range dependencies or feedback. Yet, these non-Markovian features are often crucial to describe physical or biological processes.
Hence, we use a more general approach to directly learn Equation 6.11 and parameterize the probability at each time using neural networks. These models are called autoregressive models and have been used for modeling the probability distribution of sequential data in a large variety of contexts [37,38,42,43]. To efficiently model a sequence, we need to make two main choices: (a) which parametric family of distributions to use for modeling each conditional probability, and (b) which neural network architecture to use for obtaining the parameters for the chosen family of distributions, at each time.
6.2.3.1 Gaussian autoregressive model
The choice of the parametric family of distributions depends on the nature of the data. For example, for scalar continuous data, a Gaussian distribution might be appropriate, whereas for discrete data, a categorical distribution is more suitable. More complex data might require richer distributional families, such as autoregressive flows or variational approaches, which allow for more flexible modeling of dependencies between sequence elements. For this chapter, we assume that the experimental data is scalar and continuous and can be sufficiently well modeled by Gaussian conditional distributions.
Hence, we consider an autoregressive model where each conditional distribution is Gaussian. For , the model uses a neural network to predict the mean and standard deviation of the current sequence element , given the previous elements. Thus, conditional on the input and its predecessors, the variable is normal distributed, with . The functions and are implemented as neural networks and trained from experimental data.
Importantly, while each conditional distribution is Gaussian, the whole sequence is not Gaussian due to the nonlinear nature of the neural network. This means that Gaussian autoregressive models are a generalization of regular multivariate Gaussian models. In fact, a Gaussian autoregressive model can learn arbitrarily complex nonlinear relationships between the individual elements of a sequence, where the complexity is only limited by the neural network architecture. In contrast, a Gaussian model can only describe linear correlations between different sequence elements. Various neural network architectures can be used to implement the nonlinear functions and , and the choice must be made depending on the amount of training data, the complexity of the input-output mapping, as well as computational constraints.
6.2.3.2 Network architecture
The network architecture is crucial because it directly determines the number of neural network parameters (or weights) that need to be learned. This, in turn, affects both the flexibility of the model and the computational efficiency of training and inference. A more flexible architecture, with a larger number of weights, can potentially capture more complex relationships in the data but comes with the tradeoff of increased computational cost and the risk of overfitting.
In principle, for modeling a sequence of length , learning an autoregressive sequence model would require training separate neural networks, one for each conditional distribution , with . In practice, shared weights can drastically reduce the number of parameters to be learned. If the sequence is stationary or has other types of periodic features, the neural networks corresponding to different time steps can often share a majority, if not all, of their weights. This drastically simplifies training and evaluation of the autoregressive model.
We discuss two neural network architectures (schematically in Figure 6.1) that are widely used for stochastic sequence prediction and make use of weight-sharing to reduce computational costs: recurrent neural networks (RNNs) and autoregressive convolutional neural networks (CNNs). Other sequence models like transformer models [44,45] could similarly be used but are not presented here.
6.2.3.2.1 Recurrent neural networks
Recurrent Neural Networks (RNNs) process sequential data while maintaining a hidden state that evolves over time. At each time step, an RNN takes the current input and the previous hidden state to produce an output and update the hidden state. This mechanism allows the network to store relevant information about past inputs in the hidden state, effectively creating a form of memory. This makes the use of RNNs attractive for generic autoregressive sequence prediction models.
Given the sequences and the RNN takes an initial state and generates a sequence from a recursive relation
where for and an activation function . The activation function could for instance be parameterized by a simple neural network layer
with parameters and applying elementwise. Other possible choices for include LSTM units [46] or GRU units [47] which often allow the model to better learn long-term dependencies.
From the RNN we can obtain a stochastic representation of the output sequence . We extend the recursive relation above by adding a sampling step to obtain from
such that each is a normal-distributed random variable whose mean and standard deviation are computed from the current hidden state . In practice we use the following form for and
where the weights and are -dimensional row vectors and the exponential function ensures that the standard deviation is always positive. We denote the combination of all neural network parameters by .
The recursive relations fully define the conditional probability distribution of the output sequence given the input sequence. Since depends on and , as well as , it encodes information about the entire past and . Therefore, the model can incorporate long-range information for predicting the next output.
6.2.3.2.2 Convolutional neural networks
Autoregressive convolutional networks model sequential data using masked 1D-convolutions. The masking ensures that the prediction at each time step only depends on the current and preceding elements of the sequence, maintaining causality. Unlike RNNs, which process sequences one time step at a time, CNNs can efficiently compute representations of the entire sequence in parallel, leading to substantial improvements in computational speed. This parallelism is particularly advantageous when working with long sequences. The architecture we describe here is inspired by MADE [48], as well as PixelCNN [37].
The autoregressive CNN processes the data by applying a series of masked convolutional layers. At time step , the CNN predicts the Gaussian parameters which describe the conditional . The mask is applied to each convolutional layer and restricts connections to only inputs in the past, or previously predicted outputs, i.e., non-causal connections are masked out by setting their weights to zero. The output of the first convolutional layer at time step depends on the local receptive field of the input and output sequences, where is the kernel size, i.e.,
where represents the 1D convolutional operation with learnable parameters . The operation is composed of a set of learned convolutional filters and a non-linear activation function such as ReLU. Unlike for a RNN is not computed via a recursive relation since does not depend on . Thus, we need a different mechanism to capture long-range dependencies.
Typically we apply multiple convolutional layers in series. This enables the model to capture long-range dependencies beyond the kernel size in the input sequence, as the depth of the network increases the temporal span of the receptive field. Moreover, stacking convolutional layers with non-linear activation functions allows the model to learn more complex representations of the data, potentially improving the accuracy of the model.
To generate the output sequence , we add a sampling step similar to the RNN case. Specifically, the output at each time step is sampled from a distribution parameterized by the corresponding output from the CNN :
The resulting conditional probability distribution is fully defined by the convolution weights and the sampling step.
6.2.3.3 Evaluating and training the network
The autoregressive neural network described above can be viewed as generative models that approximate the conditional distribution , i.e., we can use them to draw independent samples from where represents the network weights. Generating given is done sequentially. For , the sampling procedure alternates between computing the parameters of the conditional distribution, , , and sampling the next .
The conditional probability of the resulting output sequence is given by
This probability can be evaluated on the fly while generating the sequence. Moreover, for a given pair of input and output sequences, we can also use the model to directly evaluate which is required for PWS. Note that in practice, to numerically accurately compute a product with many terms it is typically necessary to perform the computation in log space.
Note that while generating a sequence is inherently a sequential process, the path likelihood can be evaluated in parallel in some neural architectures like the CNN. Specifically, for a given pair of sequences , the conditional probability in Equation 6.18 is parallelizable, since the computations for and for are independent of each other. This allows for efficient training on parallel computing hardware.
To train the model, we minimize the negative log likelihood of its predictions when evaluated on the training data. Specifically, we assume that the training data consists of pairs of sequences for . The loss function to be minimized is then given by the sum of the individual negative log likelihoods for the trajectory pairs:
This training objective is equivalent to minimizing an empirical estimate of the Kullback-Leibler (KL) divergence between the distribution of the training data and the distribution defined by the model, thus training the model to fit the underlying data distribution [49].
There are a few practical considerations for efficiently training the model. Training is performed in iterations and it is often beneficial to introduce stochasticity between iterations to speed up gradient descent and regularize the loss function to prevent overfitting [50,51]. For this reason, as typically done for training neural networks, the loss function in Equation 6.19 is only computed for a subset of the training data, in mini-batches of size , instead of the whole training set of size . At the beginning of each iteration, the data subset that is used is randomly selected (without replacement) from the whole data set.
6.2.4 Efficient Marginalization Using Variational Inference
In the preceding section, we have shown how machine learning techniques can be leveraged to obtain a Path Weight Sampling (PWS) estimate of the mutual information rate directly from empirical data. By employing machine learning algorithms to learn the underlying stochastic model of the data, we enable accurate computation of the mutual information rate using the PWS framework.
In this section, we employ machine learning differently, to optimize the PWS method itself. Specifically, we address the computationally most demanding task: the evaluation of the marginalization integral. While we have presented alternative techniques for computing this integral in Chapter 2, Chapter 3, here we leverage recent advances in machine learning and introduce an efficient marginalization strategy based on variational inference.
The idea of the variational marginalization procedure is to train a second neural network, the inference model, that parameterizes an importance sampling distribution over to enable the efficient computation of the marginal probability . This inference model, often referred to as the backward model, operates in reverse directionality to the actual system, i.e., it generates an input given an output. This is in contrast to the previous section, which focused on generative models for the output given the input sequence, governed by . Roughly, the inference network takes an output trajectory and generates input trajectories that could have likely produced the corresponding output. When this network is used as an importance sampler, we can significantly accelerate the computation of the marginal probability and thus the mutual information. We denote the inference model’s generative distribution as .
To compute the marginal probability with help of the inference model, we write as the expectation with respect to a probability density , i.e.,
where can be chosen arbitrarily in principle. Equation 6.20 is estimated using Monte Carlo sampling, by using the inference network to generate a set of trajectories from and computing the respective importance weights according to where
The marginal probability is then estimated by
In this process, serves as the importance sampling distribution. Regardless of the choice of , this estimate always converges to in the limit . However, crucially, for finite the choice of determines the variance and thus efficiency of the estimate.
If, as done in Direct PWS (Chapter 2), we choose the “prior” probability as the importance sampling distribution, the resulting estimate is typically highly inefficient. This is because with that choice the importance weights are usually very unevenly distributed, with heavy tails which significantly increases the variance of the estimator, see also Chapter 3. It is well-known that the prior is generally a poor importance sampling distribution since it often allocates significant probability mass to regions of the configuration space that contribute little to the likelihood [52,53]. The hypothetical optimal choice for the importance sampling distribution is the true “posterior” distribution , as this makes the importance weights constant, resulting in a theoretically zero variance estimator. However, since the true posterior is typically intractable, we instead aim to approximate the posterior by a tractable distribution, to reduce the variance as much as possible.
The idea of variational inference is to train the inference model using a loss function that minimizes the Kullback-Leibler (KL-)divergence between the variational distribution and . Since the KL-divergence is always non-negative, and is only exactly zero if , this criterion optimizes the importance sampling distribution. The idea of using an inference network to approximate the posterior was popularized with the introduction of the variational autoencoder (VAE) by Kingma and Welling [54], a powerful technique for approximating complex distributions. The training objective used in variational inference is the Evidence Lower Bound Objective (ELBO) which provides a lower bound on the “evidence” . Maximizing this bound brings the variational approximation closer to the true posterior. The ELBO can be derived by applying Jensen’s inequality to the last line of Equation 6.20:
It is easy to show that maximizing the ELBO is equivalent to minimizing the KL-divergence between the variational distribution and the true posterior. Although the estimate in Equation 6.22 is always unbiased, i.e., it converges to the marginal probability as regardless of the choice of , in practice, convergence will be slow unless the inference network accurately approximates the posterior. Thus, optimizing the inference network by maximizing the ELBO is crucial for efficient marginalization.
To closely approximate the posterior, the inference network needs enough flexibility to capture the key features of the true posterior. Efficient marginalization in trajectory space, in particular, requires an inference network capable of modeling high-dimensional distributions with complex dependencies between variables. Specifically, for efficiently marginalizing in trajectory space, we require an inference network that can model high-dimensional distributions with complex dependencies between variables. However, selecting an appropriate inference network can be challenging: if the network lacks sufficient flexibility, it may oversimplify the posterior, which may be hard to diagnose. Various approaches for designing flexible inference networks have been studied previously and could be applied here [55–61].
In our example, we use an inference model for marginalization that closely resembles the generative model discussed in the previous section and uses an autoregressive sequence model for . The inference network consists of a RNN-based encoder-decoder architecture [62] which helps in approximating the posterior by effectively using the information in to guide the generation of .
The encoder, a RNN, first processes the sequence in reverse to create a latent representation , which provides contextual information to the decoder. This latent sequence is used by the decoder to generate a new sequence that is compatible with . Because the encoder processes in reverse, the latent sequence enables the decoder to incorporate information about all future values for into each . Importantly, by including future information from to sample , we can effectively capture the dependence structure of the true posterior into our variational approximation. Thus, using an encoder is a key ingredient for accurately approximating the posterior.
The decoder then autoregressively generates the sequence , using the context sequence provided by the encoder. Thus, each is generated conditioned on both and the previously generated . As in the forward model, is generated probabilistically; however, rather than a Gaussian distribution, the decoder uses a mixture of logistic distributions, inspired by the Flow++ architecture [63]. This encoder-decoder setup provides a flexible, expressive model capable of accurately approximating the posterior distribution.
Given that all parameters in our model are continuous, we optimize the weights of the inference network using stochastic gradient variational Bayes (SGVB) [54], a widely used method for training variational models. SGVB leverages the reparameterization trick to estimate the gradient of the ELBO, which makes the training procedure efficient.
6.3 Application to a Minimal Nonlinear Model
We evaluate our approach using synthetic training data to train a generative model and then using PWS to compute the mutual information rate.
6.3.1 Nonlinear Model
To generate training data for the neural network, we combine a linear auto-regressive input, with a stochastic nonlinear output model. Specifically, we considered an input that evolves according to AR(1) statistics:
where are iid random variables from a unit Gaussian distribution, and is a parameter. In steady state, the autocovariance of this process is given by
The output is governed by the equation
where are iid Gaussian random numbers, , and are positive real parameters, and
is the logistic function. The gain effectively controls the strength of the nonlinearity; see Figure 6.2. This process models a response that saturates as the input grows. In fact, is equivalent to the Hill function commonly used in biochemistry to describe saturating enzyme kinetics [64].
6.3.2 Training the Neural Networks
We trained our machine learning model with synthetic data generated according to Equation 6.26 for various values of the gain, denoted by . For each value of , we created a distinct training set of 1000 pairs of time series and trained one autoregressive model per training set. Once the models were trained, we estimated the mutual information for each of them using PWS, employing variational inference to perform the marginalization.
For the generative model, we use a recurrent neural network (RNN). Using Gated Recurrent Unit (GRU) cells [47] with a hidden size of 64 for temporal processing, along with a dense layer that outputs two values, representing the mean and log-variance of a Gaussian distribution. For each time step , the model receives input signals and and predicts the next output value by sampling from this Gaussian. The model is trained by iteratively optimizing over 100 epochs over the entire training set. The training set is split into mini-batches of size 64 which are shuffled after each epoch. We optimize the model using the Adam optimizer [65] () with weight decay regularization [66] of 1 × 10−4 and using a cosine decay learning rate schedule [67] that smoothly decreases the learning rate from 1 × 10−2 to 1 × 10−3 throughout the training process.
The inference model used for marginalization is also modeled as a RNN. This model consists of an encoder-decoder architecture for approximating the posterior . The encoder first processes the input sequence in reverse using a GRU cell with 64 hidden units to create a latent sequence . The decoder then uses another RNN with a hidden size of 64 (using a GRU cell), to autoregressively generate a sequence using the context sequence . The sequence is generated probabilistically by sampling from a mixture of logistic distributions with five components. The inference network is trained for 100 epochs with mini-batches of size 64. For each in the training set, 16 Monte Carlo draws from the inference network are used to estimate the ELBO loss in Equation 6.23. The loss function gradient is estimated using SGVB [54]. The model is optimized using the ADAM optimizer with weight decay regularization (same parameters as above). We use an initial learning rate of 5 × 10−3 that decays exponentially by a factor of 0.5 as training progresses.
To compute the marginal probability from our models, we use the inference network to generate samples for each sequence . From these samples , the marginal probability is estimated using Equation 6.22. We monitor the convergence of the variational marginalization procedure by computing the effective sample size from the importance weights [68]. In our case, the effective sample size always remained above 85% of the actual sample size, indicating that the inference network approximates the posterior well.
6.3.3 Comparison Against the True Mutual Information
The green dots in Figure 6.3 display the ML-PWS estimate of the mutual information as a function of the gain , see Equation 6.26. As expected, for small , the mutual information grows with as the gain enhances the signal-to-noise ratio. For larger values of , we observe a saturation and even a decline in the information rate due to the saturation effect of the logistic function. This behavior is indicative of the nonlinearity of the system.
Next, we compared the mutual information estimates against various benchmarks. First, we compute the true mutual information of the nonlinear system using PWS directly with the model given in Equation 6.26. Since this model represents the true underlying dynamics of the training data, we consider this result as the “ground truth” mutual information.
Figure 6.3 (solid green line) shows the ground truth mutual information. We can see that the machine learning approach matches the ground truth very well across all values of . This demonstrates that the autoregressive neural network can accurately learn the stochastic dynamics of the nonlinear model and reliably estimate the path likelihood, which is required for the Monte Carlo estimate of mutual information. These results confirm that combining PWS with machine learning is a feasible and promising approach for computing the mutual information rate in complex nonlinear systems.
6.3.4 Comparison Against the Gaussian Approximation
Second, we use the Gaussian approximation as a benchmark, which is widely used for directly estimating mutual information rates from time-series data. We obtain the Gaussian estimate by computing the covariance matrix
from our dataset of trajectories . The individual blocks of are matrices defined by . The Gaussian approximation for the mutual information (in nats) is given by
See ?sec-notes-gaussian for more details.
To make a fair comparison of our machine learning method with the Gaussian approximation, we use the same dataset for obtaining the Gaussian approximation that was used for training the ML model. We refer to this benchmark as “Gaussian I” and it corresponds to the dotted orange line in Figure 6.3. The Gaussian approximation suffers from two sources of systematic bias: a finite sample size bias due to imperfect correlation function estimates from 1000 trajectory pairs, and a bias arising from the assumption of linearity which does not hold at large . Our aim was to distinguish these two sources of bias.
We created another benchmark, called “Gaussian II” (dashed orange line in Figure 6.3) to be able to quantify the bias introduced by the small sample size of the “Gaussian I” benchmark. Gaussian II is similar to Gaussian I but is obtained from a significantly larger dataset of 100000 trajectory pairs , generated from the nonlinear model. This larger dataset allows for very precise estimates of the (cross-)covariance matrices required for the Gaussian approximation, effectively eliminating the sample size bias. However, it should be noted that this benchmark is “unfair” since it uses a much larger dataset than the one that was used to train the autoregressive ML model.
In Figure 6.3 we compare the results obtained using PWS against the two variants of the Gaussian approximation, and we observe that for the Gaussian approximations (the regular one, Gaussian I, and the one with reduced bias, Gaussian II) closely match the ground truth while significantly deviations appear at larger gain. Indeed, in the low-gain regime, the nonlinearity of the system does not significantly impact the output, the Gaussian approximation provides a reliable estimate of the information. In the high-gain regime, the Gaussian approximation fails to correctly capture the nonlinear dynamics of the system, and only yields a lower bound for the mutual information, as expected from information theory [69].
Figure 6.3 also clearly displays the effect of finite sample size on the accuracy of the Gaussian approximation. Specifically, the Gaussian approximation obtained from the smaller training dataset (Gaussian I, displayed as dotted orange line in Figure 6.3) consistently overestimates the mutual information as computed with the Gaussian approximation from the larger dataset (Gaussian II, dashed orange line in Figure 6.3). This means that at low gain, even though the system is approximately linear, the Gaussian approximation obtained from the training set slightly overestimates the true mutual information. This over-estimation is purely an artifact of finite sample size bias, and is not present in the “reduced-bias” Gaussian approximation. Strikingly thus, our new method based on machine learning yields a better estimate for the mutual information using the training set, even at low gain, where the Gaussian approximation is expected to hold.
6.4 Discussion
By combining neural networks with PWS, we introduced ML-PWS, a new scheme to estimate the mutual information between input and output trajectories of a system. PWS is a Monte Carlo method for calculating mutual information between trajectories, relying on a stochastic model that defines the probability distribution of trajectories to determine the path action. We demonstrated how autoregressive sequence prediction models can be trained on time-series data to learn this stochastic model, making it possible to use PWS with such models to compute mutual information. By applying ML-PWS to a nonlinear model of information processing, we showed that it provides more accurate mutual information estimates than the Gaussian approximation. While this example serves as a proof of concept, it shows the potential of advanced machine learning techniques to automatically derive stochastic models from experimental data, and to make it possible to compute information-theoretic measures for complex, high-dimensional data.
Using the mutual information rate as a measure for time series correlation possesses a distinct advantage compared to other, simpler, measures: it remains invariant under deterministic and lossless transformations of the sequences [70]. Not only is this property desirable on philosophical grounds, but it can also simplify the training of machine learning models. Specifically, in some cases, it could be beneficial to preprocess the time series data by transforming it into a different representation (e.g. a symbolic encoding) that is more conducive to machine learning analysis [71]. Such a transformation could be applied before employing ML-PWS to compute the mutual information rate. Additionally, this concept could be used for model reduction, making it possible to answer the question of whether a time series with a simplified representation still maintains the same mutual information rate.
As our results in Figure 6.3 demonstrate, ML-PWS with Gaussian autoregressive models is significantly more general than the Gaussian framework [2]. The range of stochastic processes representable by neural autoregressive models is much larger than the range of processes which can be described by a Gaussian model. Even though in the autoregressive model the distribution of each conditional on and is Gaussian, the distribution of the whole sequence is generally not Gaussian due to the nonlinearity of the neural network. In fact, a Gaussian autoregressive model can be seen as a (time-discretized) representation of a nonlinear stochastic differential equation of the form
where and are the potentially nonlinear drift and diffusion terms that are learned by the neural network. This representation is a generalization of the Gaussian framework, which assumes and to be linear operators.
Nonetheless, assuming that each is normally distributed given its and the signal’s history, does restrict the expressive power of the model. For instance, such a model can never represent multimodal predictive distributions or discrete state spaces. In these cases, other predictive distributions must be chosen.
ML-PWS shares some characteristics with the Difference-of-Entropies (DoE) estimator for the mutual information proposed by McAllester and Stratos [34]. Let and be (high-dimensional) random variables and the desired mutual information computed as a difference of entropies. In both ML-PWS and the DoE method, the generative model for the conditional probability is trained by maximizing the likelihood, an objective that, as shown in Ref. [34], results in an upper bound of the conditional entropy . However, unlike ML-PWS, McAllester and Stratos [34] use a second generative model that represents the marginal probability , yielding an upper bound of the marginal entropy . PWS instead computes the marginal probability by marginalizing the joint probability . In this way, can in principle be computed for any desired accuracy. This direct marginalization in ML-PWS also enables efficient computation of the mutual information between a input signal with different statistics and the corresponding output , without needing to re-train the marginal model. This is particularly useful if one is interested in the channel capacity, as determined by the input distribution that maximizes the mutual information or information rate for the system of interest. Indeed, in systems without feedback, is a property of the system and does not change upon changing the input. The generative model then remains the same, such that ML-PWS can directly recompute the mutual information for different input statistics. Determining which of these approaches is preferable for estimating mutual information remains an open question for future research.
Alongside ML-PWS, we introduced a new marginalization scheme for PWS, leveraging techniques from variational inference. In PWS, marginalization is used to compute the marginal probability of a trajectory, . Our approach trains an inference network to generate input trajectories approximately distributed according to the posterior distribution , enabling efficient calculation of through importance sampling. Importantly, this marginalization technique is general and can be applied to any generative model, regardless of whether it is based on neural networks. This flexibility makes it a powerful marginalization scheme for any application of PWS to a system with continuous state space. Furthermore, since marginalization is mathematically equivalent to a free-energy computation (see Chapter 3), our approach demonstrates that variational techniques can yield efficient methods for free-energy estimation.
In conclusion, ML-PWS—our integration of neural networks and variational inference into the PWS framework—represents a promising advance for estimating the mutual information of high-dimensional data, a notoriously difficult problem. While our initial tests on a toy example demonstrate the technique’s potential, further evaluation on more complex systems is needed. Additionally, comparing ML-PWS with other neural methods for mutual information estimation will help clarify its advantages and limitations. By enabling the accurate computation of the mutual information rate, we anticipate that ML-PWS could contribute to a deeper understanding of complex dynamical systems, with potential applications spanning neuroscience, biology, physics, and machine learning.