22
A DAPTIVE LATENT FEATURE SHARING FOR PIECEWISE LINEAR DIMENSIONALITY REDUCTION APREPRINT Adam Farooq 1 , Yordan P. Raykov 1* , Petar Raykov 2 , Max A. Little 3,4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian exploratory tools such as principle component analysis (PCA) and factor analysis (FA) remain widely used as tools for: exploratory analysis, pre-processing, data visualization and related tasks. However, due to their rigid assumptions including crowding of high dimensional data, they have been replaced in many settings by more flexible and still interpretable latent feature models. The Feature allocation is usually modelled using discrete latent variables assumed to follow either parametric Beta-Bernoulli distribution or Bayesian nonparametric prior. In this work we propose a simple and tractable parametric feature allocation model which can address key limitations of current latent feature decomposition techniques. The new framework allows for explicit control over the number of features used to express each point and enables a more flexible set of allocation distributions including feature allocations with different sparsity levels. This approach is used to derive a novel adaptive Factor analysis (aFA), as well as, an adaptive probabilistic principle component analysis (aPPCA) capable of flexible structure discovery and dimensionality reduction in a wide case of scenarios. We derive both standard Gibbs sampler, as well as, an expectation-maximization inference algorithms that converge orders of magnitude faster to a reasonable point estimate solution. The utility of the proposed aPPCA model is demonstrated for standard PCA tasks such as feature learning, data visualization and data whitening. We show that aPPCA and aFA can infer interpretable high level features both when applied on raw MNIST and when applied for interpreting autoencoder features. We also demonstrate an application of the aPPCA to more robust blind source separation for functional magnetic resonance imaging (fMRI). 1 Introduction Latent feature models provide principled and interpretable means for structure decomposition through leveraging specified relationships in the observed data. They are complementary to flexible continuous latent variable models (LVMs) or black-box autoencoder approaches which do not explicitly handle discreteness in the latent space and in fact can often be used in conjunction. A widely used application of latent feature models has been as building block for Bayesian sparse factor analysis models [1, 2, 3] which are backbone tools for dimensionality reduction and latent structure discovery in high dimensional data. In contrast, latent feature visualization counterparts have received a lot less attention despite the large popularity of empirical sparse principle component analysis techniques [4, 5]. In this work, we propose a more flexible set of latent feature factor analysis models, based on adopting the multivariate hypergeometric distribution as feature allocation process. We fill the gap for latent feature visualization counterparts by proposing a fully Bayesian paradigm for specifying the probabilistic principal component analysis (PPCA) [6]. Markov Chain Monte Carlo (MCMC) inference scheme is proposed for these models, as well as, a novel scalable approximate expectation-maximization inference. 1 corresponding author arXiv:2006.12369v2 [cs.LG] 28 Aug 2020

Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

ADAPTIVE LATENT FEATURE SHARING FOR PIECEWISE LINEARDIMENSIONALITY REDUCTION

A PREPRINT

Adam Farooq1, Yordan P. Raykov1∗, Petar Raykov2, Max A. Little3,4

August 31, 2020

ABSTRACT

Ubiquitous linear Gaussian exploratory tools such as principle component analysis (PCA) and factoranalysis (FA) remain widely used as tools for: exploratory analysis, pre-processing, data visualizationand related tasks. However, due to their rigid assumptions including crowding of high dimensionaldata, they have been replaced in many settings by more flexible and still interpretable latent featuremodels. The Feature allocation is usually modelled using discrete latent variables assumed to followeither parametric Beta-Bernoulli distribution or Bayesian nonparametric prior. In this work wepropose a simple and tractable parametric feature allocation model which can address key limitationsof current latent feature decomposition techniques. The new framework allows for explicit controlover the number of features used to express each point and enables a more flexible set of allocationdistributions including feature allocations with different sparsity levels. This approach is used toderive a novel adaptive Factor analysis (aFA), as well as, an adaptive probabilistic principle componentanalysis (aPPCA) capable of flexible structure discovery and dimensionality reduction in a widecase of scenarios. We derive both standard Gibbs sampler, as well as, an expectation-maximizationinference algorithms that converge orders of magnitude faster to a reasonable point estimate solution.The utility of the proposed aPPCA model is demonstrated for standard PCA tasks such as featurelearning, data visualization and data whitening. We show that aPPCA and aFA can infer interpretablehigh level features both when applied on raw MNIST and when applied for interpreting autoencoderfeatures. We also demonstrate an application of the aPPCA to more robust blind source separation forfunctional magnetic resonance imaging (fMRI).

1 Introduction

Latent feature models provide principled and interpretable means for structure decomposition through leveragingspecified relationships in the observed data. They are complementary to flexible continuous latent variable models(LVMs) or black-box autoencoder approaches which do not explicitly handle discreteness in the latent space and infact can often be used in conjunction. A widely used application of latent feature models has been as building blockfor Bayesian sparse factor analysis models [1, 2, 3] which are backbone tools for dimensionality reduction and latentstructure discovery in high dimensional data. In contrast, latent feature visualization counterparts have received alot less attention despite the large popularity of empirical sparse principle component analysis techniques [4, 5]. Inthis work, we propose a more flexible set of latent feature factor analysis models, based on adopting the multivariatehypergeometric distribution as feature allocation process. We fill the gap for latent feature visualization counterparts byproposing a fully Bayesian paradigm for specifying the probabilistic principal component analysis (PPCA) [6]. MarkovChain Monte Carlo (MCMC) inference scheme is proposed for these models, as well as, a novel scalable approximateexpectation-maximization inference.

1corresponding author

arX

iv:2

006.

1236

9v2

[cs

.LG

] 2

8 A

ug 2

020

Page 2: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Linear dimensionality reduction methods are a mainstay of high-dimensional data analysis, due to their simple geometricinterpretation and attractive computational properties. In linear Gaussian LVMs we assume the following generativemodel for the data:

y = Wx + µ + ε (1)

where the observed data is y ∈ RD; W ∈ RD×K is a transformation matrix the columns of which are commonlyreferred to as principal components or factors; x ∈ RK are unknown multivariate Gaussian latent variables, alsoreferred to as factor loadings; µ ∈ RD is a mean (offset) vector and ε describes the model noise, typically Gaussian.Depending on the assumptions we impose on x, W and ε, we can obtain widely-used techniques:

• The ubiquitous principal component analysis (PCA) [7] can be derived from Equation (1) and further makingthe assumptions that µ = 0, vectors of W are orthogonal and the variance of the isotropic noise is 0 [8], i.e.assume ε ∼ N

(0, σ2ID

)and σ → 0.

• If we avoid the small variance asymptotic step from above, but still assume W has orthogonal vectors andGaussian noise ε ∼ N

(0, σ2ID

), we recover probabilistic PCA (PPCA) [8].

• In the case where we omit the orthogonality assumption on W and assume more flexible elliptical noiseε ∼ N (0, diag (σ)) with σ = (σ1, . . . , σD), we obtain the classic factor analysis (FA) [9].

• Variants of independent component analysis [10] can be obtained by assuming flexible elliptical noiseε ∼ N (0, diag (σ)) with σ = (σ1, . . . , σD), but also assuming a non-Gaussian distribution model for thelatent variables x ∈ RK ; for example Laplace distribution model [2].

A widely accepted challenge shared in all of these linear Gaussian techniques is that the columns of W (i.e. theprincipal components or factors) are a linear combination of all the original variables. This problem also persists formore flexible continuous latent variable models [11] and often makes it difficult to interpret the results. To handle theseissues, there has been a plethora of prior work on developing sparse PCA [4] and sparse FA models [1]. Zou et al. [4]places a least absolute shrinkage and selection operator (LASSO) regularization on columns of x, which leads to moreinterpretable components, compared to simple thresholding. Similar models have been achieved with a fully Bayesianapproach of placing relevance determination priors [12]. [1] have further suggested placing a two-component mixturemodel over the loadings x that allow to switch on and off factors from W imposing natural dimensionality reduction.In this scenario, the probabilities of factors having non-zero loadings are independent across all points. The sparse PCA[4] can be used to produce modified principal components with sparse loadings, however, falls short in scenarios wherewe wish to also model the factor sharing among specific subsets of the input data.

