evaluateMatrices: evaluate if the algorithm converged by comparing two...

Description Usage Arguments Examples

View source: R/geo-c-mean.R

Description

evaluate if the algorithm converged by comparing two successive belongings matrices. Calculate the absolute difference between the matrices and then calculate the mean of each row. If all the values of the final vector are below the fixed tolerance, then return True, else return False

Usage

1
evaluateMatrices(mat1, mat2, tol)

Arguments

mat1

A n X k matrix giving for each observation n, its probability to belong to the cluster k at iteration i

mat2

A n X k matrix giving for each observation n, its probability to belong to the cluster k at iteration i+1

tol

a float representing the algorithm tolerance

Examples

1
2
3
mat1 <- rbind(c(0.45,0.55),c(0.35,0.65),c(0.8,0.2),c(0.5,0.5),c(0.9,0.1),c(0.7,0.3))
mat2 <- rbind(c(0.45,0.55),c(0.4,0.60),c(0.8,0.2),c(0.45,0.55),c(0.95,0.05),c(0.7,0.3))
evaluateMatrices(mat1,mat2,0.01)

jejeplusfaim/geoCmeans documentation built on Dec. 23, 2019, 7:31 p.m.