# GFApred: Predict samples of one view given the other(s) In CCAGFA: Bayesian Canonical Correlation Analysis and Group Factor Analysis

## Description

Function for making predictions from some subset of views to the remaining ones. This can be used, for example, for multi-output regression and classification tasks.

## Usage

 ```1 2``` ```CCApred(pred, Y, model, sample = FALSE, nSample = 100) GFApred(pred, Y, model, sample = FALSE, nSample = 100) ```

## Arguments

 `pred` A vector of binary indicators telling which of the views are observed (1), and which are to be predicted (0). `Y` The input data as a list of M elements, N times D[m] matrices. `model` A list of model parameters as returned by `GFA`. `sample` Boolean indicator telling whether to also draw samples from the predictive distribution. `nSample` How many samples to draw if `sample=TRUE`.

## Details

Estimates the conditional distribution of Z given the observed view and then estimates the expected predictions for the unobserved view. It is also possible to draw samples from the full predictive distribution, which cannot be specified in analytic form.

## Value

 `Y` The mean predictions. Also the observed input data is returned, so that Y is in the same format as the input data for `GFA`. `Z` The mean of the latent variables given the observed data. `covZ` The covariance of the latent variables given the observed data. `sam` List that contain `nSample` elements. Each is a list that contains the projection matrices (`W`), the latent variables (`Z`), and the `N` samples drawn from the predictive posterior.

## Author(s)

Seppo Virtanen and Arto Klami

`GFA`,`CCA`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ``` # # Assume we have a variable model which has been learned with # CCAexperiment() or CCA(). # # Predict the 2nd view: # # predictedY <- CCApred(c(1,0),Y,model)\$Y # # Draw some samples from the conditional distribution of the # first view given the second # # sampled <- CCApred(c(0,1),Y,model,sample=TRUE,nSample=10)\$sam\$Y # ```