In such cases explicit modelling of partitions in the high dimensional input space can be achieved via augmenting thelatent space with additional of discrete latent variables [1]. In latent feature models, we denote these latent variableswith binary vectors z ∈ RK which indicate all the features associated with that point. This approach allows to captureflexible cluster topology and also can account for overlapping factors and mixed group membership (see Figure 1). Thisis in contrast to latent class LVMs which are designed for subspace clustering [13, 14] or mixture of factor analyzers[15, 16, 12]. The challenge is in designing a sufficiently flexible and intuitive model of the latent feature space. Severalnonparametric FA models have addressed this using the Beta processes [3], or their marginal Indian buffet processes[2, 17] (IBP) which have infinite capacity and can be used to infer the feature space dimensionality (i.e. number offeatures). However, the IBP imposes some explicit sparsity constraints on the feature allocation distribution which canlead to producing non-interpretable spurious features and overestimation of the underlying number of features [18].

The multivariate hypergeometric model we propose here allows for intuitive control over the sparsity of the featureallocation matrix. We show that the parameters of the hypergeometric prior allow for control over the expected sharing,while the IBP assumes log-linear growth of the number of factors [19] and decaying factor representation [20]. Theproposed model is parametric since it fixes the number of unique features instantiated, but at the same time has adifferent parameter controlling the number of unique features used to represent each data point. This is a vital pointsince it allows us to naturally separate (1) features which explain large variance percentage for a small subset of thedata from (2) spurious features which explain small variance percentage for a potentially larger subset of the data.This formulation is natural in the context of data visualization and dimensionality reduction, where natural constraintson the feature representation for each data point occur - in visualization normally points are reduced to two or threedimensions; in dimensionality reduction, we model each point with K << D dimensions.

2

Page 3: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 1: Illustration of latent feature PCA model used for decomposition and dimensionality reduction, plotted againstconventional PCA. The left 3-D plot displays synthetic data which lies approximately in one of three separate linear2-D subspaces which are spanned by different combinations of three orthogonal 1-D principal components. The rightsubplots display the inferred 2-D projections onto the identified subspaces using aPPCA and PCA.

Figure 2: Graphical model for the proposed adaptive factor analysis (aFA) and the adaptive probabilistic principalcomponent analysis (aPPCA) models as well as isFA and iICA.

2 Preliminaries

2.1 Latent feature factor analysis models

In latent feature linear Gaussian LVMs, we augment the model from Equation (1) and write the following constrictionin matrix notation for N D-dimensional observations:

Y = W(X� Z) + E (2)

where Y = [y1, . . . ,yN ] is the observation matrix, W is a (D ×K) factor (or mixing) matrix, Z = [z1, . . . , zN ]T

is a binary indicator matrix selecting which of K hidden sources are active, � denotes the Hadamard product, alsoknown as the element-wise or Schur product, E = [ε1, . . . , εN ] is a noise matrix consisting of N independent andidentically distributed D-dimensional zero-mean vectors drawn from N (0, σID); finally X = [x1, . . . ,xN ]

T arethe latent variables where each point xk,n is assumed Gaussian for FA and PCA models, and Laplace distributed forBayesian independent component analysis models. The graphical model is depicted in Figure 2.

3

Page 4: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

2.2 Inference

The joint likelihood of the model (see Figure 2), generally can be written as:

P (Y,W,X,Z|θ) =

N∏n=1

(P (yn|W,xn, zn, σ)

K∏k=1

P (xk,n) P (zk,n|α)

)

×K∏k=1

P (wk|σW )

(3)

where we use θ to denote jointly the hyperparameters. For the infinite sparse FA (isFA) model [2], we assume aGaussian prior on the factor matrix W and IBP prior on Z which results in θ = {α, σ, σW } where α is the concentrationparameter for the IBP, σ2 is the variance of the observed data and σ2

W is the variance of the factors. We will only brieflysummarize a straighforward Gibbs sampler for this isFA model. Paisley and Carin [3] proposed a scalable variationalinference algorithm for estimating this model.

The posterior distribution over the latent variables xk,n for which its respective zk,n = 1 is sampled from a Gaussian:

P (xk,n| . . .) = N

(xk,n

∣∣∣∣∣ wTk ε−k,n

σ2 + wTkw

,σ2

σ2 + wTkw

)(4)

where we have omitted all the variables upon which xk,n depends on, wk is the k-th column of the matrix W andε−k,n is (yn −W(xn � zn)) with zk,n = 0, or the noise associated with n-th point and k-th feature.

The posterior distribution over the k-th factor loading wk is a D-dimensional multivariate Gaussian:

P (wk| . . .) = N

(wk

∣∣∣∣∣ σ2W

xkxTk σ2W + σ2

ε

E−kxTk ,

(xkx

Tk

σ2ε

+1

σ2W

)ID

)(5)

where xk is the k-th column of the matrix X and E−k is (Y −W(X� Z)) with wk = 0.

The matrix Z is sampled in two steps: the first involves sampling existing features and the second, sampling newfeatures. The latent variables xk,n are marginalized out since the collapsed Gibbs sampler can lead to faster convergence[21]; the marginal distribution is available in closed form as the Gaussian prior over the hidden sources is conjugate tothe Gaussian likelihood over the observed data. The existing features zk,n can be sampled directly using the Bernoulliposterior:

P (zk,n| . . .) = Bern

(P (yn|zk,n = 1) P (zk,n = 1|zk,−n)

P (yn|zk,n = 1) P (zk,n = 1|zk,−n) + P (yn|zk,n = 0) P (zk,n = 0|zk,−n)

)(6)

In the described setup, the posterior for new features is not available in closed form, but it can be approximated using aMetropolis-Hastings step. For each observation, adding κ number of new features and their corresponding parameters(columns of matrix W) are jointly proposed and accepted with probability proportional to likelihood improvementbrought about by these new features.

2.3 Sparsity in Beta-Bernoulli models

If each component zk,n from the binary vectors zn is independently drawn from a Bernoulli distribution with the Kmixing parameters {pk}k=1,...,K , each independently drawn from a Beta distribution, then as the number of latent

features K →∞, one can show that the conjugate prior over the matrix ZT = [z1, . . . , zN ]T is the Beta process [22].

Tje mixing parameters can be integrated out in order to work with the simpler IBP marginal process. Under the IBPprior, the indicator matrix Z is (K ×N)-dimensional with K being the unknown number of represented features in theobserved data which is assumed to increase with N . The expected number of features K follows a Poisson distributionwith mean α

∑Nn=1

1N ; for large N , K ≈ α ln (N). The prior for the matrix ZT under the IBP is:

P(ZT |α

)∝ exp (−αHN )αK

(∏Kk=1

(mk−1)!(N−mk)!N !

)(7)

4

Page 5: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

where HN =∑Nn=1

1n and mk =

∑Nn=1 zk,n.

The IBP prior enforces sparse ZT by placing diminishing probability on the event of having many popular features k, i.e.features with large mk. It has been observed that the number of observations being active in each feature follows ZipfsLaw [20, 23]; this implies small number of observations are active in all features; and a large number of observationsare only active in small number of features. The Zipfs Law behavior has been observed and proven as N →∞ [20],the distribution which models size of the features is approximately proportionate to the reciprocal of the feature size.The first few principal components explain larger proportion of the variance, and are more likely to be shared by largenumber of points. Then from Zipfs Law most of the remaining principal components are a linear combination of justa few observations. In summary, the IBP prior is appropriate in scenarios where we want to induce sparse featureallocation process, but falls short in cases where we seek a composition of dense features.

3 The adaptive factor analysis (aFA) model

The latent feature FA model described above assumes a product of independent Bernoulli distributions to representthe feature allocation process, with a shared Beta distribution or Beta process prior. This modelling choice leads tointrinsic sparsity assumption about the allocation indicators Z; log-linear growth of the number of factors [19] anddecaying factor representation [20]. The result is that the underlying IBP can lead to producing non-interpretablespurious features and inconsistent overestimation of the number of inferred factors [18].

To address some of these issues here we propose a constrained allocation model for Z which relies on the multivariatehypergeometric distribution. The hypergeometric distribution describes the probability of L successes in K draws,without replacement. Under the Beta-Bernoulli feature allocation model, features are used with independent probabilities,modelled with replacement and popular features become more common because of the reinforcement effect. In contrast,we will see that FA model with hypergeometric feature allocations, can capture a wider set of allocation distributions,while also very efficient to train.

Motivated by the huge computational costs involved with training latent feature FA models, we derive a scalableexpectation-maximization (EM) algorithm for approximate inference in adaptive FA.

3.1 Feature allocation models with replacement

To implement the proposed aFA, we place a multivariate hypergeometric distribution [24] as a prior over all the latentfeature indicators Z:

P (Z|K,L,m1,...,K = 1) =

N∏n=1

