show_IMIFA_digit {IMIFA} | R Documentation |
Plot the posterior mean image
Description
Plots the posterior mean of a given cluster from an "IMIFA"
-related model fit to a digit data set in the form of a square grayscale grid.
Usage
show_IMIFA_digit(res,
G = 1,
what = c("mean", "last"),
dat = NULL,
ind = NULL,
...)
Arguments
res |
An object of class |
G |
The index of the cluster for which the posterior mean digit is to be represented. |
what |
A switch controlling whether the |
dat |
The full grayscale grid data set (prior to centering and scaling). Necessary when |
ind |
The index of columns of |
... |
Additional arguments to be passed, via |
Details
This function is a wrapper to show_digit
which supplies the posterior mean digit of a given cluster from a "IMIFA"
model.
Value
The desired image representation of the posterior mean digit (or the last valid sample) from the desired cluster.
Note
Note that both centering and scaling of the original data prior to modelling is accounted for in reconstructing the means, but dat
, if necessary, must be the raw data prior to pre-processing.
Author(s)
Keefe Murphy - <keefe.murphy@mu.ie>
See Also
USPSdigits
, show_digit
, get_IMIFA_results
, mcmc_IMIFA
, mat2cols
, plot_cols
Examples
# Load the USPS data and discard peripheral digits
data(USPSdigits)
ylab <- USPSdigits$train[,1]
train <- USPSdigits$train[,-1]
ind <- apply(train, 2, sd) > 0.7
dat <- train[,ind]
# Fit an IMIFA model (warning: quite slow!)
# sim <- mcmc_IMIFA(dat, n.iters=1000, prec.mu=1e-03, z.init="kmeans",
# centering=FALSE, scaling="none")
# res <- get_IMIFA_results(sim, zlabels=ylab)
# Examine the posterior mean image of the first two clusters
# show_IMIFA_digit(res, dat=train, ind=ind)
# show_IMIFA_digit(res, dat=train, ind=ind, G=2)