Bayesian network Fisher kernel for categorical feature spaces

We address the problem of defining similarity between vectors of possibly dependent categorical variables by deriving formulas for the Fisher kernel for Bayesian networks. While both Bayesian networks and Fisher kernels are established techniques, this result does not seem to appear in the literature. Such a kernel naturally opens up the possibility to conduct kernel-based analyses in completely categorical feature spaces with dependent features. We show experimentally how this kernel can be used to find subsets of observations that we see as representative for the underlying Bayesian network model.


Introduction
Variables such as color, nationality and species that are measured on a nominal scale do not allow for an obvious definition of distance. Consequently, there is no obvious solution for measuring similarities between random vectors whose components are measured on the nominal scale. In this paper, we propose computing similarities of the nominal scale random vectors using a Fisher kernel based on discrete Bayesian networks (Pearl 1988

3
Fisher kernels (Jaakkola and Haussler 1998) were originally motivated by the need to build classifiers for objects of different lengths/sizes. They have since been used to classify proteins, speakers, documents, images, tree structured data, etc. A survey by Sewell (2011) provided a brief review. Much of the development has been concentrating on classification of different kinds of objects, but kernels can also be used for many other things such as regression, clustering or dimensionality reduction. Each different model requires a separate derivation of the formulas that show how the Fisher kernel is computed for the data items modeled by the particular model. To our knowledge, the derivation of the Fisher kernel for general Bayesian networks has not been presented before. We will also present formulas for measuring similarity of two sets of observations modeled by a Bayesian network.
In practice, Bayesian network models are often learned automatically from the data. However, common model selection criteria do not necessarily identify the Bayesian network model completely, but they generally return a class of "equivalent", but differently parametrized, Bayesian networks or a random member of such a class. While the Fisher kernel in general is known to be sensitive to the parametrization, we will show that any member of such an equivalence class yields the same Fisher kernel.
In the following, we will first review the related work on the multivariate categorical similarity/distance measures. We will then quickly introduce notation for Bayesian networks and state the main formula for computing a Fisher kernel based on it. We present the derivation and an important result of insensitivity to the choice of equivalent structure. Then, we show how the kernel generalizes to comparing sets of observations and discuss the connection to a kernel-based distance measure called maximum mean discrepancy. We also describe a simple greedy algorithm which can be used for finding representative sets of observations with the help of the set kernel. Finally, we make use of the algorithm in experiments, where we try find representative sets for various Bayesian network structures. Boriah et al. (2008) have reviewed several similarity measures for discrete vectors, many of which have implemented some kind of weighting of different variables, but none of which took dependencies between variables into account. The work on similarities that takes dependencies into account seems to do so by considering pairwise similarities only (Niitsuma and Okada 2005;McCane and Albert 2008;Desai et al. 2011;Ring et al. 2015). This is in sharp contrast to the Fisher kernel for Bayesian networks that can model dependencies between many variables.

Related work
Fisher kernel for discrete data is not a new idea. Fisher kernels have been derived, for example, for hidden Markov models (Jaakkola et al. 2000) and probabilistic latent semantic indexing (Chappelier and Eckard 2009). While these models can be used for vectors of categorical dimensions, their bias is designed with respect to a special latent variable that implements labeling, clustering or topic detection. As dependency models, their structure implies that all the observed variables are (marginally) dependent on each other. Since Bayesian networks try to capture a more explicit dependency structure, the Fisher kernel-based similarity also becomes different.
In addition to Fisher kernels, other approaches to building kernels with the aid of probabilistic models include probability product kernels (Jebara et al. 2004) and diffusion kernels (Lafferty and Lebanon 2005).

Fisher kernel for Bayesian networks
Bayesian networks are multivariate dependency models over n random variables D = (D 1 , … , D n ) . In our setting, each D i is a categorical variable taking one of the r i values from {1, … , r i } . The Bayesian network B = (G, ) consists of a directed acyclic graph (DAG) G and parameters . In the graph G, the nodes 1, … , n correspond to the components of D and the arcs encode dependence structure among the variables. We let i denote the parent set of node i (i.e., the nodes from which there are direct arcs to node i). Letting i (D) denote the parent variables and enumerating all the possible parent variable configurations from 1 to q i , this structure is then populated with parameters so that each value k of variable D i and each value configuration j of i (D) is attached to a parameter ijk so that: where i (D) = j means that the parent variables take values according to the jth configuration. For a data point d, we use P(d; ) as a shorthand for P (D = d; ).
Using an indicator function I d (x) , that takes value 1, if d = x , and 0 otherwise, we can write the likelihood function for d as: We assume all the parameters ijk to be strictly positive.

Fisher kernel
A Fisher kernel is a way to define the similarity of a pair of items based on a parametric statistical model. We will first review the definition of Fisher kernel and then right after that present the form that the Fisher kernel takes when this parametric model is a Bayesian network over discrete variables. The actual derivation is presented in the following section.
Definition 1 For a model P(d; ) , parametrized by a vector of parameters, a Fisher kernel K(x, y; ) is defined as: K(x, y; ) = s T (x; )I −1 ( )s(y; ).

3
In the definition, the score s(x; ) is a column vector of partial derivatives of the log likelihood, i.e., s(x; ) i = i log P(x; ) , and the I( ) is a so-called Fisher information matrix (Cover and Thomas 2006) with elements: For the Bayesian networks, we obtain the following: Theorem 1 Let M = (G, ) be a Bayesian network over variables D = (D 1 , … , D n ) with parent sets ( 1 , … , n ) . Now, the Fisher similarity for two n-dimensional discrete vectors x and y modeled by M, can be computed as a variable-wise sum where The formula above may lead to dividing by zero, but only in case of comparing items that the model deems impossible by assigning them the zero probability (which is however excluded under our assumption ijk > 0).
The joint probabilities P( i (x); ) are not readily available in Bayesian networks, but must be computed, which in general is an NP-hard problem (Cooper 1990). However, many practical implementations of the Bayesian network inference are based on the junction tree algorithm (Lauritzen and Spiegelhalter 1988), which features a static data structure that contains the joint probabilities for sets (called cliques) that contain parent sets as their subsets. Therefore, the probabilities P( i (x); ) can be marginalized from the clique probabilities. When such an exact inference is computationally too demanding, approximate inference techniques can be used.

Outline of the derivation
In this section, we will go through the derivation of Bayesian network Fisher kernel on a high level. To reduce clutter, some details of the derivations are postponed to Appendices.

Univariate Fisher kernel
While our interest is in a multivariate model, much of the derivation can be reduced to computing the Fisher kernel for a single categorical variable with r possible values, since a Bayesian network can be represented as a collection of conditional probability tables, and the tables themselves consist of univariate categorical distributions. Therefore, we will first study the simple univariate case.
The main result of this section is formulated as follows.
Lemma 1 Assume D is a single categorical variable taking values from 1 to r with probabilities = ( 1 , … , r ) where k > 0 and ∑ r k=1 k = 1 . Now, the Fisher similarity for two observations x and y is given as: Proof We will proceed in a straightforward fashion, dividing our proof into three parts: (1) We first compute the gradient of the log likelihood; (2) then find an expression for the inverse of Fisher information matrix; (3) and lastly, combine these to get the statement of Lemma 1.

Gradient of the log likelihood
Let d denote a value of D. We can express the likelihood as: where r is not a real parameter of the model but a shorthand notation Taking the partial derivatives wrt. k yields: Using e k to denote k th standard basis vector of ℝ r−1 , and for the vector of all ones, the whole vector s(d; ) can be written as:

or using indicators
It is worth emphasizing that each partial derivative depends on the data vector d, but is a function of the parameter . It may be useful to further reveal the structure by writing: So depending on the data item d, the partial derivative s(d; ) k is one of the three functions of above.

The Fisher information and its inverse
The Fisher information matrix for the multinomial model (which is equivalent to our categorical case when the number of trials is 1) takes the form (Bernardo and Smith 1994, p. 336): and its inverse is given as: Bernardo and Smith (1994) omit the explicit derivations of (4) and (5). We will present the derivation of I( ) in Appendix A. The inverse can be obtained from this by noting that I( ) is expressible as a sum consisting of two terms: an invertible (diagonal) matrix and a rank one matrix. Inverting a matrix with this structure is straightforward (Miller 1981). Even more straightforwardly, computing the matrix product, I( )I −1 ( ) , and verifying that it gives an identity matrix proves that inverse of I( ) has to have the form given in (5). For further purposes, it is useful to write the elements of I( ) as: where we used Kronecker delta symbol xy that equals 1, if x = y , and 0, otherwise. ◻

The kernel
The last thing left to do is to combine our results to get the expression for the univariate kernel K(x, y) = s T (x; )I −1 ( )s(y; ) . As the gradient s(d; ) takes different forms depending on the value d, it is maybe the easiest to enumerate all the cases corresponding to different combinations for values x and y. After considering all the cases, it turns out that the kernel will take different forms depending on whether x = y or x ≠ y . This derivation is done explicitly in Appendix A. We will just state the final result here, which is also the statement of Lemma 1: We notice that dissimilar items are always dissimilar at level −1 , but similar items are similar at level [0, ∞] . The similarity of a value to itself is greater for rare values (rare means that x = P(D = x; ) is small).

Multivariate Fisher kernel
We will now move on to the derivation in the multivariate case, leaving again some details to Appendix B. As seen from Eq. (1), the log-likelihood function for Bayesian networks is: where ijr i is never a real parameter but just a shorthand ijr i ≡ 1 − ∑ r i−1 k=1 ijk . From Eq. (7), it is easy to compute the components of score using the calculations already made in the univariate case. This gives: which also has the familiar form from the univariate case, apart from the extra indicator function due to the presence of parent variables. To get some intuition from the above equation, we can write it case by case as:

Fisher information matrix
The derivation of Fisher Information matrix also proceeds along the same lines as the univariate case. The indicator function corresponding to the parent configuration results in the marginal probability of parent variables appearing in the formula. Details can be found in Appendix B. The end result is as follows: where ij,xy = ix ⋅ jy is generalization of Kronecker delta notation to a series of integers. By looking at Eq. (9), we see that the matrix has a block diagonal structure. There is one block corresponding to each parent configuration for every variable. For vari- (with all the values multiplied by P( i (D) = j) ). So each block looks just like the matrix in the univariate case (see Eq. (4)), which we have already inverted.

Inverse of the Fisher information matrix
The inverse of a block diagonal matrix is obtained by inverting the blocks separately. Applying the univariate result for each of the blocks, we obtain that the ijth block has the form: where ij A is a diagonal matrix with entries ij A kk = ijk and ij F kl = ijk ijl .

Fisher kernel
In calculating the K(x, y; ) = s(x; ) T I −1 ( ) s(y; ) , the block diagonality of the I −1 ( ) will save us a lot of computation. We therefore partition the score vector into sub-vectors s(d; ) i that contain partial derivatives for all the parameters and then further subdivide these into parts s(d; ) ij . Since the kernel K(x, y; ) can be expressed as an inner product ⟨s(x; ) T I −1 ( ), s(y; )⟩ , we may factor this sum as: It is therefore sufficient to study the terms K i . Since in s(x; ) i only the entries corresponding to the indices (i, i (x)) may be nonzero, the same applies to the row vectors [s(x; ) T I −1 ( )] i due to the block diagonality of I −1 ( ).
That automatically implies that the computation reduces to the univariate case for K(x i , y i ; ij ) , after taking the factors P( i (D) = j) in a Fisher information matrix blocks into account. Here Summarizing these results, we get K(x, y; or more compactly

Invariance of Fisher kernel for equivalent network structures
A distribution may sometimes be represented by different parametrizations of different Bayesian network structures. We say that two network structures G 1 and G 2 are equivalent if for every parametrization θ 1 of G 1 there exists θ 2 for G 2 so that the networks represent the same probability distribution, and vice versa. Verma and Pearl (1990) showed that two network structures are equivalent if they have the same skeleton (i.e., they are the same if directed arcs are turned into undirected ones), and if they have the same set of V-structures (colliding arcs from two parents that are non-adjacent to each other).

Fisher kernel for non-equivalent structures
It is known that in general the Fisher kernel depends on the parametrization of the model. We will show by an example that this is also the case in Bayesian network models when the network structures are not equivalent. Let us assume two independent binary variables, A and B, with following distributions: P(A) = (0.7, 0.3) and P(B) = (0.4, 0.6) . If we present the joint distribution with a network without any arc, the Fisher similarity for the point ( A = 0, B = 0 ) is: However, we may also express the same joint distribution in a network in which there is an arc from A to B. In this case, P(A) = (0.7, 0.3) , P(B | A = 0) = P(B | A = 1) = (0.4, 0.6) . Unlike in the previous case, the Fisher kernel term K B now takes into account the probability of the parent A, which leads to a result different from the previous case:

Fisher kernel for equivalent structures
Assume next that network structures of models M 1 and M 2 are equivalent, meaning that the two graphs imply exactly the same assertions of conditional independence. We would like to now show that in terms of the Fisher kernel, it does not matter which of these equivalent structures we use. To show this, we make use of the following property of Fisher kernels.
In other words, Fisher kernel is invariant under one-to-one reparametrizations. For the proof, see Shawe-Taylor and Cristianini (2004). To show the invariance under equivalent Bayesian network structures, it suffices to prove the following statement: Theorem 3 Let M 1 = (G 1 , 1 ) and M 2 = (G 2 , 2 ) represent two Bayesian networks with equivalent structures. Let q denote the number of free parameters in M 1 and M 2 . Given the parameters 1 for M 1 , there exists a differentiable and invertible mapping g ∶ ℝ q → ℝ q such that 2 = g( 1 ).
In fact, this result is used as an assumption by , and stated to hold in our setting where conditional distributions in the Bayesian network are unrestricted multinomials. However, an explicit proof does not appear in the paper. We give one in Appendix C. This allows us to formulate our main result of this section: Theorem 4 Let M 1 = (G 1 , 1 ) and M 2 = (G 2 , 2 ) be two Bayesian networks with equivalent structures such that they represent the same distribution over D. Let x and y denote two observations on D. Now,

Comparing sets of observations
Having derived the Fisher kernel for measuring similarity among pairs of observations and studied its properties, we next show how this kernel easily generalizes to comparing two sets of observations. This set kernel also allows us to define a distance function which has a connection to a quantity called maximum mean discrepancy. We will also present a simple greedy algorithm which can be used to find a prototypical sets of points from a larger set of candidates as measured by the similarity induced by Fisher kernel.

The univariate set kernel
Let X = (x 1 , … , x N ) and Y = (y 1 , … , y M ) , where x l and y m are i.i.d. observations on a categorical random variable. Since the log likelihood of i.i.d set of cases is the sum of member log likelihoods, it is rather easy to show that the Fisher kernel for two data sets is the average of Fisher kernels of pairs in the sets (Chappelier and Eckard 2009). If we compare a data set X of size N with N k occurrences of the value k, and another data set Y of size M which has M k occurrences of the value k, we can collect the common terms of the sum and get:

The multivariate set kernel
The i.i.d assumption applied to n-dimensional data vectors x l and y i allows us to present the multivariate set kernel as: K(x, y; 1 ) = K(x, y; 2 ), ∀x, y.
Now to express the inner sum more compactly, we need to obtain the counts of the variable configurations (as determined by the Bayesian network structure) in sets X and Y. We denote with N ijk the number of data vectors x in X for which x i = k and the parent configuration i (x) of is the jth possible one out of q i = ∏ p∈ i r p . We write N ij = ∑ r i k=1 N ijk . For corresponding counts in the set Y, we denote the counts with M ijk . We may now develop the kernel as K(X, Y; We notice that the formula in brackets is a version of the univariate set kernel, so we could write: where x ij denotes the vector of values of x i in those vectors of X where parents of x i have an index j. We need the convention that the value of set kernel is zero if either of the sets is empty.

Maximum mean discrepancy
Applying set kernel to Euclidean distance with the kernel trick (see, for instance, Shawe-Taylor and Cristianini 2004), we can compute (squared) distances between two data sets according to: where K(⋅, ⋅) refers to the multivariate Fisher kernel with the dependence on parameters omitted for brevity.
We note that distance defined in (10) coincides with the empirical estimate of maximum mean discrepancy (MMD) (Gretton et al. 2012) with the kernel function being the Fisher kernel. MMD provides a test statistic for comparing whether two sets of data come from the same distribution. With the help of a kernel function and the corresponding reproducing kernel Hilbert space (RKHS), it is defined as the maximal difference in expectations over functions in the unit ball of this RKHS. MMD is expected to be close to zero when two data sets are drawn from the same distribution and larger otherwise. We note that the theory developed by Gretton et al. (2012) builds on an assumption that RKHS (with the associated kernel K(⋅, ⋅) defined on elements of space X ) is universal. This technical assumption guarantees that the population version of the MMD is a metric for the probability distributions over X . For instance, Gaussian kernel would define such RKHS and allow us to do two-sample testing for sets of observations in ℝ n . We use the distance defined in (10) in our experiments, and refer to it as MMD, but leave further theoretical considerations (for instance, if the large sample bounds derived in Gretton et al. (2012) would be readily available to use with our Fisher kernel) to future work.

Greedy algorithm for optimizing MMD
We describe a simple greedy algorithm for finding a subset of points with small MMD from a larger candidate set. Given a set of N training examples X on variables D, and a Fisher kernel K, we try find a subset X) is minimized. If the Bayesian network from which the Fisher kernel is constructed is learned from X, this subset X S minimizing the distance can be taken to be a representative sample of the full set X as deemed by the model. We will put this statement under closer scrutiny in the experiments where we make use of the algorithm. This type of an application of using MMD for selecting prototypical samples has been also considered in Kim et al. (2016).
The greedy optimization procedure is described in Algorithm 1. The algorithm proceeds by starting from the initially given set of points X S . It then goes through the k points in X S one at a time, changing the current data point to one that results in the minimal d(X S , X) . The algorithm converges after it has looped through the k points once without being able to obtain a reduction in d(X S , X).

Experiments
The aim of our experiments is to illustrate the nature of the similarity that the Bayesian network Fisher kernel measures. By providing a valid kernel function, our kernel would be readily available for use in supervised tasks like classification or regression through any kernel-based method. The only requirement would be being able to come up with a Bayesian network over the domain. A straightforward approach would use the available training data to learn the structure of a Bayesian network and then its parameters. A score-based approach for learning the network might involve maximizing a penalized likelihood, and the parameters would be set to ones maximizing the likelihood given the structure. As noted by van der Maaten (2011), it is not guaranteed that the Fisher kernel extracted from this generatively trained model would be optimal for discriminative purposes. A generative model is trained to model the input data well, which would drive the gradients of training instances towards zero and not necessarily mean that these representations would be particularly good for discriminating between the labels of instances.
In our experiments, we use Fisher kernel as mean of gaining insight on the underlying Bayesian network by trying to identify sets of observation that are important for the model. In general, there has been lately a surge of interest in understanding and interpreting various machine learning models (Murdoch et al. 2019). As Fisher kernel measures similarity of data items from the point of view of the model, it provides a natural tool for various tasks related to model interpretation (Khanna et al. 2019).

Data summarization
We study how Fisher kernel performs in summarizing data. This experiment is inspired by the data summarization experiment in Khanna et al. (2019). Outline of the experiment is as follows. We first learn a Bayesian network M from data, build a Fisher kernel and then employ Algorithm 1 to find a subset of points that are important for M. To quantify "important", we re-train the parameters of the model using the found subset and evaluate predictive performance of the newly trained model with hold-out data. We consider different approaches for learning the network and vary the evaluation metric.
We use junction tree algorithm to obtain the parent probabilities required in the Fisher kernel. In case the constructed junction tree has a tree width larger than 10, the parent probabilities are computed by sampling data (10 6 samples) from the Bayesian network and then estimating probabilities as empirical frequencies (with pseudocount one to avoid possible zero probabilities).
As an alternative to Fisher kernel-based prototype selection, we also consider a simple heuristic based on 2 test. More in detail, when evaluating goodness of X S , we look at data on each variable in X S independently, and compute a p value from a 2 test, where observed frequencies are computed from X S and the expected frequencies from the whole set X. The degrees-of-freedom is one less the number of observed categories. The best X S would be the one maximizing ∑ n i=1 logp i , where p i is the p value corresponding to the test on the ith variable in X S (and in X). Intuition here is that a large p value indicates that the observed frequencies match the expected ones. Algorithm 1 is also used to optimize this heuristic (to be precise, the objective function is − ∑ n i=1 logp i ) . Also as a baseline, we show results for randomly selecting the subset X S .

Network learned using hill climb
In this experiment, we considered three data sets found in UCI repository: letter ( N = 20,000 , n = 17 ), nursery ( N = 12,960 , n = 9 ) and waveform-5000 ( N = 5000 , n = 41 ). The class variable present in each data set was treated as any other categorical feature. Possible continuous features were discretized to (at most) 4 bins and data was split to training and test sets ( 50%∕50% ). We then learned a Bayesian network using hill climbing 1 with BIC as a scoring function using the training data. The parameters of the network were set to smoothed (pseudo-count one) maximum likelihood estimates. The Fisher kernel was constructed using this network. We measured full set accuracy by computing per sample negative log likelihood for the test set. We then proceeded to finding representative subsets from the training data. We considered four different values for subset size k and sampled 1000 of such sets. For the each sampled set, we recorded Fisher kernel MMD distance, 2 heuristic criterion and test set log likelihood corresponding to model with parameters learned from this set. We ran Algorithm 1 for each k with MMD distance and 2 heuristic. The best of the sampled subsets (according to each criterion) was used as a starting point for the greedy algorithm.
Results are shown in Fig. 1. Random mean represents the average log likelihood computed from the randomly sampled subsets with error bar showing the standard deviation. We can see that the Fisher kernel-based MMD finds more representative subsets than the compared criteria as measured by the log likelihood.
To give a rough idea of the running times 2 of the methods in Fig. 1, it took 17, 32 and 94 seconds to compute the parent probabilities and the Fisher kernel evaluations for training data points in data sets waveform-5000, nursery and letter, respectively. Running the greedy algorithm with the MMD distance for different subsets sizes took from 8 s ( k = 200 ) to 3 min ( k = 1000 ) in data set waveform-5000. For nursery and letter, the corresponding times were from 0.2 to 5 min and from 0.7 to 19 min, respectively. For the greedy 2 method, the corresponding times ranged (in minutes) from 1 to 4, from 0.2 to 0.8 and from 1 to 5, respectively. To find the starting points for the greedy algorithms, sampling 1000 random subsets, recording both the MMD and 2 statistics took from 9 to 18 s in waveform-5000, from 20 to 34 seconds in nursery and from 45 to 101 s in letter.

Bayesian network classifiers
Next, we considered classification experiments with the aforementioned three data sets. Outline of the experiments is exactly the same, except for the network learning and the evaluation metric. After splitting the data in half, we used training data to learn a tree-augmented naive Bayes (TAN) classifier (Friedman et al. 1997) and K-dependence Bayesian (KDB) classifier (Sahami 1996). These both classes of classifiers can be represented as Bayesian networks over the class variable and the features. Each feature is connected to the class variable, and the classifiers differ in their way of modeling the dependency structure of the features. TAN uses conditional mutual information (given class variable) to find the best tree structure for the distribution of features. KDB also makes use of conditional mutual information but learns the structure in a greedy manner, connecting each feature to at most K other features. We used K = 3 in the experiments and parameters of both the classifiers were smoothed by adding one pseudocount to empirical frequencies. Given the network structures and the Fisher kernel, the representative subsets were found using the procedure described in the last subsection. Goodness of the found subset was evaluated by computing the classification error and log loss (per sample) on the test set.
The results for the TAN and KDB are presented in Figs. 2 and 3, respectively. We can see that in general the Fisher kernel-based selection criterion is able to find considerably better subsets in terms of both evaluation metrics for both of the classifiers. Especially with TAN, the classification accuracy even with the smallest subset size is close to the full set accuracy in nursery and waveform-5000 data sets. With KDB in data set nursery, the smallest subset sizes produce results close to or worse than the random sampling. On the other hand, TAN does not seem to have similar problems. One thing explaining this could be that KDB (with K = 3 ) contains more parameters, so naturally more data points are required to estimate the parameters accurately. In general, the evaluation metrics considered in this experiment are focused only on the class variable, whereas the similarity measured by Fisher kernel takes into account all the variables through their corresponding parameters. From this point of view, the  Fig. 1 Negative log likelihoods for different subset sizes and criterions in UCI datasets. Greedy methods refer to Algorithm 1 with the corresponding criterion. Full set represents the accuracy of the model trained with all the available data and random baseline is averaged result over models retrained with random subsets log likelihood used in the previous subsection provides a more natural evaluation criterion. Nevertheless, this experiment demonstrates that Fisher kernel is in most cases able to extract representative sets for discriminative purposes, too.

Conclusion
We have presented a Fisher kernel for discrete Bayesian networks and shown that it makes sense to use it with networks learned from data even if the exact DAG structure is not in general identifiable. We also presented formulas for comparing two sets of cases and connected the resulting distance to maximum mean discrepancy. In the experiments, we illustrated the nature of the similarity the Fisher kernel measures using examples that draw their motivation from interpreting Bayesian network models. The obvious future work would contain testing this kernel in a huge number of available kernel-based methods and studying further the model interpretation aspect by extending the current experiments.
We have assumed that our model does not contain hidden variables. However, when the modeled vector z = (x, h) is partitioned into an observed part x and a hidden part h, one can easily define a marginalized kernel (Tsuda et al. 2002) , which can be computed efficiently when the hidden dimension is not too large, since P(h|x) ∝ P(x, h) , which is easy to compute for Bayesian networks.
which verifies that (5) is the inverse of Fisher information.

A.3 The kernel
We start by first exploring the row vector s(x; ) T I −1 ( ) . We recall, however, that s(x; ) looks very different when x = r and x < r . It is also useful to write I −1 ( ) = A − F, where A = diag( ) and F = T . We use notation A k⋅ to denote the kth row of matrix A. Now, if x = r , s(x; ) = − −1 r , so multiplying with its transpose sums the rows of the matrix and multiplies the results with − −1 r , and we get When x < r , the s(x; ) = −1 x e x , so the s(x; ) T picks the xth row from matrices and multiplies it by −1 x ; To work our way to full s(x; ) T I −1 ( ) s(y; ) it is easiest to continue by cases: (1) If x = y = r , we get (2) If x < r = y , we get (3) Due to the symmetry of the Fisher information, for the case y < r = x : (4) Lastly, if x < r and y < r , we get: Collecting the results above gives as finally B Details on derivation of the multivariate Fisher kernel

B.1 Fisher information matrix
Computing the second derivatives of the log likelihood, thus the partial derivatives of is straightforward, once we note that

C Proof of Theorem 3
Proof Chickering showed that any equivalent structure can be reached from another by a series of covered arc reversal operations without leaving the equivalence class (Chickering 1995). An arc D i → D j is covered if j (D) = i (D) ∪ {D i } . That is, the nodes share the exactly the same parent set, with the exception that D i is not its own parent. Without loss of generality, we can now assume that G 1 and G 2 differ by a single covered arc reversal. Assume that this covered arc between D i and D j in G 1 is reversed, creating an arc D j → D i in G 2 . Let Z denote the common parents of D i and D j . We treat Z as a single categorical variable whose cardinality is the number of all the possible parent combinations. Reversing the arc affects only the parameters defining the conditional distributions of D i ( 1 i and 2 i ) and D j ( 1 j and 2 j ). All the other parameters in 1 can be mapped to 2 using an identity function.
If we multiply the conditional distributions of D i and D j together, we get the distribution p(D i , D j | Z) . Given Z = z , we can treat this as a complete Bayesian network (does not imply any conditional independencies) over D i and D j under both M 1 and M 2 . Starting from parameters 1 we can get the parameters for the joint P(D i , D j | Z = z) uniquely. The joint parameters refer here to probabilities P(D i = x, D j = y | Z = z) . Mapping is simply given by the chain rule and it is invertible. The Jacobian related to the inverse mapping is derived by  (Theorem 10). The Jacobian is easily seen to be non-zero assuming 1 ijk > 0 ∀i, j, k . To be more precise, Theorem 10 provides the Jacobian related to the mapping from joint parameters to parameters of any complete Bayesian network model over the same domain. In our case, this means, that after bijectively mapping 1 to joint parameters, we can continue and map the joint parameters bijectively to parameters 2 of M 2 . This holds for any z, and as a composition of two bijections is also a bijection, we have proved our claim.