(1z1,n

)(1z2,n

)× . . .×

(1

zK,n

)(KL

) (8)

for given hyperparameter values of L and K, such that L < K. For Equation (8) zk,n ∈ {0, 1} and we have∑Kk=1 zk,n = L. The parameter L allows for explicit control over the number of latent factors used to decompose each

observation. K denotes the number of unique factors used to represent the data, i.e. the number of columns in W. Thisimplies that each input data point is associated with different subset of L factors, selected from a total of K uniquefactors. K accounts for the global sharing of structure across overlapping groups of data points with common factors; ifK is large enough, each point can, in principle, be associated with non-overlapping subsets of L factors, equivalent tomixture of FAs model. But, as K reduces, more of these factors are constrained to be shared across subsets of the data.L acts much like the number of latent dimensions in traditional linear LVMs, but here L is constrained by K. Thisallows us to interpret L as the local capacity of the model and K controls global capacity of sharing. If L = K, werecover classical FA models, since all features are associated with all observed data points. As K − L increases, morelocal structure of the data can be captured.

3.2 Scalable inference for aFA model

The joint likelihood for the proposed model takes the same form as the FA from Equation (3) with changed distributionon Z. The parametric nature of the hypergeometric model allows us to write an efficient EM algorithm for training theaFA which can be used both for initialization of a full Gibbs sampler or for obtaining quick maximum-a-posteriorisolution for the model. We marginalize over the continious latent variables X and at each iteration we computethe expectation of the likelihood with respect to X: EX|... [P (Y,Z,X|W, σ, σx)× P(W)] where EX|... denotesconditional expectation with respect to P (X|Y,Z,W, σ, σx) and σ2

x is the variance over the latent space. The

5

Page 6: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Algorithm 1 EM algorithm for parametric adaptive factor (aFA) analysis.Input: Y,Θ,MaxIterInitialise: Sample a random (K ×N) binary matrix Z and initialize {W,X} using PCAfor iter← 1 to MaxIter

for n← 1 to NSet I = {k : zk,n = 1}for l← 1 to L

Set zIl,n = 0Sample Il using (19)Set zIl,n = 1

for n← 1 to NSet xn =

(σ−2x IK + σ−2AnWTWAn

)−1 (σ−2AnWTyn

)Set Ψn =

(σ−2x IK + σ−2AnWTWAn

)−1+ xnxTn

Set W =(∑N

n=1 yn (Anxn)T)(∑N

n=1 AnΨnAn

)−1

Set σ2 = 1ND

∑Nn=1

(yTnyn − 2xTnAnWTyn + trace

(AnWTWAnΨn

))Set σ2

x = 1NK

∑Nn=1 trace (Ψn)

log-likelihood can be expressed as:

LN = −N∑n=1

(K

2ln(σ2x

)+D

2ln(σ2)

+1

2σ2x

xTnxn +

1

2σ2yTnyn −

1

σ2xTnA

TnW

Tyn +1

2σ2xTnA

TnW

TWAnxn

) (9)

where An is a (K ×K) matrix with the diagonal elements being zn. The expectation of xn from above can then bewritten as:

E [xn] =(σ−2x IK + σ−2AT

nWTWAn

)−1 (σ−2AT

nWTyn

)(10)

Using E [xn], we can rewrite the marginal log-likelihood after integrating xn:

LN = −N∑n=1

(K

2ln(σ2x

)+D

2ln(σ2)

+1

2σ2x

tr(E[xnx

Tn

])+

1

2σ2yTnyn −

1

σ2E [xn]

TATnW

Tyn

+1

2σ2tr(ATnW

TWAnE[xnx

Tn

]))(11)

In the EM maximization step, we update the rest of the parameters and the indicator variables by solving ∂LN∂W , ∂LN∂σ ,

∂LN∂σx

and ∂LN∂zn

= 0.

Since we are often interested only in a point estimate for the indicator variables Z, iterative optimization via coordinatedescend can lead to robust MAP estimatem i.e. ZMAP [25, 26, 27]. The complete EM algorithm for the proposed aFA issummarized in Algorithm 1. Typically, it converges in only a few iterations and later we show its MAP decompositionleads to comparable reconstruction error to a Gibbs trained aFA. The EM algorithm for aFA will also lead to lowerreconstruction error compared to other well known parametric and nonparametric FA algorithms.

4 The adaptive probabilistic principal component analysis (aPPCA) model

In this section we propose novel adaptive probabilistic principal component analysis (aPPCA) framework which modelslinear subspace sharing across overlapping subsets of observations. The aPPCA can be described as a latent featureapproach, in which the latent features are assumed to share orthogonal one-dimensional subspaces, characterized viathe projection vectors w1,w2, ...,wK forming W. If two points yi and yj are associated with a projection vector wk,it means that sufficient information about these points can be preserved by projecting them in the direction specified bywk.

6

Page 7: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

We study two variants of aPPCA, which differ in the way they model the latent subspace allocation. First, we derivea direct extension of the nonparametric FA model from Knowles and Ghahramani [2] to the PPCA setup in whichthe columns of the transformation matrix W are orthogonal. Second, we also propose a parametric hypergeometricvariant of the aPPCA which allows for explicit control over both the number of unique columns K in W, as well as theobservation specific number of active vectors L.

Both these proposed aPPCA models share the following construction:

yn = W(xn � zn) + µ + εnxn ∼ N (0, IK) (12)

εn ∼ N(0, σ2ID

)for n = 1, . . . N , where yn ∈ RD is the D-dimensional observed data; xn ∈ RK is the lower dimensional latentvariable; W = [w1,w2, ...,wK ] is an unobserved (D ×K) projection matrix with wi ⊥ wj for all i 6= j; zn ∈ RKis a binary vector indicating the active subspaces for point n, εn is zero-mean Gaussian noise; and without loss ofgenerality we assume the D-dimensional mean vector µ = 1

N

∑Nn=1 yn is zero. Under both of the proposed aPPCA

models, we can write the likelihood of point n as:

P (yn |W,xn, zn, σ) =1

(2πσ2)D2

exp

(− 1

2σ2(yn −W (xn � zn))

T(yn −W (xn � zn))

)(13)

4.1 Inference for aPPCA model

Computing the posterior distribution of the latent variables {X,Z} and the projection matrix W is analyticallyintractable and we have to resort to approximate inference. The main difference for the aPPCA model here, whencompared to the aFA model above, is that the new distribution of the orthonormal matrix W does not allow for closedform updates. Numerically optimizing over W and marginalizing X leads to slow mixing and EM scheme leads topoor local solutions for this model. An efficient Markov Chain Monte Carlo (MCMC) scheme [28] can be derivedwhich iterates between explicit updates for W, zn, xn and the hyperparameters we wish to infer, i.e. σ2 and α (updateof σ2 and α is in given in Appendix B). Sampling from directional posteriors is prohibitively slow, so we propose MAPupdate scheme for the updates on W. Alternatively we could use an automated MCMC platforms such as STAN [29]for the inference, but STAN does not deal well with discontinuous likelihood models such as aPPCA. This can beaddressed using discrete relaxations such as Maddison et al. [30] or numerical solver extensions such as Nishimura et al.citeNishimura2017discontinuous. However, such an approach can be justified only for nonlinear intractable extensionsof aPPCA, since the Gibbs sampler with closed form updates is substantially more efficient, hence we derive it here.

The joint data likelihood of both aPPCA models we propose takes the form:

P (Y,W,X,Z|σ, α) =

N∏n=1

(P (yn|W,xn, zn, σ)

K∏k=1

P (xk,n) P (zk,n|α)

)× P (W)

(14)

We can check whether the MCMC sampler has converged using standard tests such as Raftery and Lewis [31] directlyon Equation (14). Comparing the two aPPCA models from Section 4, the only difference is in P (Z). We will see thatthis will affect the posterior update of W, but the rest of inference algorithm is otherwise identical across both models.

Posterior of W

In order to comply with the orthogonality constraint on W, i.e. wi ⊥ wj ∀i 6= j, we have to use a distribution withsupport on the Stiefel manifold (see [32] for a good introduction). One option explored in Elvira et al. [18] wouldbe using conjugate Bingham prior [33] independently on the columns of W leading to independent von Mises-Fisherposterior over each column where re-scaling is required after each sample to maintain orthogonality. Empirical trailssuggest that this results in very poor mixing. To overcome this issue, we propose joint sampling of the columns ofW. We place a uniform prior over the Steifel manifold on the matrix W which allows us to work with a matrix vonMises-Fisher [34] posterior:

