R/VI.lb.R

Defines functions VI.lb

Documented in VI.lb

## Computes the lower bound to the posterior expected Variation of Information

VI.lb=function(cls,psm){

	if(any(psm !=t(psm)) | any(psm >1) | any(psm < 0) | sum(diag(psm)) != nrow(psm) ){
	stop("psm must be a symmetric matrix with entries between 0 and 1 and 1's on the diagonals")}
    
	if(is.vector(cls)) cls <- t(cls)

	n=dim(psm)[1]

	VI.lb.compute=function(c){
		f=0
		for(i in 1:n){
			ind=(c==c[i])
			f=f+(log2(sum(ind))+log2(sum(psm[i,]))-2*log2(sum(ind*psm[i,])))/n
		}
		return(f)
	}
	output=apply(cls,1,VI.lb.compute)
	return(output)
}

Try the VICatMix package in your browser

Any scripts or data that you put into this service are public.

VICatMix documentation built on April 4, 2025, 5:43 a.m.