Skip to content

Commit

Permalink
Add paratition generator to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
saghiles committed Aug 10, 2019
1 parent 56f1f3f commit b69c6ba
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,18 @@ NMI <- function(rowcluster, truelabels, n){
}
resnmi = Num / (sqrt(denum_k * denum_l))
resnmi
}
}

# Partition generator
par_gen<-
function(n,k, nb_par = 1){

par = as.integer(sample(as.numeric(1:k),n,replace = TRUE))
if(nb_par >1){
for(i in 2:nb_par){
par = rbind(par,as.integer(sample(as.numeric(1:k),n,replace = TRUE)))
}
par = as.matrix(par)
}
par
}

0 comments on commit b69c6ba

Please sign in to comment.