P (W|Y,X,Z, σ) = 0F−11

(∅, D

2,AAT

)exp (tr (AW)) (15)

7

Page 8: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

where A = 12σ2 (X� Z)YT and 0F−11 (·) is a hypergeometric function [35]. The normalization term of the matrix von

Mises-Fisher posterior is not available in closed form, hence it is common to sample from it using rejection sampling.. FallaizeTheodore Fallaize and Kypraios [36] proposed a Metropolis-Hastings scheme to generate samples fromEquation (15), the resulting posterior of W converges faster than the Bingham-von-Mises-Fisher posterior, but canbe further sped up by numerical optimization methods. Here, we propose updating the matrix W by maximizing theposterior from Equation (15) over the Stiefel manifold, i.e. keeping the orthogonality assumption wi ⊥ wj ∀i 6= j. Anefficient implementation can be achieved using the PYMANOPT toolbox [37], for optimization over manifolds withdifferent geometries; this step is outlined in Appendix C.

Posterior of X

The posterior distribution over the latent variable xk,n, for which its respective zk,n = 1, is sampled from a Gaussian:

P (xk,n|wk,yn, zn) = N(xk,n

∣∣∣∣ yTnwkσ2 + 1

,σ2

σ2 + 1

))(16)

where wk is the kth column of the matrix W.

4.1.1 Bayesian nonparametric aPPCA

In the Bayesian nonparametric aPPCA, we placed an IBP prior over the indicator matrix Z; this assumes that after afinite N number of observations only a finite K number of one-dimensional subspaces are active. This results in the firstK rows of Z having non-zero entries, and the remaining being all zeros. By design, K cannot exceed the dimensionof the data D and this leads to truncation of the IBP such that K has a upper limit of Kmax; where K ≤ Kmax ≤ D,therefore in Bayesian nonparametric aPPCA, Z is a (Kmax ×N) binary matrix, with the sum of the first K rowsbeing non-zero and the sum of the remaining Kmax −K rows being zero. Following Knowles and Ghahramani [2],we sample the matrix Z in two stages which include sampling “existing features” and“new features”; in both casesthe latent variables xk,n are marginalized out. The posterior distribution over the existing features zk,n is Bernoullidistributed:

P (zk,n| . . .)

=Bern

(P (yn|zk,n = 1) P (zk,n = 1|zk,−n)

P (yn|zk,n = 1) P (zk,n = 1|zk,−n) + P (yn|zk,n = 0) P (zk,n = 0|zk,−n)

)

=Bern

mk,−nN exp

(1

2σ2(σ2+1)

(yTnwk

))(σ2

σ2+1

) 12

mk,−nN exp

(1

2σ2(σ2+1) (yTnwk))(

σ2

σ2+1

) 12

+ 1

(17)

where we omit the dependence on W and σ2 and mk,−n =∑i6=n zk,i.

Then, we sample κ number of new features with κ ∼ Poisson(αN

), where we maintain κ > 0 or κ+K ≤ Kmax. For

observed data point n, the posterior distribution over the new features is:

P (zK+j,n| . . .) = Bern

exp(

12σ2(σ2+1)

∑K+κk=K+1

(yTnwk

)2)( σ2

σ2+1

)κ2

exp(

12σ2(σ2+1)

∑K+κk=K+1 (yTnwk)

2)(

σ2

σ2+1

)κ2

+ 1

(18)

for j = 1, . . . , κ new features.

4.1.2 Parametric aPPCA

In many common PPCA applications, constraints on the latent feature dimensionality occur naturally. In data visual-ization, we are mostly interested in reducing high dimensional data down to two or three dimensions; in regressionproblems when PCA is used to remove multicollinearity from input features, the output dimensionality is usually fixedto D (the dimensionality of the input). In these scenarios the multivariate hypergeometric model for Z allows explicitcontrol over the number of latent subspaces L used to decompose each single observation. K denotes the number ofunique orthogonal linear subspaces which we will use to reduce the original data into the lower dimensional space; each

8

Page 9: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Algorithm 2 Pseudocode for inference in Bayesian nonparametric aPPCA using Gibbs sampling.Input: Y,Θ,MaxIter, KInitialise: Sample a random (Kmax ×N) binary matrix Z and initialize W using PCAfor iter← 1 to MaxIter

for n← 1 to Nfor k ← 1 to K

Sample zk,n using (17)Sample κ ∼ Poisson

(αN

)Accept κ new features with probability (18) and update K accordingly

for n← 1 to Nfor k ← 1 to K

if zk,n = 1Sample xk,n using (16)

Sample W using (15)Sample

{σ2, α

}from Appendix B

Algorithm 3 Pseudocode for inference in parametric aPPCA using Gibbs sampling.Input: Y,Θ,MaxIterInitialise: Sample a random (K ×N) binary matrix Z and initialize W using PCAfor iter← 1 to MaxIter

for n← 1 to NSet I = {k : zk,n = 1}for l← 1 to L

Set zIl,n = 0Sample Il using (19)Set zIl,n = 1

for n← 1 to Nfor k ← 1 to K

if zk,n = 1Sample xk,n using (16)

Sample W using (15)Sample

{σ2, α

}using Appendix B

input data point can be associated with different subset of L subspaces, selected from a total of K subspaces. So, anysingle point is actually represented by lower dimensional spaces subsets of RL. Note that the orthogonality assumptionwi ⊥ wj ∀i 6= j for the columns of W implies that K ≤ D.

In the parametric aPPCA we place a flexible multivariate hypergeometric prior on the latent Z. The hypergeometricprior allows updates of Z across N in parallel, since the number of observed data points assigned to a latent subspaceno longer implies higher probability of assigning a new data point to that subspace, i.e. no reinforcement effect. Instead,for each n = 1, . . . , N , we sample zn by first finding the L observed data indices {l1, . . . , lL} for which zn is one,then for each li, we set zn,li = 0 and sample li from the following Categorical distribution:

li ∼ Categorical

(1− z1,n) exp((

yTnw1

)2)∑k (1− zk,n) exp

((yTnw1)

2) , . . . , (1− zK,n) exp

((yTnwK

)2)∑k (1− zk,n) exp

((yTnwK)

2) (19)

where after each draw we set zn,li = 1. In dimensionality reduction applications we often assume L being two or three,hence l1 might indicate the x-axis, l2 the y-axis and l3 the z-axis of the lower dimensional subspace. A Gibbs samplerfor the parametric aPPCA is suggested in Algorithm 3.

4.2 Relationship to PCA

If we marginalize the likelihood (from Equation (13)) with respect to the discrete and continuous latent variables{xn, zn}) and take the limit σ2 → 0, the maximum likelihood solution with respect to the transformation matrix W is ascaled version of the K largest eigenvectors of the covariance matrix (like PCA) of the data (multiplied by orthonormalrotation); proof of this can be seen in Appendix A. Furthermore, different priors over the matrix Z result in differentvariants of the model, giving explicit control over the scale of the different projection axis.

9

Page 10: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Table 1: Performance of factor analysis (FA) methods measured in terms of mean absolute reconstruction error.Different variations of parametric and nonparametric latent feature FA as well as vanilla FA are compared. The FAvariations were tested on discrete-continuous synthetic datasets of 1000 points all assuming Y = W (X� Z) + E,where Y is a (D × 1000) observation matrix, X is a (K × 1000) latent feature matrix, W is a (D ×K) factor loadingmatrix and E is a (D × 1000) noise matrix. The latent feature indicator matrix Z is (K × 1000) binary matrix and Zis all that changes in the different settings. We have considered 5 separate synthetic sets and the distribution of Z foreach is displayed in Figure 3.

Prior Sparse Dense Balanced Subspace Onesmatrix matrix matrix clustering

K 10 20 10 20 10 20 10 20 10 20Factor analysis .012 .014 .012 .014 .088 .099 .012 .015 .012 .014

(FA)Finite sparse .014 .018 .015 .018 .090 .101 .016 .018 .014 .019

FAInfinite sparse .023 .042 .021 .042 .073 .970 .024 .046 .045 .075

FAAdaptive FA .014 .019 .012 .019 .047 .056 .013 .021 .015 .019(aFA) GibbsAdaptive FA .011 .013 .011 .013 .034 .044 .012 .014 .012 .014

(aFA) EM

5 Experiments

This section provides some empirical results on the performance of the proposed variations of PCA and FA techniquesto: data visualization applications; data whitening and blind source separation. The methods are evaluated on differenttypes of synthetic data, images of handwritten digits from MNIST and functional magnetic resonance imaging (fMRI)data.

