R/membercheck.R

Defines functions membercheck

membercheck <- function(member){
    member <- as.matrix(member)
    if(any(member < 0) || any(member > 1))
        stop("membership values (posterior probabilities)", " must be in [0,1]")
    if (!isTRUE(all.equal(as.vector(rowSums(member)), rep.int(1, nrow(member)))))
        stop("Membership values (posterior probabilities)", " must sum up to 1")
}

Try the klaR package in your browser

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

klaR documentation built on May 29, 2024, 5:20 a.m.