Description Usage Arguments Details Value Author(s) References Examples
These functions fit different variants of Gaussian mixture models. These variants differ in the fraction of knowledge utilized into the the fitting procedure.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | belief(X, knowns, B = NULL, k = ifelse(!is.null(B), ncol(B),
ifelse(!is.null(P), ncol(P), length(unique(class)))), P = NULL,
class = map(B), init.params = init.model.params(X, knowns,
B = B, P = P, class = class, k = k), model.structure = getModelStructure(),
stop.likelihood.change = 10^-5, stop.max.nsteps = 100, trace = FALSE,
b.min = 0.025,
all.possible.permutations=FALSE, pca.dim.reduction = NA)
soft(X, knowns, P = NULL, k = ifelse(!is.null(P), ncol(P),
ifelse(!is.null(B), ncol(B), length(unique(class)))), B = NULL,
class = NULL, init.params = init.model.params(X, knowns,
class = class, B = P, k = k),
model.structure = getModelStructure(), stop.likelihood.change = 10^-5,
stop.max.nsteps = 100, trace = FALSE, b.min = 0.025,
all.possible.permutations=FALSE, pca.dim.reduction = NA, ...)
semisupervised(X, knowns, class = NULL, k = ifelse(!is.null(class),
length(unique(class)), ifelse(!is.null(B), ncol(B), ncol(P))),
B = NULL, P = NULL, ..., init.params = NULL,
all.possible.permutations=FALSE, pca.dim.reduction = NA)
supervised(knowns, class = NULL, k = length(unique(class)), B = NULL, P = NULL,
model.structure = getModelStructure(), ...)
unsupervised(X, k, init.params=init.model.params(X, knowns=NULL, k=k),
model.structure=getModelStructure(), stop.likelihood.change=10^-5,
stop.max.nsteps=100, trace=FALSE, ...)
|
X |
a data.frame with the unlabeled observations. The rows correspond to the observations while the columns to variables/dimensions of the data. |
knowns |
a data.frame with the labeled observations. The rows correspond to the observations while the columns to variables/dimensions of the data. |
B |
a beliefs matrix which specifies the distribution of beliefs for the labeled observations. The number of rows in B should equal the number of rows in the data.frame |
P |
a matrix of plausibilities, i.e., weights of the prior probabilities for the labeled observations. If matrix |
class |
a vector of classes/labels for the labeled observations. The number of its unique values has to be less or equal |
k |
a number of components, by default equal to the number of columns of |
init.params |
initial values for the estimates of the model parameters (means, variances and mixing proportions), by default derived with the
use of the |
stop.likelihood.change, stop.max.nsteps |
the parameters for the EM algorithms defining the stop criteria, i.e., the minimum required improvement of loglikelihood and the maximum number of steps. |
trace |
if |
model.structure |
an object returned by the |
b.min |
this argument is passed to the |
... |
these arguments will be passed tothe |
all.possible.permutations |
If equal |
pca.dim.reduction |
Since the fitting for high dimensional space is numerically a bad idea an attempt to PCA will be performed if |
In the belief()
function, if the argument B
is not provided, it is
by default initialized from the argument P
. If the argument P
is not
provided, B
is derived from the class
argument with the use of the function get.simple.beliefs()
which assigns 1-(k-1)*b.min
to the component given by class
and
b.min
to all remaining components.
In the soft()
function, if the argument P
is not provided, it is
by default initialized from the argument B
. If the argument B
is not
provided, P
is derived from the class
argument as in the belief()
function.
In the supervised()
function, if the argument class
is not provided,
it is by default initialized from argument B
or P
, taking the label of each
observation as its most believed or plausible component (by the MAP rule).
The number of columns in the beliefs matrix B
or in the matrix of
plausibilities P
may be smaller than the number of model components
defined by the argument k
. Such situation corresponds to the scenario
when the user does not know any examples for some component. In other words, this component is not used as a label for
any observation, and thus can be omitted from the beliefs matrix. An
equivalent would be to include a column for this component and fill it
with beliefs/plausibilities equal 0.
Slots in the returned object are listed in section Value.
The returned object differs slighty with respect to the used function. Namely, the belief()
function returns an object with the slot B
. The function soft()
returns an object with a slot P
, while the functions supervised()
and semisupervised()
return objects with a slot class
instead.
The object returned by the function supervised()
does not have the slot X
.
An object of the class mModel
, with the following slots:
pi |
a vector with the fitted mixing proportions |
mu |
a matrix with the means' vectors, fitted for all components |
cvar |
a three-dimensional matrix with the covariance matrices, fitted for all components |
X |
the unlabeled observations |
knowns |
the labeled observations |
B |
the beliefs matrix |
n |
the number of all observations |
m |
the number of the unlabeled observations |
k |
the number of fitted model components |
d |
the data dimension |
likelihood |
the log-likelihood of the fitted model |
n.steps |
the number of steps performed by the EM algorithm |
model.structure |
the set of constraints kept during the fitting process. |
Przemyslaw Biecek
Przemyslaw Biecek, Ewa Szczurek, Martin Vingron, Jerzy Tiuryn (2012), The R Package bgmm: Mixture Modeling with Uncertain Knowledge, Journal of Statistical Software.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | data(genotypes)
modelSupervised = supervised(knowns=genotypes$knowns,
class=genotypes$labels)
plot(modelSupervised)
modelSemiSupervised = semisupervised(X=genotypes$X,
knowns=genotypes$knowns, class = genotypes$labels)
plot(modelSemiSupervised)
modelBelief = belief(X=genotypes$X,
knowns=genotypes$knowns, B=genotypes$B)
plot(modelBelief)
modelSoft = soft(X=genotypes$X,
knowns=genotypes$knowns, P=genotypes$B)
plot(modelSoft)
modelUnSupervised = unsupervised(X=genotypes$X, k=3)
plot(modelUnSupervised)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.