5.1 Synthetic data from varying latent feature FA models

First, we generate a wide variety of latent feature linear Gaussian datasets, assuming that the data matrix Y takes theform: Y = W(X� Z) + E with X a latent feature matrix with standard Gaussian distribution; W is a factor loadingmatrix with columns drawn from a multivariate Gaussian with mean zero and covariance matrix σ2

W IK with σW = 1;E noise matrix with multivariate Gaussian columns each with mean zero and covariance matrix σ2ID with σ = 0.1.The core of the generative model remains the same across the different datasets we generate and only the latent featureindicator matrix Z changes. We have considered 5 separate synthetic sets and the distribution of Z for each setup isdisplayed in Figure 3. In Table 1, we evaluate how well 4 different FA methods (i.e. with changing treatment of Z)perform across each scenario. The resulting FA methods tested are:

• Factor analysis (FA): the Z matrix is full of ones and all factors are shared across all points.• Infinite sparse FA (isFA): the Z matrix is modelled with an IBP prior (see Equation (7)) and most factors are

shared only across small overlapping subsets of points.• Finite sparse FA (fsFA): the Z matrix is modelled with a finite Beta-Bernoulli distribution across all points and

features.• Adaptive FA (aFA): Z is modelled with a multivariate hypergeometric prior (see Equation (8)).

Table 1 also includes a second result for the aFA model when trained using the proposed EM training scheme (Algorithm1). This was done to distinguish between performance gains due to the model architecture and due to the adoptedinference. The results in Table 1 suggest that for sparse latent feature data and for single feature linear Gaussian data,most of the methods perform similarly. The isFA model performs consistently worse then all other methods and this isdue to its tendency to overestimate the underlying number of latent features. When we set the concentration parametersof isFA to learn the fixed K number of factors, reconstruction error is higher; if we set concentration parameters to inferhigher then the generating true K number of factors, the reconstruction error drops. This effect is similar to the onereported for Dirichlet process mixtures in [38].

FA performs well in terms of reconstruction error because it learns less parsimonious data representation where forsame number of factors K, vanilla FA learns a lot more factor loadings. In practices latent feature FA methods are

10

Page 11: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 3: A plot of the different distributions used to model the latent latent space in Table 1. The subplots displaydifferent samples of the zero-one indicator matrix Z: black cells indicate 1’s and white cells indicate 0’s. Five differentlatent models are considered: (a) Sparse latent feature model, (b) Dense latent feature model, (c) Latent class model inwhich sharing of some feature between subsets of points implies sharing of all features of those points, (d) Balancedlatent feature model sampled from specific hypergeometric distribution, (e) Collapsed latent space consisting of a singlestate.

Figure 4: Estimated proportion of data associated with the different factors for sparse (left) and dense (right) linearGaussian data (i.e. as in Table 1). The x-axis denotes the proportion of points associated with a factor (i.e. factorpopularity) and the y-axis denotes the factor numbers where factors are ordered by size (i.e. number of points associatedwith them). The true feature popularity is displayed in red; the remaining lines show the feature popularity associatedwith the estimated factors using the nonparametric factor analysis (isFA) and the proposed adaptive factor analysis(aFA) model.

used with larger K then vanilla FA due to the fact that each factor there is a linear combination of only smaller subsetof data points. fsFA manages to perform well across most settings, often achieving comparable reconstruction errorusing a lot sparser factor loadings. However, we see its performance drops substantially for non-sparse balanced latentfeature models. Due to the extra generality of the aFA model, it performs well across all settings, since the consideredlatent space structures are all special cases for the assumed multivariate hypergeometric model. The slightly lowerreconstruction of the EM compared to Gibbs aFA, suggest convergence to good local optima for the proposed EMscheme and convergence issues of the Gibbs sampler.

5.2 MNIST Handwritten Digits Dataset

In this section we demonstrate the utility of aFA and aPPCA on the MNIST digit dataset [39].

We train the aFA model using EM inference on N = 2500 odd digits (500 of each type) from MNIST. The vectoredpixels were first reduced to D = 350 using standard PCA since this still preserves 99.5% of the total variance withinthe data. The total number of unique factors is set to K = 100 and the number L of observation specific subset ofavailable factors is set to maximize the factor profiles of the different digits.

In Figure 5, we show the factor sharing across the digits which are calculated based on the proportion of factors sharingbetween different digit pairs. We count the number of factors shared between 1’s and 1’s, 1’s and 3’s, 1’s and 5’s, 1’sand 7’s, 1’s and 9’s; then we normalize by the largest number of features shared. The larger and darker circles indicate

11

Page 12: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 5: aFA model is trained on 2500 odd MNIST digit, 500 of each type. Left: grid plotting the proportion ofshared identified factors between pairs of different digits. The size and color of the circles depends on the proportion offeatures shared between digit pairs as denoted on the x-axis and y-axis. Intuitively 10, 000 MNIST digits Factor sharinggrid between digits: circles are sized depending on the number of features shared between digit pairs denoted on thex-axis and y-axis; color enforces this effect where darker circles indicate more sharing and brighter circles - less. Right:Distribution of feature allocation process: y-axis denotes the proportion of data sharing current factor; x-axis indicatesthe factor number where they have been ordered based on most popular (left), least popular with small number of dataallocated (right).

more sharing. As expected, observations depicting the same digits have the most shared factors; 1’s and 7’s also sharesignificant structure as well as 5’s and 9’s which is inline with the geometry of the digits. The results can be directlycompared with a similar experiment in [40]. In Figure 5 we display the estimated feature weights obtained by summingover the Z matrix and normalizing. Varying L and K one can study how well sparse and dense aFA models inferfeatures specific to the different digits.

Next, we also apply aPPCA for subspace feature allocation and subspace clustering of MNIST digits. We first use a2-layer multilayer perceptron variational autoencoder (VAE) [41] to reduce the dimension of 10,000 MNIST digits. The784-dimensional data is reduced with the VAE to 10 dimensions and then we train parametric aPPCA with K = 3 andL = 2 to visualize the digits in the latent space. We will assume that subspace 1 is spanned by the inferred features1 and 2; subspace 2 by features 2 and 3; subspace 3 by features 1 and 3. Note that all pairs subspaces share one oftheir principal axis. In Figure 6 we display the reduced data in each of these subspaces where can be seen increasedseparation between the distinct clusters of different digits, especially compared to PCA. From Figure 7 we can see thatdistinct geometric properties of digits are encoded in the separated subspaces. Figure 7 shows randomly selected digitsfrom each subspace and we can see that most digits in subspace 1 are written in thicker font; most digits in subspace 2are slanted.

The visualization reduces the crowding effect of PCA and produces multiple two-dimensional plots which jointlydecompose the data and plot intuitively the information about the observed data.

5.3 Data pre-processing

With the emergence of flexible manifold embedding and other nonlinear algorithms, PCA is less widely-used as avisualization tool, but remains in heavy use for data whitening. This is often used pre-processing step which aims todecorrelate the observed data to simplify subsequent processing and analysis, for example, image data tends to havehighly correlated adjacent pixels. In this capacity, PCA works by “rotating” the data in observation space, retainingdimensionality unlike with visualization applications.

Here we show a simple example demonstrating how aPPCA can be used to do more effective local whitening which canlead to more accurate and interpretable supervised classification in decorrelated latent feature space. To demonstratethat, we compare a classifier trained on raw data with the same classifer on the first few principal component projectionsof the data where the principal components are estimated (1) globally using PCA and (2) locally, within subsets of thedata using aPPCA.

For simplicity, we show an example of pre-processing the MNIST handwritten digit classification dataset, beforetraining a multilayer perceptron. We train a simple multilayer perceptron with one hidden layer with a softmax activationfunction on a 9000-image subset of the 784-dimensional MNIST dataset with 1000 images reserved for testing. We

12

Page 13: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 6: Scatter plot of the 2-dimensional projections of 10, 000 MNIST digits. The first 3 subplots contain onlyproportions of the data which have been estimated to lie in the corresponding subspace (i.e. Subspace 1 is spanned byfeatures 1 and 2; Subspace 2 by features 2 and 3; Subspace 3 by 1 and 3). The 4-th subplot shows the 2-dimensionalprojection of all digits obtained using PCA.

