R/sibp_rank_runs.R

Defines functions sibp_rank_runs

Documented in sibp_rank_runs

sibp_rank_runs<-function(sibp.search, X, num.words = 10){
  # Calculate the exclusivity metric for each parameter configuration
  total_runs <- length(sibp.search$alphas) * length(sibp.search$sigmasq.ns) * sibp.search$iters
  df <- data.frame("alpha" = rep(0,total_runs), 
                   "sigmasq.n" = rep(0,total_runs), 
                   "iter" = rep(0, total_runs), 
                   "exclu" = rep(0, total_runs))
  ctr <- 1
  for (alpha in sibp.search$alphas){
    for (sigmasq.n in sibp.search$sigmasq.ns){
      for (i in 1:sibp.search$iters){
        df$iter[ctr] <- i
        df$alpha[ctr] <- alpha
        df$sigmasq.n[ctr] <- sigmasq.n
        df$exclu[ctr] <- sibp_exclusivity(sibp.search[[as.character(alpha)]][[as.character(sigmasq.n)]][[i]], 
                                        X, num.words)
        ctr <- ctr + 1
      }
    }
  }
  exculsivity_rank <- df[order(df$exclu, decreasing = TRUE),] 
  return(exculsivity_rank)
}

Try the texteffect package in your browser

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

texteffect documentation built on May 2, 2019, 12:05 p.m.