Title: | Co-Clustering Adjusted Rand Index and Bikm1 Procedure for Contingency and Binary Data-Sets |
---|---|
Description: | Co-clustering of the rows and columns of a contingency or binary matrix, or double binary matrices and model selection for the number of row and column clusters. Three models are considered: the Poisson latent block model for contingency matrix, the binary latent block model for binary matrix and a new model we develop: the multiple latent block model for double binary matrices. A new procedure named bikm1 is implemented to investigate more efficiently the grid of numbers of clusters. Then, the studied model selection criteria are the integrated completed likelihood (ICL) and the Bayesian integrated likelihood (BIC). Finally, the co-clustering adjusted Rand index (CARI) to measure agreement between co-clustering partitions is implemented. Robert Valerie, Vasseur Yann, Brault Vincent (2021) <doi:10.1007/s00357-020-09379-w>. |
Authors: | Valerie Robert [aut, cre] |
Maintainer: | Valerie Robert <[email protected]> |
License: | GPL-2 |
Version: | 1.1.0 |
Built: | 2025-01-17 07:29:24 UTC |
Source: | CRAN |
This package is designed to co-cluster a contingency (resp. binary) matrix, or double binary matrices in blocks respectively under the (normalized or not) Poisson (resp binary) Latent Block Model and the Multiple Latent Block Model. It enables to automatically select the number of row and column clusters and to compare partition estimations with reference partitions.
Package for the segmentation of the rows and columns inducing a co-clustering and automatically select the number of row and column clusters.
BIKM1_LBM_Poisson
. This fitting procedure produces a BIKM1_LBM_Poisson
object.
BIKM1_LBM_Binary
. This fitting procedure produces a BIKM1_LBM_Binary
object.
BIKM1_MLBM_Binary
. This fitting procedure produces a BIKM1_MLBM_Binary
object.
Display of the result with plot,BIKM1_LBM_Poisson-method
and
with show,BIKM1_LBM_Poisson-method
, with summary,BIKM1_LBM_Poisson-method
and with print,BIKM1_LBM_Poisson-method
.
Display of the result with plot,BIKM1_LBM_Binary-method
and
with show,BIKM1_LBM_Binary-method
, with summary,BIKM1_LBM_Binary-method
and with print,BIKM1_LBM_Binary-method
.
Display of the result with plot,BIKM1_MLBM_Binary-method
and
with show,BIKM1_MLBM_Binary-method
, with summary,BIKM1_MLBM_Binary-method
and with print,BIKM1_MLBM_Binary-method
.
Valerie Robert [email protected]
Keribin, Celeux and Robert, The Latent Block Model: a useful model for high dimensional data. https://hal.inria.fr/hal-01658589/document
Govaert and Nadif. Co-clustering, Wyley (2013).
Keribin, Brault and Celeux. Estimation and Selection for the Latent Block Model on Categorical Data, Statistics and Computing (2014).
Robert. Classification croisee pour l'analyse de bases de donnees de grandes dimensions de pharmacovigilance. Thesis, Paris Saclay (2017).
Robert, Vasseur and Brault. Comparing high dimensional partitions with the Co-clustering Adjusted Rand Index, Journal of Classification, 38(1), 158-186 (2021).
Produce a measure of agreement between two partitions. A value of 1 means a perfect match.
ARI(v,vprime)
ARI(v,vprime)
v |
numeric vector specifying the class of observations. |
vprime |
numeric vector specifying another partitions of observations. |
a list including the arguments:
ari
: value of the index.
nv
: contingency table which the index is based on.
Hubert and Arabie. Comparing partitions. Journal of classification (1985).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') mv=ARI(res@model_max$v, data$xrow) mv$ari mv$nv mw=ARI(res@model_max$w, data$xcol)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') mv=ARI(res@model_max$v, data$xrow) mv$ari mv$nv mw=ARI(res@model_max$w, data$xcol)
Produce a blockwise estimation of a contingency matrix of observations.
BIKM1_LBM_Binary(x,Gmax,Hmax,a=4,b=1, Gstart=2,Hstart=2,init_choice='smallVBayes',userparam=NULL, ntry=50,criterion_choice='ICL', mc.cores=1,verbose=TRUE)
BIKM1_LBM_Binary(x,Gmax,Hmax,a=4,b=1, Gstart=2,Hstart=2,init_choice='smallVBayes',userparam=NULL, ntry=50,criterion_choice='ICL', mc.cores=1,verbose=TRUE)
x |
binary matrix of observations. |
Gmax |
a positive integer less than number of rows. |
Hmax |
a positive integer less than number of columns.The bikm1 procedure stops while the numbers of rows is higher than Gmax or the number of columns is higher than Hmax. |
a |
hyperparameter used in the VBayes algorithm for priors on the mixing proportions. By default, a=4. |
b |
hyperparameter used in the VBayes algorithm for prior on the Bernoulli parameter. By default, b=1. |
Gstart |
a positive integer to initialize the procedure with number of row clusters. By default, Gstart=2. |
Hstart |
a positive integer to initialize the procedure with number of column clusters. By default, Hstart=2. |
init_choice |
a character string corresponding to the chosen initialization strategy used for the procedure, which can be "random" or "smallVBayes" or "user". By default, init_choice="smallVBayes". |
userparam |
in the case where init_choice is "user", a list containing partitions z and w. By default userparam=NULL. |
ntry |
a positive integer corresponding to the number of times which is launched the small VBayes or random initialization strategy. By default ntry=100. |
criterion_choice |
a character string corresponding to the chosen criterion used for model selection, which can be "ICL" as for now. By default, criterion_choice="ICL". |
mc.cores |
a positive integer corresponding to the available number of cores for parallel computing. By default, mc.cores=1. |
verbose |
logical. To display each step and the result. By default verbose=TRUE. |
a BIKM1_LBM_Binary object including
model_max
: the selected model by the procedure with free energy W, theta, conditional probabilities (s_ig, r_jh), iter, empty_cluster, and the selected partitions z and w.
criterion_choice
: the chosen criterion
init_choice
: the chosen init choice
criterion tab
: the matrix containing the criterion values for each selected number of row and column
W_tab
: the matrix containing the free energy values for each selected number of row and column
criterion_max
: the maximum of the criterion values
gopt
: the selected number of rows
hopt
: the selected number of columns
Govaert and Nadif. Co-clustering, Wyley (2013).
Keribin, Brault and Celeux. Estimation and Selection for the Latent Block Model on Categorical Data, Statistics and Computing (2014).
Robert. Classification crois\'ee pour l'analyse de bases de donn\'ees de grandes dimensions de pharmacovigilance. Paris Saclay (2017).
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,2,Gstart=3,Hstart=2, init_choice='user',userparam=list(z=data$xrow,v=data$xcol))
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,2,Gstart=3,Hstart=2, init_choice='user',userparam=list(z=data$xrow,v=data$xcol))
Class of object returned by the BIKM1_LBM_Binary
function.
model_max
: The selected model by the procedure with free energy W, theta, conditional probabilities (s_ig, r_jh), iter, empty_cluster, and the selected partitions z and v.
criterion_choice
: A character string corresponding to the chosen criterion used for model selection, which can be "ICL" or "BIC".
init_choice
: A character string corresponding to the chosen initialization strategy used for the procedure, which can be "random" or "Gibbs" or "smallVBayes".
criterion_tab
: The matrix corresponding to the values of the chosen criterion for pairs of numbers of clusters visited by the BIKM1_LBM_Binary function. The matrix rows design the numbers of row clusters. If a pair is not visited, by default, the value is -Inf.
W_tab
: The matrix corresponding to the values of the free energy (minimizer of the loglikelihood in the algorithm) for pairs of numbers of clusters visited by the procedure. The matrix rows design the numbers of row clusters. If a pair is not visited, by default, the value is -Inf.
criterion_max
: Numeric indicating the maximum of the criterion values, calculated on the pairs of numbers of clusters visited by the BIKM1_LBM_Binary function.
gopt
: An integer value indicating the number of row clusters selected by the BIKM1_LBM_Binary function.
hopt
: An integer value indicating the number of column clusters selected by the BIKM1_LBM_Binary function.
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,3,a=4,init_choice='smallVBayes')
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,3,a=4,init_choice='smallVBayes')
Produce a blockwise estimation of a contingency matrix of observations.
BIKM1_LBM_Poisson(x,Hmax,Lmax,a=4,alpha=1,beta=0.01, Hstart=2,Lstart=2,normalization=FALSE,init_choice='smallVBayes', userparam=NULL,ntry=50,criterion_choice='ICL', mc.cores=1,verbose=TRUE)
BIKM1_LBM_Poisson(x,Hmax,Lmax,a=4,alpha=1,beta=0.01, Hstart=2,Lstart=2,normalization=FALSE,init_choice='smallVBayes', userparam=NULL,ntry=50,criterion_choice='ICL', mc.cores=1,verbose=TRUE)
x |
contingency matrix of observations. |
Hmax |
a positive integer less than number of rows. |
Lmax |
a positive integer less than number of columns.The bikm1 procedure stops while the numbers of rows is higher than Hmax or the number of columns is higher than Lmax. |
a |
hyperparameter used in the VBayes algorithm for priors on the mixing proportions. By default, a=4. |
alpha |
hyperparameter used in the VBayes algorithm for prior on the Poisson parameter. By default, alpha=1. |
beta |
hyperparameter used in the VBayes algorithm for prior on the Poisson parameter. By default, beta=0.01. |
Hstart |
a positive integer to initialize the procedure with number of row clusters. By default, Hstart=2. |
Lstart |
a positive integer to initialize the procedure with number of column clusters. By default, Lstart=2. |
normalization |
logical. To use the normalized Poisson modelling in the Latent Block Model. By default normalization=FALSE. |
init_choice |
character string corresponding to the chosen initialization strategy used for the procedure, which can be "random" or "Gibbs" (higher time computation) or "smallVBayes" or "user". By default, init_choice="smallVBayes" |
userparam |
In the case where init_choice is "user", a list containing partitions v and w. |
ntry |
a positive integer corresponding to the number of times which is launched the small VBayes or random initialization strategy. By default ntry=50. |
criterion_choice |
Character string corresponding to the chosen criterion used for model selection, which can be "ICL" or "BIC". By default, criterion_choice="ICL". |
mc.cores |
a positive integer corresponding to the available number of cores for parallel computing. By default, mc.cores=1. |
verbose |
logical. To display each step and the result. By default verbose=TRUE. |
a BIKM1_LBM_Poisson object including
model_max
: the selected model by the procedure with free energy W, theta, conditional probabilities (r_jh, t_kl), iter, empty_cluster, and the selected partitions v and w.
criterion_choice
: the chosen criterion
init_choice
: the chosen init choice
criterion tab
: matrix containing the criterion values for each selected number of row and column
W_tab
: matrix containing the free energy values for each selected number of row and column
criterion_max
: maximum of the criterion values
hopt
: the selected number of rows
lopt
: the selected number of columns
Keribin, Celeux and Robert, The Latent Block Model: a useful model for high dimensional data. https://hal.inria.fr/hal-01658589/document
Govaert and Nadif. Co-clustering, Wyley (2013).
Keribin, Brault and Celeux. Estimation and Selection for the Latent Block Model on Categorical Data, Statistics and Computing (2014).
Robert. Classification crois\'ee pour l'analyse de bases de donn\'ees de grandes dimensions de pharmacovigilance. Paris Saclay (2017).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,2,Hstart=3,Lstart=2, init_choice='user',userparam=list(v=data$xrow,w=data$xcol))
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,2,Hstart=3,Lstart=2, init_choice='user',userparam=list(v=data$xrow,w=data$xcol))
Class of object returned by the BIKM1_LBM_Poisson
function.
model_max
: The selected model by the procedure with free energy W, theta, conditional probabilities (r_jh, t_kl), iter, empty_cluster, and the selected partitions v and w.
criterion_choice
: A character string corresponding to the chosen criterion used for model selection, which can be "ICL" or "BIC".
init_choice
: A character string corresponding to the chosen initialization strategy used for the procedure, which can be "random" or "Gibbs" or "smallVBayes".
criterion_tab
: The matrix corresponding to the values of the chosen criterion for pairs of numbers of clusters visited by the BIKM1_LBM_Poisson function. The matrix rows design the numbers of row clusters. If a pair is not visited, by default, the value is -Inf.
W_tab
: The matrix corresponding to the values of the free energy (minimizer of the loglikelihood in the algorithm) for pairs of numbers of clusters visited by the procedure. The matrix rows design the numbers of row clusters. If a pair is not visited, by default, the value is -Inf.
criterion_max
: Numeric indicating the maximum of the criterion values, calculated on the pairs of numbers of clusters visited by the BIKM1_LBM_Poisson function.
lopt
: An Integer value indicating the number of row clusters selected by the BIKM1_LBM_Poisson function.
hopt
: An integer value indicating the number of column clusters selected by the BIKM1_LBM_Poisson function.
require(bikm1) set.seed(42) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(floor(runif(h*l)*20+1),ncol=l) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,3,4,init_choice='smallVBayes')
require(bikm1) set.seed(42) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(floor(runif(h*l)*20+1),ncol=l) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,3,4,init_choice='smallVBayes')
Produce a blockwise estimation of double matrices of observations.
BIKM1_MLBM_Binary(x,y,Gmax,Hmax,Lmax,a=4,b=1, Gstart=2,Hstart=2,Lstart=2,init_choice='smallVBayes',userparam=NULL, ntry=50,criterion_choice='ICL', mc.cores=1,verbose=TRUE)
BIKM1_MLBM_Binary(x,y,Gmax,Hmax,Lmax,a=4,b=1, Gstart=2,Hstart=2,Lstart=2,init_choice='smallVBayes',userparam=NULL, ntry=50,criterion_choice='ICL', mc.cores=1,verbose=TRUE)
x |
matrix of observations (1rst matrix). |
y |
matrix of observations (2nd matrix). |
Gmax |
a positive integer less than number of rows. |
Hmax |
a positive integer less than number of columns of the 1st matrix. |
Lmax |
a positive integer less than number of columns of the 2nd matrix. The bikm1 procedure stops while the numbers of rows is higher than Gmax or the number of columns is higher than Hmax or the numbers of columns(2nd matrix) is higher than Lmax. |
a |
hyperparameter used in the VBayes algorithm for priors on the mixing proportions. By default, a=4. |
b |
hyperparameter used in the VBayes algorithm for prior on the Bernoulli parameter. By default, b=1. |
Gstart |
a positive integer to initialize the procedure with number of row clusters. By default, Gstart=2. |
Hstart |
a positive integer to initialize the procedure with number of column clusters. By default, Hstart=2. |
Lstart |
a positive integer to initialize the procedure with number of column clusters. By default, Lstart=2. |
init_choice |
character string corresponding to the chosen initialization strategy used for the procedure, which can be "random" or "smallVBayes" or "user". By default, init_choice="smallVBayes". |
userparam |
In the case where init_choice is "user", a list containing partitions z,v and w. |
ntry |
a positive integer corresponding to the number of times which is launched the small VBayes initialization strategy. By default ntry=100. |
criterion_choice |
Character string corresponding to the chosen criterion used for model selection, which can be "ICL" as for now. By default, criterion_choice="ICL". |
mc.cores |
a positive integer corresponding to the available number of cores for parallel computing. By default, mc.cores=1. |
verbose |
logical. To display each step and the result. By default verbose=TRUE. |
a BIKM1_MLBM_Binary object including
model_max
: the selected model by the procedure including free energy W, theta, conditional probabilities (s_ig, r_jh,t_kl), iter, empty_cluster, and the selected partitions z,v and w.
criterion_choice
: the chosen criterion
init_choice
: the chosen init_choice
criterion_tab
: matrix containing the criterion values for each selected number of row and column
W_tab
: matrix containing the free energy values for each selected number of row and column
criterion_max
: maximum of the criterion values
gopt
: the selected number of rows
hopt
: the selected number of columns (1rst matrix)
lopt
: the selected number of columns (2nd matrix)
Govaert and Nadif. Co-clustering, Wyley (2013).
Keribin, Brault and Celeux. Estimation and Selection for the Latent Block Model on Categorical Data, Statistics and Computing (2014).
Robert. Classification crois\'ee pour l'analyse de bases de donn\'ees de grandes dimensions de pharmacovigilance. Paris Saclay (2017).
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,2,2,Gstart=3,Hstart=2,Lstart=2,init_choice='user', userparam=list(z=data$xrow,v=data$xcolx,w=data$xcoly))
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,2,2,Gstart=3,Hstart=2,Lstart=2,init_choice='user', userparam=list(z=data$xrow,v=data$xcolx,w=data$xcoly))
Class of object returned by the BIKM1_MLBM_Binary
function.
model_max
: The selected model by the procedure with free energy W, theta, conditional probabilities (s_ig, r_jh, t_kl), iter, empty_cluster, and the selected partitions z, v and w.
criterion_choice
: A character string corresponding to the chosen criterion used for model selection, which can be "ICL" or "BIC".
init_choice
: A character string corresponding to the chosen initialization strategy used for the procedure, which can be "random" or "Gibbs" or "smallVBayes".
criterion_tab
: The matrix corresponding to the values of the chosen criterion for pairs of numbers of clusters visited by the BIKM1_MLBM_Binary function. The matrix rows design the numbers of row clusters. If a pair is not visited, by default, the value is -Inf.
W_tab
: The matrix corresponding to the values of the free energy (minimizer of the loglikelihood in the algorithm) for pairs of numbers of clusters visited by the procedure. The matrix rows design the numbers of row clusters. If a pair is not visited, by default, the value is -Inf.
criterion_max
: Numeric indicating the maximum of the criterion values, calculated on the pairs of numbers of clusters visited by the BIKM1_MLBM_Binary function.
gopt
: An integer value indicating the number of row clusters selected by the BIKM1_MLBM_Binary function.
hopt
: An integer value indicating the number of column clusters for the first matrix selected by the BIKM1_MLBM_Binary function.
lopt
: An integer value indicating the number of row clusters for the second matrix selected by the BIKM1_MLBM_Binary function.
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4,init_choice='smallVBayes')
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4,init_choice='smallVBayes')
Produce a value of the ICL criterion in the Binary LBM.
BinBlocICL_LBM(a,b,x,z1,v1)
BinBlocICL_LBM(a,b,x,z1,v1)
a |
an hyperparameter for priors on the mixing proportions. By default, a=4. |
b |
an hyperparameter for prior on the Bernoulli parameter. By default, b=1. |
x |
contingency matrix of observations. |
z1 |
a numeric vector specifying the class of rows. |
v1 |
a numeric vector specifying the class of columns. |
a value of the ICL criterion.
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) BinBlocICL_LBM(a=4,b=1,data$x, data$xrow,data$xcol)
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) BinBlocICL_LBM(a=4,b=1,data$x, data$xrow,data$xcol)
Produce a plot object representing the resumed co-clustered data-sets.
BinBlocICL_MLBM(a,b,x,y,z1,v1,w1)
BinBlocICL_MLBM(a,b,x,y,z1,v1,w1)
a |
an hyperparameter for priors on the mixing proportions. By default, a=4. |
b |
an hyperparameter for prior on the Bernoulli parameter. By default, b=1. |
x |
binary matrix of observations (1rst matrix). |
y |
binary matrix of observations (2nd matrix). |
z1 |
a numeric vector specifying the class of rows. |
v1 |
a numeric vector specifying the class of columns (1rst matrix). |
w1 |
a numeric vector specifying the class of columns (2nd matrix). |
a value of the ICL criterion.
require(bikm1) set.seed(42) n=200 J=120 K=120 g=2 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(4),ncol=h) theta$beta_gl=matrix(runif(4),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,2,2,2,4,init_choice='smallVBayes') BinBlocICL_MLBM(a=4,b=1,data$x,data$y, data$xrow,data$xcolx,data$xcoly)
require(bikm1) set.seed(42) n=200 J=120 K=120 g=2 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(4),ncol=h) theta$beta_gl=matrix(runif(4),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,2,2,2,4,init_choice='smallVBayes') BinBlocICL_MLBM(a=4,b=1,data$x,data$y, data$xrow,data$xcolx,data$xcoly)
Produce a data matrix generated under the Binary Latent Block Model.
BinBlocRnd_LBM(n,J,theta)
BinBlocRnd_LBM(n,J,theta)
n |
a positive integer specifying the number of expected rows. |
J |
a positive integer specifying the number of expected columns. |
theta |
a list specifying the model parameters:
|
a list including the arguments:
x
: simulated data matrix.
xrow
: numeric vector specifying row partition.
xcol
: numeric vector specifying column partition.
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta)
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta)
Produce two simulated data matrices generated under the Binary Multiple Latent Block Model.
BinBlocRnd_MLBM(n,J,K,theta)
BinBlocRnd_MLBM(n,J,K,theta)
n |
a positive integer specifying the number of expected rows. |
J |
a positive integer specifying the number of expected columns of the first matrix. |
K |
a positive integer specifying the number of expected columns of the second matrix. |
theta |
a list specifying the model parameters:
|
a list including the arguments:
x
: simulated first data matrix.
y
: simulated second data matrix.
xrow
: numeric vector specifying row partition.
xcolx
: numeric vector specifying first matrix column partition.
xcoly
: numeric vector specifying second matrix column partition.
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta)
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta)
Produce a plot object representing the co-clustered data-sets.
BinBlocVisu_LBM(x,z,v)
BinBlocVisu_LBM(x,z,v)
x |
data matrix of observations. |
z |
a numeric vector specifying the class of rows. |
v |
a numeric vector specifying the class of columns. |
a plot object
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) BinBlocVisu_LBM(data$x,data$xrow,data$xcol)
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) BinBlocVisu_LBM(data$x,data$xrow,data$xcol)
Produce a plot object representing the co-clustered data-sets.
BinBlocVisu_MLBM(x,y,z,v,w)
BinBlocVisu_MLBM(x,y,z,v,w)
x |
first data matrix of observations. |
y |
second data matrix of observations. |
z |
a numeric vector specifying the class of rows. |
v |
a numeric vector specifying the class of columns (1rst matrix). |
w |
a numeric vector specifying the class of columns (2nd matrix). |
a plot object
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) BinBlocVisu_MLBM(data$x,data$y, data$xrow,data$xcolx,data$xcoly)
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) BinBlocVisu_MLBM(data$x,data$y, data$xrow,data$xcolx,data$xcoly)
Produce a plot object representing the resumed co-clustered data-sets.
BinBlocVisuResum_LBM(x,z,v)
BinBlocVisuResum_LBM(x,z,v)
x |
binary matrix of observations. |
z |
a numeric vector specifying the class of rows. |
v |
a numeric vector specifying the class of columns. |
a plot object.
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) BinBlocVisuResum_LBM(data$x,data$xrow,data$xcol)
require(bikm1) set.seed(42) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) BinBlocVisuResum_LBM(data$x,data$xrow,data$xcol)
Produce a plot object representing the resumed co-clustered data-sets.
BinBlocVisuResum_MLBM(x,y,z,v,w)
BinBlocVisuResum_MLBM(x,y,z,v,w)
x |
binary matrix of observations. |
y |
binary second matrix of observations. |
z |
a numeric vector specifying the class of rows. |
v |
a numeric vector specifying the class of columns (1rst matrix). |
w |
a numeric vector specifying the class of columns (2nd matrix). |
a plot object.
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) BinBlocVisuResum_MLBM(data$x,data$y, data$xrow,data$xcolx,data$xcoly)
require(bikm1) set.seed(42) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) BinBlocVisuResum_MLBM(data$x,data$y, data$xrow,data$xcolx,data$xcoly)
Produce a measure of agreement between two pairs of partitions for co-clustering. A value of 1 means a perfect match.
CARI(v,w,vprime,wprime)
CARI(v,w,vprime,wprime)
v |
numeric vector specifying the class of rows. |
w |
numeric vector specifying the class of columns. |
vprime |
numeric vector specifying another partition of rows. |
wprime |
numeric vector specifying another partition of columns. |
a list including the arguments:
cari
: value of the index (between 0 and 1). A value of 1 corresponds to a perfect match.
nvw
: contingency table which the index is based on.
Robert, Vasseur and Brault. Comparing high dimensional partitions with the Co-clustering Adjusted Rand Index, Journal of classification 38 (1), 158-186 (2021).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') me=CARI(res@model_max$v,res@model_max$w, data$xrow,data$xcol) me$cari me$nvw
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') me=CARI(res@model_max$v,res@model_max$w, data$xrow,data$xcol) me$cari me$nvw
Produce a measure of agreement between two pairs of partitions for co-clustering using CE_simple on columns and rows of a matrix. A value of 1 means a perfect match.
CE_LBM(v,w,vprime,wprime)
CE_LBM(v,w,vprime,wprime)
v |
numeric vector specifying the class of rows. |
w |
numeric vector specifying the class of columns. |
vprime |
numeric vector specifying another partition of rows. |
wprime |
numeric vector specifying another partition of columns. |
ce_vw: the value of the index (between 0 and 1). A value of 0 corresponds to a perfect match.
require(bikm1) set.seed(42) v=floor(runif(4)*2) vprime=floor(runif(4)*2) w=floor(runif(4)*3) wprime=floor(runif(4)*3) error=CE_LBM(v,w,vprime,wprime)
require(bikm1) set.seed(42) v=floor(runif(4)*2) vprime=floor(runif(4)*2) w=floor(runif(4)*3) wprime=floor(runif(4)*3) error=CE_LBM(v,w,vprime,wprime)
Produce a measure of agreement between two triplets of partitions for co-clustering. A value of 1 means a perfect match.
CE_MLBM(z,v,w,zprime,vprime,wprime)
CE_MLBM(z,v,w,zprime,vprime,wprime)
z |
numeric vector specifying the class of rows. |
v |
numeric vector specifying the class of column partitions for the first matrix. |
w |
numeric vector specifying the class of column partitions for the second matrix. |
zprime |
numeric vector specifying another partitions of rows. |
vprime |
numeric vector specifying another partition of columns for the first matrix. |
wprime |
numeric vector specifying another partition of columns for the second matrix. |
the value of the index (between 0 and 1). A value of 0 corresponds to a perfect match.
require(bikm1) set.seed(42) n=200 J=120 K=120 g=2 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(4),ncol=h) theta$beta_gl=matrix(runif(4),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,2,2,2,4,init_choice='smallVBayes') error=CE_MLBM(res@model_max$z,res@model_max$v,res@model_max$w,data$xrow,data$xcolx,data$xcoly)
require(bikm1) set.seed(42) n=200 J=120 K=120 g=2 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(4),ncol=h) theta$beta_gl=matrix(runif(4),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,2,2,2,4,init_choice='smallVBayes') error=CE_MLBM(res@model_max$z,res@model_max$v,res@model_max$w,data$xrow,data$xcolx,data$xcoly)
Produce a measure of agreement between two partitions for clustering. A value of 1 means a perfect match.
CE_simple(v,vprime)
CE_simple(v,vprime)
v |
numeric vector specifying the class of rows. |
vprime |
numeric vector specifying the class of rows. |
the value of the index.
require(bikm1) set.seed(42) v=floor(runif(4)*3) vprime=floor(runif(4)*3) error=CE_simple(v,vprime) error
require(bikm1) set.seed(42) v=floor(runif(4)*3) vprime=floor(runif(4)*3) error=CE_simple(v,vprime) error
Produce a measure of agreement between two pairs of partitions for co-clustering. A value of 1 means a perfect match.
CoNMI(v,w,vprime,wprime)
CoNMI(v,w,vprime,wprime)
v |
numeric vector specifying the class of rows. |
w |
numeric vector specifying the class of columns. |
vprime |
numeric vector specifying another partition of rows. |
wprime |
numeric vector specifying another partition of columns. |
the value of the index.
Robert, Vasseur and Brault. Comparing high dimensional partitions with the Co-clustering Adjusted Rand Index, Journal of Classification (2021).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') me=CoNMI(res@model_max$v,res@model_max$w, data$xrow,data$xcol) me
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') me=CoNMI(res@model_max$v,res@model_max$w, data$xrow,data$xcol) me
Produce a measure of agreement between two pairs of partitions for co-clustering. A value of 1 means a perfect match.
ENMI(v,w,vprime,wprime)
ENMI(v,w,vprime,wprime)
v |
numeric vector specifying the class of rows. |
w |
numeric vector specifying the class of columns. |
vprime |
numeric vector specifying another partition of rows. |
wprime |
numeric vector specifying another partition of columns. |
the value of the index.
Robert, Vasseur and Brault. Comparing high dimensional partitions with the Co-clustering Adjusted Rand Index, Journal of Classification (2021).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') me=ENMI(res@model_max$v,res@model_max$w, data$xrow,data$xcol) me
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') me=ENMI(res@model_max$v,res@model_max$w, data$xrow,data$xcol) me
Produce a measure of agreement between two partitions.(between 0 and 1). A value of 1 corresponds to a perfect match.
MI_simple(v,vprime)
MI_simple(v,vprime)
v |
numeric vector specifying the class of observations. |
vprime |
numeric vector specifying another partitions of observations. |
the value of the index.
Robert, Vasseur and Brault. Comparing high-dimensional partitions with the Co-clustering Adjusted Rand Index. Journal of Classification (2021).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') mi=MI_simple(res@model_max$v, data$xrow) mi mw=MI_simple(res@model_max$w, data$xcol)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') mi=MI_simple(res@model_max$v, data$xrow) mi mw=MI_simple(res@model_max$w, data$xcol)
Produce a measure of agreement between two pairs of partitions for co-clustering. A value of 1 means a perfect match.
NCE_LBM(v,w,vprime,wprime)
NCE_LBM(v,w,vprime,wprime)
v |
numeric vector specifying the class of rows. |
w |
numeric vector specifying the class of columns. |
vprime |
numeric vector specifying another partition of rows. |
wprime |
numeric vector specifying another partition of columns. |
the value of the index.
require(bikm1) set.seed(42) v=floor(runif(4)*2) vprime=floor(runif(4)*2) w=floor(runif(4)*3) wprime=floor(runif(4)*3) error=NCE_LBM(v,w,vprime,wprime)
require(bikm1) set.seed(42) v=floor(runif(4)*2) vprime=floor(runif(4)*2) w=floor(runif(4)*3) wprime=floor(runif(4)*3) error=NCE_LBM(v,w,vprime,wprime)
Produce a measure of agreement between two partitions for clustering. A value of 1 means a perfect match. It's the normalized version of CE_simple.
NCE_simple(v,vprime)
NCE_simple(v,vprime)
v |
numeric vector specifying the class of rows. |
vprime |
numeric vector specifying the class of rows. |
the value of the index. A value of 0 means a perfect match.
require(bikm1) set.seed(42) v=floor(runif(4)*3) vprime=floor(runif(4)*3) error=NCE_simple(v,vprime) error
require(bikm1) set.seed(42) v=floor(runif(4)*3) vprime=floor(runif(4)*3) error=NCE_simple(v,vprime) error
BIKM1_LBM_Binary
objectProduce respectively one plot of two-dimensional segmentation of a BIKM1_LBM_Binary
fit, a plot of evolution of the chosen criterion as a function of the number of row and column clusters, and a boxplot of conditional posteriors for each row and column cluster.
## S4 method for signature 'BIKM1_LBM_Binary' plot(x, y, ...)
## S4 method for signature 'BIKM1_LBM_Binary' plot(x, y, ...)
x |
an object of class |
y |
binary matrix of observations. |
... |
in the plot method, additional parameters (ignored) |
One plot (initial and estimated partitions) and three ggplot2 objects (conditional posterior in each cluster for each matrix and the graph of chosen criterion values.
require(bikm1) g=5 h=3 theta=list() theta$pi_g=t(1/g*rep(1,g)) theta$rho_h=t(1/h*rep(1,h)) eps=0.1 theta$alpha_gh=matrix(c(1-eps,eps,eps,eps,1-eps,eps,eps,1-eps,1-eps, 1-eps,1-eps,eps,eps,eps,eps),ncol=h,byrow=TRUE) n=250 J=150 data=BinBlocRnd_LBM(n,J,theta) BinBlocVisu_LBM(data$x, data$xrow,data$xcol) res=BIKM1_LBM_Binary(data$x,8,5,4,init_choice='smallVBayes') BinBlocVisu_LBM(data$x,res@model_max$z,res@model_max$v) e=CARI(data$xrow,data$xcol,res@model_max$z,res@model_max$v) plot(res,data)
require(bikm1) g=5 h=3 theta=list() theta$pi_g=t(1/g*rep(1,g)) theta$rho_h=t(1/h*rep(1,h)) eps=0.1 theta$alpha_gh=matrix(c(1-eps,eps,eps,eps,1-eps,eps,eps,1-eps,1-eps, 1-eps,1-eps,eps,eps,eps,eps),ncol=h,byrow=TRUE) n=250 J=150 data=BinBlocRnd_LBM(n,J,theta) BinBlocVisu_LBM(data$x, data$xrow,data$xcol) res=BIKM1_LBM_Binary(data$x,8,5,4,init_choice='smallVBayes') BinBlocVisu_LBM(data$x,res@model_max$z,res@model_max$v) e=CARI(data$xrow,data$xcol,res@model_max$z,res@model_max$v) plot(res,data)
BIKM1_LBM_Poisson
objectProduce respectively one plot of two-dimensional segmentation of a BIKM1_LBM_Poisson
fit, an evolution of the criterion as a function of the numbers of rows and columns, and a boxplot of conditional posteriors for each row and column cluster.
## S4 method for signature 'BIKM1_LBM_Poisson' plot(x, y, ...)
## S4 method for signature 'BIKM1_LBM_Poisson' plot(x, y, ...)
x |
an object of class |
y |
a list specifying
|
... |
in the plot method, additional parameters (ignored) |
Two plots (initial matrix and block estimation) and two ggplot2 objects (conditional posterior in each cluster and the graph of chosen criterion values).
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,3,4,init_choice='random') plot(res,data)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,3,4,init_choice='random') plot(res,data)
BIKM1_MLBM_Binary
objectProduce respectively a plot of two-dimensional segmentation of a BIKM1_MLBM_Binary
fit, and a boxplot of conditional posteriors for each row and column cluster.
## S4 method for signature 'BIKM1_MLBM_Binary' plot(x, y, ...)
## S4 method for signature 'BIKM1_MLBM_Binary' plot(x, y, ...)
x |
an object of class |
y |
a list specifying :
|
... |
in the plot method, additional parameters (ignored) |
Two plot and on ggplot2 object.
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) plot(res,data)
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) plot(res,data)
Produce a value of the BIC criterion for co-clustering partitions
PoissonBlocBIC(a,alpha,beta,v1,w1,x,res,normalization)
PoissonBlocBIC(a,alpha,beta,v1,w1,x,res,normalization)
a |
hyperparameter used in the VBayes algorithm for priors on the mixing proportions. By default, a=4. |
alpha |
hyperparameter used in the VBayes algorithm for prior on the Poisson parameter. By default, alpha=1. |
beta |
hyperparameter used in the VBayes algorithm for prior on the Poisson parameter. By default, beta=0.01. |
v1 |
a numeric vector of row partitions |
w1 |
a numeric vector of column partitions |
x |
contingency matrix of observations. |
res |
a BIKM1_LBM_Poisson object
|
normalization |
logical. To use the normalized Poisson modelling in the Latent Block Model. By default normalization=FALSE. |
a value of the BIC criterion
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h*matrix(1,h,1) theta$tau_l=1/l*matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,3,4,init_choice='smallVBayes') bic=PoissonBlocBIC(v1=res@model_max$v,w1=res@model_max$w,x=data$x,res=res,normalization=TRUE)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h*matrix(1,h,1) theta$tau_l=1/l*matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,3,4,init_choice='smallVBayes') bic=PoissonBlocBIC(v1=res@model_max$v,w1=res@model_max$w,x=data$x,res=res,normalization=TRUE)
Produce a value of the ICL criterion for co-clustering partitions
PoissonBlocICL(a,alpha,beta,x,v1,w1,normalization)
PoissonBlocICL(a,alpha,beta,x,v1,w1,normalization)
a |
hyperparameter used in the VBayes algorithm for priors on the mixing proportions. By default, a=4. |
alpha |
hyperparameter used in the VBayes algorithm for prior on the Poisson parameter. By default, alpha=1. |
beta |
hyperparameter used in the VBayes algorithm for prior on the Poisson parameter. By default, beta=0.01. |
x |
contingency matrix of observations. |
v1 |
a numeric vector specifying the class of rows. |
w1 |
a numeric vector specifying the class of columns. |
normalization |
logical. To use the normalized Poisson modelling in the Latent Block Model. By default normalization=FALSE. |
a value of the ICL criterion
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=(1/h)*matrix(1,h,1) theta$tau_l=(1/l)*matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') icl=PoissonBlocICL(4,1,0.01,data$x,res@model_max$v,res@model_max$w, normalization=FALSE)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=(1/h)*matrix(1,h,1) theta$tau_l=(1/l)*matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='smallVBayes') icl=PoissonBlocICL(4,1,0.01,data$x,res@model_max$v,res@model_max$w, normalization=FALSE)
Produce a simulated data matrix generated under the Poisson Latent Block Model.
PoissonBlocRnd(J,K,theta)
PoissonBlocRnd(J,K,theta)
J |
a positive integer specifying the number of expected rows. |
K |
a positive integer specifying the number of expected columns. |
theta |
a list specifying the model parameters:
|
a list including the arguments:
x
: simulated contingency data matrix.
xrow
: numeric vector specifying row partition.
xcol
: numeric vector specifying column partition.
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta)
Produce a plot object representing the co-clustered data-sets.
PoissonBlocVisu(x,v,w)
PoissonBlocVisu(x,v,w)
x |
contingency matrix of observations. |
v |
a numeric vector specifying the class of rows. |
w |
a numeric vector specifying the class of columns. |
a plot object
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) PoissonBlocVisu(data$x,data$xrow,data$xcol)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) PoissonBlocVisu(data$x,data$xrow,data$xcol)
Produce a plot object representing the resumed co-clustered data-sets.
PoissonBlocVisuResum(x,v,w)
PoissonBlocVisuResum(x,v,w)
x |
contingency matrix of observations. |
v |
a numeric vector specifying the class of rows. |
w |
a numeric vector specifying the class of columns. |
a plot object.
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) PoissonBlocVisuResum(data$x,data$xrow,data$xcol)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) PoissonBlocVisuResum(data$x,data$xrow,data$xcol)
Print method for a BIKM1_LBM_Binary
object
## S4 method for signature 'BIKM1_LBM_Binary' print(x, ...)
## S4 method for signature 'BIKM1_LBM_Binary' print(x, ...)
x |
in the print method, a BIKM1_LBM_Binary object |
... |
in the print method, additional parameters (ignored) |
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,2,4,init_choice='random') print(res)
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,2,4,init_choice='random') print(res)
Print method for a BIKM1_LBM_Poisson
object
## S4 method for signature 'BIKM1_LBM_Poisson' print(x, ...)
## S4 method for signature 'BIKM1_LBM_Poisson' print(x, ...)
x |
in the print method, a BIKM1_LBM_Poisson object |
... |
in the print method, additional parameters (ignored) |
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,2,4,init_choice='random') print(res)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,3,2,4,init_choice='random') print(res)
Print method for a BIKM1_MLBM_Binary
object
## S4 method for signature 'BIKM1_MLBM_Binary' print(x, ...)
## S4 method for signature 'BIKM1_MLBM_Binary' print(x, ...)
x |
in the print method, a BIKM1_MLBM_Binary object |
... |
in the print method, additional parameters (ignored) |
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) print(res)
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) print(res)
show method for a BIKM1_LBM_Binary
object
## S4 method for signature 'BIKM1_LBM_Binary' show(object)
## S4 method for signature 'BIKM1_LBM_Binary' show(object)
object |
a BIKM1_LBM_Binary object |
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,4,4,4,init_choice='random') show(res)
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,4,4,4,init_choice='random') show(res)
show method for a BIKM1_LBM_Poisson
object
## S4 method for signature 'BIKM1_LBM_Poisson' show(object)
## S4 method for signature 'BIKM1_LBM_Poisson' show(object)
object |
a BIKM1_LBM_Poisson object |
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') show(res)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') show(res)
show method for a BIKM1_MLBM_Binary
object
## S4 method for signature 'BIKM1_MLBM_Binary' show(object)
## S4 method for signature 'BIKM1_MLBM_Binary' show(object)
object |
a BIKM1_MLBM_Binary object |
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) show(res)
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) show(res)
Produce a summary of informations of a BIKM1_LBM_Binary
object
## S4 method for signature 'BIKM1_LBM_Binary' summary(object, ...)
## S4 method for signature 'BIKM1_LBM_Binary' summary(object, ...)
object |
in the summary method, a BIKM1_LBM_Binary object |
... |
in the summary method, additional parameters (ignored) |
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,2,4,init_choice='random') summary(res)
require(bikm1) n=200 J=120 g=3 h=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$alpha_gh=matrix(runif(6),ncol=h) data=BinBlocRnd_LBM(n,J,theta) res=BIKM1_LBM_Binary(data$x,3,2,4,init_choice='random') summary(res)
Produce a summary of informations of a BIKM1_LBM_Poisson
object
## S4 method for signature 'BIKM1_LBM_Poisson' summary(object, ...)
## S4 method for signature 'BIKM1_LBM_Poisson' summary(object, ...)
object |
in the summary method, a BIKM1_LBM_Poisson object |
... |
in the summary method, additional parameters (ignored) |
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') summary(res)
require(bikm1) J=200 K=120 h=3 l=2 theta=list() theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$gamma_hl=matrix(c(1, 6,4, 1, 7, 1),ncol=2) data=PoissonBlocRnd(J,K,theta) res=BIKM1_LBM_Poisson(data$x,4,4,4,init_choice='random') summary(res)
Produce a summary of informations of a BIKM1_MLBM_Binary
object
## S4 method for signature 'BIKM1_MLBM_Binary' summary(object, ...)
## S4 method for signature 'BIKM1_MLBM_Binary' summary(object, ...)
object |
in the summary method, a BIKM1_MLBM_Binary object |
... |
in the summary method, additional parameters (ignored) |
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) summary(res)
require(bikm1) n=200 J=120 K=120 g=3 h=2 l=2 theta=list() theta$pi_g=1/g *matrix(1,g,1) theta$rho_h=1/h *matrix(1,h,1) theta$tau_l=1/l *matrix(1,l,1) theta$alpha_gh=matrix(runif(6),ncol=h) theta$beta_gl=matrix(runif(6),ncol=l) data=BinBlocRnd_MLBM(n,J,K,theta) res=BIKM1_MLBM_Binary(data$x,data$y,3,3,3,4) summary(res)