compare the performance of the same classifier network when (1) trained on the original 784-dimensional pre-processeddata, (2) trained on lower dimensional projection of the data using PCA (3) trained on locally whitened data by aPPCA(K-dimensional). The classifier is a multilayer perceptron in all three scenarios. Figure 8 shows the classificationaccuracy of these three different pre-processing approaches as we vary K, i.e. the number of principal components towhich we project down the data. For aPPCA, we have kept L = K − 1 for simplicity. We have also seen increases inperformance if multiple, separate classifiers are trained on each L-dimensional subspace, but these are not reportedsince it is not fair comparison with PCA.

A key feature of the aPPCA algorithm when used for localized data whitening is that it estimates more robust subspaceswhich can be seen in the smaller number of subspaces (i.e. principal components or columns of W) required fortraining of the same classifier, to achieve better out-of-sample performance. The multilayer perceptron trained on PCAwhitened data requires more subspaces in training to achieve comparable out-of-sample results.

5.4 Blind source separation in fMRI

Functional magnetic resonance imaging (fMRI) is a technique for the non-invasive study of brain functions. fMRI canact as indirect measure of neuronal activation in the brain, by detecting blood oxygenation level dependent (BOLD)contrast [42]. BOLD relies on the fact that oxygenated (diamagnetic) and deoxygenated (paramagnetic) blood havedifferent magnetic properties. When neurons fire there is a resultant increase in localised flow of more oxygenatedblood, which can be detected using BOLD fMRI.

fMRI time-series data is often represented as a series of three-dimensional images (see Figure 9). However, datacan be also represented as a two-dimensional matrix using vectorized voxel matrices against time (time by voxels).In this representation each matrix row contains all voxels from the brain image (or the subset selected for analysis)from a single time point. Although useful, fMRI data often suffers from low image contrast-to-noise ratio, it is biasedfrom subject head motions, scanner drift (i.e. due to overheating of the equipment) and from signals from irrelevantphysiological sources (cardiac or pulmonary). Therefore, direct analysis of raw fMRI measurements is rare [43] anddomain experts tend to work with pre-processed, reduced statistics of the data. In clinical studies, due to the typicalscarcity of fMRI series per subject and the low signal-to-noise ratio, flexible black-box algorithms are rarely used. Thepreferred methods for pre-processing of fMRI series and localization of active spatial regions of the brain are variants

13

Page 14: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 7: Randomly selected MNIST digits from each of the identified subspaces. The top panel consist of mostlythicker font digits; the bottom panel has dominantly slanted font digits.

Figure 8: Classification accuracy of a multilayer perceptron on MNIST digits in three different setups: when nowhitening is used; data is pre-processed with principal component analysis (PCA); data is pre-processed with the adaptiveprobabilistic PCA (aPPCA). On the x-axis we show the number of reduced dimensions used for different instances ofthe same classifier. The y-axis indicates the out-of-sample accuracy, evaluated using 10-fold cross-validation.

of linear dimensionality reduction methods such as PCA and FA [44, 45, 46, 43, 47]. Typically, of main interest is thenanalysis of a representative subset of the inferred components or factors respectively, instead of the use of raw data.

A key problem with this approach is that these linear methods assume that the components/factors are a linearcombination of all of the data, i.e. with other words PCA and FA would assume that all components are active for thefull duration of the recording. Common implementations for fMRI series [48, 49] might adopt thresholding the inferredcomponents or using sparse alternatives of the decomposition techniques. These still can lead to biased decompositioninto components and we are likely to overestimate the firing area of the brain for some components and completelyoverlooking functional areas of the brain active for shorter periods of time. Here, we show that using our proposedadaptive linear methods, are better motivated model to alleviate this problem and can infer better localized spatialregions of activation from fMRI; furthermore we can potentially discover novel short-term components in a principled,probabilistic, data driven fashion.

14

Page 15: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 9: fMRI data consists of 3-dimensional brain volumes collected over time (e.g. every 1 second). Commonlyimages are vectorised and represented as 2-dimensional T × V matrix (top panel), with V being number of all voxelsin all dimensions and T the number of time samples. This matrix can be then reduced down to K × V matrix (i.e.X) which represents spatial maps of regions with intrinsically similar time-courses (middle panel). W denotes themodelled transformation matrix and Z infers if components (i.e. rows of X) should be included in our representation ofthe data matrix or not. Columns of W , also referred to as components, are easier to interpret in terms of their correlationto experimental stimuli.

As a proof of concept, here we apply parametric aPPCA to fMRI data collected from a single participant while exposedto continuous visual stimuli. fMRI data was initially realigned to correct for subjected motion and registered to a grouptemplate (Montreal Neurological Institute Template). Using 3T Siemens scanner, a whole brain image with voxelresolution of 2× 2× 2 mm was acquired each 0.8 seconds. The data had 215, 302 voxels and 989 time points. aPPCAdecomposition was performed by treating time points as features, which is standard in the neuroimaging field. ForaPPCA we used K = 500 unique components and constraint of L = 200 components, which were selected to achievecomponent similarity with the benchmark and enable visually intuitive comparisons. We also performed PPCA withK = 200 components for comparison, see Figure 10.

The figure shows the component most associated with the task estimated both with aPPCA and PPCA. aPPCA results insparser maps across space, which enhance localization. This sparsity increases with higher numbers of components thatexplain less variance in the data. This can be useful for identifying noisy components and brain areas that are onlytransiently active during task performance. We also show the corrected t-statistic map that shows the voxels that havesignificant correlation with task 1. Map is family-wise error (FWE) corrected at p < 0.05 at voxel threshold p < 0.001.One benefit of decomposition methods versus standard correlation methods is that they do not need a predefined modelof assumed task activation.

Direct quantitative evaluation of pre-processing tools of fMRI data is an open problem, due to the lack of clear definitionof the brain activity related components. We have measured the mean reconstruction error across all 215, 302 voxels aswell as the standard deviation across voxels. We find that highest error with highest standard deviation (i.e. average

15

Page 16: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 10: The figure shows the lower dimensional, reduced across time fMRI recordings plotted against the subjectbrain. The fMRI time series of length T is reduced to K components and here we display the single component mostassociated with the stimuli during the experiment. The top panel displays the reduced projection estimated using ouraPPCA and the bottom panel the projection estimated using PPCA. The larger amount of grey regions indicates that theaPPCA projection localizes better the regions of the brain fluctuation through time, as a response to the visual stimuli.Reference regions of activation can be seen in Figure 11

root mean square error (RMSE) of 16.5, standard deviation of RMSE of 4.8) was achieved using PPCA. aPPCAreconstruction gradually reduces these figures depending on the ratio of K and L used with best scoring reconstructionhaving average RMSE of 14.1 and standard deviation of RMSE (across voxels) of 3.0. The lower standard deviation oferror across the voxels supports our hypothesis of better preserved local region information. Due to the simplicity ofthe imaging setup, both methods were able to identify components highly correlated to the stimuli, see Figure 9. Thetypical goal for experts would be to examine functions of the specific brain regions or networks, as well as, potentiallyaffected areas of the brain after head trauma or stroke.

The common analysis practice would be to threshold the observation specific loadings (i.e. reduced form data) and onlyconsider voxels that significantly contribute to selected subsets of components. The adaptive nature of aPPCA allowsus to infer the voxels association with specific components (i.e. Z switches off voxels not part of a component) in aprincipled fashion as a part of a probabilistic model. In addition, the user has explicit control over the contrast voxelsused in different components (ratio of K and L) and this can be useful for achieving better spatial localization, withoutheuristic thresholding.

6 Summary and conclusions

In this work, we have studied generic discrete latent variable augmentation for ubiquitous linear Gaussian methodsapplied for feature learning, whitening and dimensionality reduction applications. We have proposed a nonparametriclatent feature PCA model (i.e. the aPPCA) which learns a flexible set of principal components all of which arecomputed as a linear combination of only subsets of the input data. The manuscript details some shortcomings withexisting Bayesian nonparametric linear Gaussian methods and demonstrates that flexible alternatives can be derivedusing hypergeometric distributions. This leads to novel aFA and aPPCA models which be trained efficiently, whichovercome the inherent over-partitioning in Beta process and allows for more flexible regularization of the model

16

Page 17: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 11: The spatial map shows voxels that have significant correlation with the visual stimuli. The map is family-wiseerror corrected at p < 0.05 at voxel threshold p < 0.001 and indicates voxel regions most likely to be truely associatedwith a cognitive function specific to the stimuli.

