buildConstraintsMatrix: Constraints matrices

View source: R/codeSSSC.R

buildConstraintsMatrixR Documentation

Constraints matrices

Description

Compute the constraints matrix C, based on ML and CNL sets.

Usage

buildConstraintsMatrix(n, list.ML = list(), list.CNL = list())

Arguments

n

total number of observations.

list.ML

list of ML (must-link) constrained pairs.

list.CNL

list of CNL (cannot-link) constrained pairs.

Details

buildConstraintsMatrix generate constraints matrix, based on ML and CNL sets

Value

C constraints matrix (with 1 for must-link and -1 for cannot-link).

Examples

dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
           matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), 
           matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
           
ML <- list()
ML[[1]] <- c(sel="10",mem="20")
ML[[2]] <- c(sel="60",mem="70")

CNL <- list()
CNL[[1]] <- c(sel="30",mem="80")
CNL[[2]] <- c(sel="90",mem="120")

C <- buildConstraintsMatrix(n=nrow(dat), list.ML=ML, list.CNL=CNL)


RclusTool documentation built on Aug. 29, 2022, 9:07 a.m.