capacity, compared to Beta-Bernoulli models. The proposed models can be extended to many other related methodssuch as: generalized linear Gaussian models, Gaussian process latent variable models (GPLVMs), kernel PCA methods,and others. Dai et al. [11] has already introduced the problem of handling discontinuity in GPLVMs and proposeda simple spike and slab prior to augment the continuous latent variables in GPLVMs. Augmenting GPLVMs withdiscrete hypergeometric feature allocation indicators, can in principle allow for richer model of the manifold and morecompact modelling using smaller number of underlying feature specific Gaussian processes. In our study of aPPCAmodels, we have also proposed efficient practical inference methods for distributions on Stiefel manifolds. The utilityof the proposed tools is demonstrated first on a wide range of synthetic latent feature Gaussian data sets and then alsoon MNIST and brain imaging fMRI data. Our synthetic study shows that a wide range of feature allocation distributionscan be captured with a multivariate hypergeometric model. We have applied aPPCA to MNIST variational autoencoderprojections, to show that in can be used to identify images sharing clear geometric features. aFA was applied to nearlyraw digits to show that images of visually similar digits share more factors together. We conclude with an applicationof aPPCA to a widely-encountered problem in brain imaging with fMRI, and demonstrate accurate decomposition ofactive spatial regions in the brain during different stimuli (or at rest). We also demonstrate that this discrete-continuousdecomposition leads to more accurate localization of active brain regions. This can have huge impact on analysispipelines for fMRI data for neurological screening and cognitive neuroscience applications.

17

Page 18: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

A Adaptive PCA

In this section we demonstrate that the proposed parametric APPCA model from Section 4 is indeed a generalization ofthe ubiquitous PCA and using small variance asymptotics [25]. Let us first start by marginalizing out the discrete andcontinuous latent variables {xn, zn} which are not of explicit interest in conventional PCA approach. To compute themarginal likelihood of yn we compute the expectations:

EP(xn,zn) [yn] and EP(xn,zn)

[(yn − E [yn]) (yn − E [yn])

T]

where we use E [ ] = EP(xn,zn) [ ] for notational convenience. We express the moments of the marginal likelihoodstarting with the posterior mean of the marginal, E [yn]:

E [yn] = E [W (xn � zn) + µ + εn]

= W (E [xn]� E [zn]) + µ + E [εn]

= W (0� ρ) + µ + 0

= µ

where we have used a diagonal (K ×K) matrix ρ to denote the expectation of each feature, which is determined bythe prior on the matrix Z:

ρk,k =

{LK if multivariate hypergeometric prior1N

∑n zk,n if IBP prior

For the variance of the marginal, we can write:

E[(yn − E [yn]) (yn − E [yn])

T]

= E[(W (xn � zn) + εn) (W (xn � zn) + εn)

T]

= WρWT + σ2ID

Finally, using the obtained expression for E [yn] and E[(yn − E [yn]) (yn − E [yn])

T], combined with the Gaussian

likelihood of yn resulting in a linear Gaussian model, we can write the marginal likelihood as:

P (yn |W,ρ, σ) =1

(2π)D2

|C|−1/2 exp

(−1

2yTnC

−1yn

)(20)

where we used C = WρWT + σ2ID to denote the model covariance.

Now, the marginal likelihood in this collapsed APPCA model is almost identical to the PPCA model Tipping and Bishop(1999b) with the key difference being the weights ρ which can be scalar shared across each dimension or directionspecific. In fact, we can say that the PPCA model is a special case of the collapsed APPCA model when the diagonal ofρ are full of ones, which occurs when the matrix Z is full of ones implying all observations are active in all K numberof one-dimensional subspaces.

The complete data log-likelihood of the collapsed model is:

L =

N∑n=1

ln (P (yn |W,ρ, σ))

= −N2

(D ln (2π) + ln |C|+ tr

(C−1S

))where S = 1

NYYT . To find the maximum likelihood estimate for W, we differentiate the likelihood and solve:

dLdW

= −N2

(2C−1Wρ− 2C−1SC−1Wρ

)= 0

18

Page 19: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

C−1Wρ = C−1SC−1Wρ

WMLρ = SC−1WMLρ

To find the solution for the above we first express the Wρ1/2 term using its singular value decomposition:

Wρ1/2 = ULVT

which leads to:

C−1Wρ1/2 = UL(L2 + σ2IK

)−1VT

then:

SC−1Wρ1/2 = Wρ1/2

SUL(L2 + σ2IK

)−1VT = ULVT

SUL = U(L2 + σ2IK

)L

which implies that uj is the eigenvector of S with eigenvalue of λj = σ2 + l2j . Therefore all potential solutions forWML may be written as

WML =UK

(KK − σ2IK

)1/2Rρ−1/2

where

kjj =

{λj eigenvalue of ujσ2 otherwise

Where R is (D ×K) orthonomal matrix. The weighting term ρ allows to explicit control over the scale of the differentprojection axis. ρ controls if we should place more or less importance on the role of the input to the projection axis,which is meant to reflect our posterior belief of re-scaling due to not all data points sharing all subspaces. Appropriatescaling with ρ can address a well known pitfalls of PCA such as: the disproportionate crowding of the projections dueto outliers or multi-modalities; the sphericalization of the projection

B Updating hyperparameters

Updating σ2

We place a inverse-Gamma prior on σ2 with parameters {γ, ϑ}

p(σ2|γ, ϑ

)=

ϑγ

Γ (γ)

(σ2)−γ−1

exp

[− ϑ

(σ2)

]then the posterior distribution over σ2 is

p(σ2|γ, ϑ,Y,W,X,Z

)=

ϑγ

Γ (γ)

(σ2)−γ−1

exp

[− ϑ

σ2

]× 1

(2πσ2)ND2

exp

(− 1

2σ2

N∑n=1

[(yn −W (xn � zn))

T(yn −W (xn � zn))

])∝(σ2)−(γ+ND/2)−1

× exp

(− 1

σ2

(1

2tr[(Y −W (X� Z))

T(Y −W (X� Z))

]+ ϑ

))

19

Page 20: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

Figure 12: Python code for aPPCA updates on the rotation matrix W using PYMANOPT toolbox.

which is still a inverse-Gamma distribution with parameters γpost = γ + ND2 and ϑpost =

12 tr[(Y −W (X� Z))

T(Y −W (X� Z))

]+ ϑ

Updating α

We place a Gamma prior on the IBP concentration parameter α with parameters {λ, µ}

p (α|λ, µ) =µλ

Γ (λ)(α)

λ−1exp [−µα]

then the posterior distribution over α is

p (α|λ, µ,Y,W,X,Z) =µλ

Γ (λ)(α)

λ−1exp [−µα]

× exp (−αHN )αK ×

(K∏k=1

(mk − 1)! (N −mk)!

(N)!

)(21)

∝ (α)λ+K−1

exp (−α (HN + µ))

which is still a gamma distribution with parameters λpost = λ+K, µpost = HN + µ and HN =∑Nn=1

1n .

C Projection matrix update using PYMANOPT

For both variants of the aPPCA, the matrix W is updated numerically by minimising the negative-log of of Equation(15) over the Stiefel manifold with respect to the matrix W. Figure 12 shows the implementation of this using thePYMANOPT toolbox [37].

20

Page 21: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

References

[1] J. Bernardo, M. Bayarri, J. Berger, A. Dawid, D. Heckerman, A. Smith, and M. West, “Bayesian factor regressionmodels in the “large p, small n” paradigm,” Bayesian statistics, vol. 7, pp. 733–742, 2003.

[2] D. Knowles and Z. Ghahramani, “Infinite sparse factor analysis and infinite independent components analysis,”in International Conference on Independent Component Analysis and Signal Separation. Springer, 2007, pp.381–388.

[3] J. Paisley and L. Carin, “Nonparametric factor analysis with beta process priors,” in Proceedings of the 26thAnnual International Conference on Machine Learning. ACM, 2009, pp. 777–784.

[4] H. Zou, T. Hastie, and R. Tibshirani, “Sparse principal component analysis,” Journal of computational andgraphical statistics, vol. 15, no. 2, pp. 265–286, 2006.

[5] I. T. Jolliffe, N. T. Trendafilov, and M. Uddin, “A modified principal component technique based on the lasso,”Journal of computational and Graphical Statistics, vol. 12, no. 3, pp. 531–547, 2003.

[6] M. E. Tipping and C. M. Bishop, “Probabilistic principal component analysis,” Journal of the Royal StatisticalSociety: Series B (Statistical Methodology), vol. 61, no. 3, pp. 611–622, 1999.

[7] K. Pearson, “Liii. on lines and planes of closest fit to systems of points in space,” The London, Edinburgh, andDublin Philosophical Magazine and Journal of Science, vol. 2, no. 11, pp. 559–572, 1901.

[8] M. E. Tipping and C. M. Bishop, “Probabilistic principal component analysis,” Journal of the Royal StatisticalSociety: Series B (Statistical Methodology), vol. 61, no. 3, pp. 611–622, 1999.

[9] H. H. Harman, Modern factor analysis. Univ. of Chicago Press, 1960.

[10] P. Comon, “Independent component analysis, a new concept?” Signal processing, vol. 36, no. 3, pp. 287–314,1994.

[11] Z. Dai, J. Hensman, and N. Lawrence, “Spike and slab gaussian process latent variable models,” arXiv preprintarXiv:1505.02434, 2015.

[12] K. R. Campbell and C. Yau, “Probabilistic modeling of bifurcations in single-cell gene expression data using abayesian mixture of factor analyzers,” Wellcome open research, vol. 2, 2017.

[13] L. Parsons, E. Haque, and H. Liu, “Subspace clustering for high dimensional data: a review,” Acm SigkddExplorations Newsletter, vol. 6, no. 1, pp. 90–105, 2004.

[14] R. Vidal, “Subspace clustering,” IEEE Signal Processing Magazine, vol. 28, no. 2, pp. 52–68, 2011.

[15] Z. Ghahramani, G. E. Hinton et al., “The em algorithm for mixtures of factor analyzers,” Technical ReportCRG-TR-96-1, University of Toronto, Tech. Rep., 1996.

[16] Z. Ghahramani and M. J. Beal, “Variational inference for bayesian mixtures of factor analysers,” in Advances inneural information processing systems, 2000, pp. 449–455.

[17] P. Rai and H. Daumé, “The infinite hierarchical factor regression model,” in Advances in Neural InformationProcessing Systems, 2009, pp. 1321–1328.

[18] C. Elvira, P. Chainais, and N. Dobigeon, “Bayesian nonparametric principal component analysis,” arXiv preprintarXiv:1709.05667, 2017.

[19] G. Di Benedetto, F. Caron, and Y. W. Teh, “Non-exchangeable feature allocation models with sublinear growth ofthe feature sizes,” arXiv preprint arXiv:2003.13491, 2020.

[20] Y. W. Teh and D. Gorur, “Indian buffet processes with power-law behavior,” in Advances in neural informationprocessing systems, 2009, pp. 1838–1846.

[21] D. A. Van Dyk and T. Park, “Partially collapsed gibbs samplers: Theory and methods,” Journal of the AmericanStatistical Association, vol. 103, no. 482, pp. 790–796, 2008.

[22] N. L. Hjort et al., “Nonparametric bayes estimators based on beta processes in models for life history data,” TheAnnals of Statistics, vol. 18, no. 3, pp. 1259–1294, 1990.

[23] G. K. Zipf, “Selected studies of the principle of relative frequency in language,” 1932.

[24] J. Chesson, “A non-central multivariate hypergeometric distribution arising from biased sampling with applicationto selective predation,” Journal of Applied Probability, vol. 13, no. 4, pp. 795–797, 1976.

[25] T. Broderick, B. Kulis, and M. Jordan, “Mad-bayes: Map-based asymptotic derivations from bayes,” in Interna-tional Conference on Machine Learning, 2013, pp. 226–234.

21

Page 22: Adam Farooq , Yordan P. Raykov , Petar Raykov , Max A ... · Adam Farooq 1, Yordan P. Raykov , Petar Raykov2, Max A. Little3;4 August 31, 2020 ABSTRACT Ubiquitous linear Gaussian

A PREPRINT - AUGUST 31, 2020

[26] Y. P. Raykov, A. Boukouvalas, M. A. Little et al., “Simple approximate map inference for dirichlet processesmixtures,” Electronic Journal of Statistics, vol. 10, no. 2, pp. 3548–3578, 2016.

[27] Y. Raykov, “A deterministic inference framework for discrete nonparametric latent variable models: learningcomplex probabilistic models with simple algorithms,” Ph.D. dissertation, Aston University, 2017.

[28] A. Gelman, J. B. Carlin, H. S. Stern, D. B. Dunson, A. Vehtari, and D. B. Rubin, Bayesian data analysis. CRCpress, 2013.

[29] B. Carpenter, A. Gelman, M. D. Hoffman, D. Lee, B. Goodrich, M. Betancourt, M. Brubaker, J. Guo, P. Li, andA. Riddell, “Stan: A probabilistic programming language,” Journal of statistical software, vol. 76, no. 1, 2017.

[30] C. J. Maddison, A. Mnih, and Y. W. Teh, “The concrete distribution: A continuous relaxation of discrete randomvariables,” arXiv preprint arXiv:1611.00712, 2016.

[31] A. E. Raftery and S. M. Lewis, “[practical markov chain monte carlo]: comment: one long run with diagnostics:implementation strategies for markov chain monte carlo,” Statistical science, vol. 7, no. 4, pp. 493–497, 1992.

[32] H. D. Tagare, “Notes on optimization on stiefel manifolds,” in Technical report, Technical report. Yale University,2011.

[33] C. Bingham, “An antipodally symmetric distribution on the sphere,” The Annals of Statistics, pp. 1201–1225,1974.

[34] C. Khatri and K. V. Mardia, “The von mises–fisher matrix distribution in orientation statistics,” Journal of theRoyal Statistical Society: Series B (Methodological), vol. 39, no. 1, pp. 95–106, 1977.

[35] C. S. Herz, “Bessel functions of matrix argument,” Annals of Mathematics, pp. 474–523, 1955.[36] C. J. Fallaize and T. Kypraios, “Exact bayesian inference for the bingham distribution,” Statistics and Computing,

vol. 26, no. 1-2, pp. 349–360, 2016.[37] J. Townsend, N. Koep, and S. Weichwald, “Pymanopt: A python toolbox for optimization on manifolds using

automatic differentiation,” The Journal of Machine Learning Research, vol. 17, no. 1, pp. 4755–4759, 2016.[38] J. W. Miller and M. T. Harrison, “A simple example of dirichlet process mixture inconsistency for the number of

components,” in Advances in neural information processing systems, 2013, pp. 199–206.[39] Y. LeCun, C. Cortes, and C. J. Burges, “The mnist database of handwritten digits, 1998,” URL http://yann. lecun.

com/exdb/mnist, vol. 10, p. 34, 1998.[40] J. Paisley and L. Carin, “Nonparametric factor analysis with beta process priors,” in Proceedings of the 26th

Annual International Conference on Machine Learning, 2009, pp. 777–784.[41] D. P. Kingma and M. Welling, “Auto-encoding variational bayes,” arXiv preprint arXiv:1312.6114, 2013.[42] E. Zarahn, G. K. Aguirre, and M. D’Esposito, “Empirical analyses of bold fmri statistics,” NeuroImage, vol. 5,

no. 3, pp. 179–197, 1997.[43] R. H. Pruim, M. Mennes, D. van Rooij, A. Llera, J. K. Buitelaar, and C. F. Beckmann, “Ica-aroma: A robust

ica-based strategy for removing motion artifacts from fmri data,” Neuroimage, vol. 112, pp. 267–277, 2015.[44] V. D. Calhoun, T. Adali, L. K. Hansen, J. Larsen, and J. J. Pekar, “Ica of functional mri data: an overview,” in in

Proceedings of the International Workshop on Independent Component Analysis and Blind Signal Separation.Citeseer, 2003.

[45] J. Taghia, S. Ryali, T. Chen, K. Supekar, W. Cai, and V. Menon, “Bayesian switching factor analysis for estimatingtime-varying functional connectivity in fmri,” Neuroimage, vol. 155, pp. 271–290, 2017.

[46] C. F. Beckmann and S. M. Smith, “Tensorial extensions of independent component analysis for multisubject fmrianalysis,” Neuroimage, vol. 25, no. 1, pp. 294–311, 2005.

[47] P. A. Højen-Sørensen, O. Winther, and L. K. Hansen, “Analysis of functional neuroimages using ica with adaptivebinary sources,” Neurocomputing, vol. 49, no. 1-4, pp. 213–225, 2002.

[48] M. J. McKeown, L. K. Hansen, and T. J. Sejnowsk, “Independent component analysis of functional mri: what issignal and what is noise?” Current opinion in neurobiology, vol. 13, no. 5, pp. 620–629, 2003.

[49] V. D. Calhoun, J. Liu, and T. Adalı, “A review of group ica for fmri data and ica for joint inference of imaging,genetic, and erp data,” Neuroimage, vol. 45, no. 1, pp. S163–S172, 2009.

22