-
Notifications
You must be signed in to change notification settings - Fork 7
two sets of shape hyperparameters for the Beta hyperprior in the SBM #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c8af72d
727f8cd
bf3ec25
8182afd
a462165
dc4de41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,8 +207,14 @@ | |
| #' | ||
| #' @param beta_bernoulli_alpha,beta_bernoulli_beta Double. Shape parameters | ||
| #' for the beta distribution in the Beta–Bernoulli and the Stochastic-Block | ||
| #' priors. Must be positive. Defaults: \code{beta_bernoulli_alpha = 1} and | ||
| #' \code{beta_bernoulli_beta = 1}. | ||
| #' priors. Must be positive. For the Stochastic-Block prior these are the shape | ||
| #' parameters for the within-cluster edge inclusion probabilities. | ||
| #' Defaults: \code{beta_bernoulli_alpha = 1} and \code{beta_bernoulli_beta = 1}. | ||
| #' | ||
| #' @param beta_bernoulli_alpha_between,beta_bernoulli_beta_between Double. | ||
| #' Shape parameters for the between-cluster edge inclusion probabilities in the | ||
| #' Stochastic-Block prior. Must be positive. | ||
| #' Default: \code{beta_bernoulli_alpha_between = 1} and \code{beta_bernoulli_beta_between = 1} | ||
| #' | ||
| #' @param dirichlet_alpha Double. Concentration parameter of the Dirichlet | ||
| #' prior on block assignments (used with the Stochastic Block model). | ||
|
|
@@ -359,6 +365,8 @@ bgm = function( | |
| inclusion_probability = 0.5, | ||
| beta_bernoulli_alpha = 1, | ||
| beta_bernoulli_beta = 1, | ||
| beta_bernoulli_alpha_between = 1, | ||
| beta_bernoulli_beta_between = 1, | ||
| dirichlet_alpha = 1, | ||
| lambda = 1, | ||
| na_action = c("listwise", "impute"), | ||
|
|
@@ -418,7 +426,7 @@ bgm = function( | |
| } else if(update_method == "hamiltonian-mc") { | ||
| target_accept = 0.65 | ||
| } else if(update_method == "nuts") { | ||
| target_accept = 0.80 | ||
| target_accept = 0.60 | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -444,9 +452,21 @@ bgm = function( | |
| inclusion_probability = inclusion_probability, | ||
| beta_bernoulli_alpha = beta_bernoulli_alpha, | ||
| beta_bernoulli_beta = beta_bernoulli_beta, | ||
| beta_bernoulli_alpha_between = beta_bernoulli_alpha_between, | ||
| beta_bernoulli_beta_between = beta_bernoulli_beta_between, | ||
| dirichlet_alpha = dirichlet_alpha, | ||
| lambda = lambda) | ||
|
|
||
| # check hyperparameters input | ||
| # If user left them NULL, pass -1 to C++ (means: ignore between prior) | ||
| if (is.null(beta_bernoulli_alpha_between) && is.null(beta_bernoulli_beta_between)) { | ||
| beta_bernoulli_alpha_between <- -1.0 | ||
| beta_bernoulli_beta_between <- -1.0 | ||
| } else if (is.null(beta_bernoulli_alpha_between) || is.null(beta_bernoulli_beta_between)) { | ||
| stop("If you wish to specify different between and within cluster probabilites, | ||
| provide both beta_bernoulli_alpha_between and beta_bernoulli_beta_between, | ||
| otherwise leave both NULL.") | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I read this correctly, this will stop the analysis if the between parameters are left at their defaults. This means users cannot use bgms, except when they set other values for these defaults, irrespective if they use an SBM prior or not.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is in case the user specifies only one of the between parameters, but not both. Otherwise running the code below did work. But it doesn't matter now, since as you requested, both sets of hyperparameters are always provided. fit <- bgm(Wenchuan[c(1:100), c(1:5)], edge_prior = "Stochastic-Block", |
||
| # ---------------------------------------------------------------------------- | ||
| # The vector variable_type is now coded as boolean. | ||
| # Ordinal (variable_bool == TRUE) or Blume-Capel (variable_bool == FALSE) | ||
|
|
@@ -572,6 +592,8 @@ bgm = function( | |
| inclusion_probability = inclusion_probability, | ||
| beta_bernoulli_alpha = beta_bernoulli_alpha, | ||
| beta_bernoulli_beta = beta_bernoulli_beta, | ||
| beta_bernoulli_alpha_between = beta_bernoulli_alpha_between, | ||
| beta_bernoulli_beta_between = beta_bernoulli_beta_between, | ||
| dirichlet_alpha = dirichlet_alpha, lambda = lambda, | ||
| interaction_index_matrix = interaction_index_matrix, iter = iter, | ||
| warmup = warmup, counts_per_category = counts_per_category, | ||
|
|
@@ -603,6 +625,7 @@ bgm = function( | |
| na_action = na_action, na_impute = na_impute, | ||
| edge_selection = edge_selection, edge_prior = edge_prior, inclusion_probability = inclusion_probability, | ||
| beta_bernoulli_alpha = beta_bernoulli_alpha, beta_bernoulli_beta = beta_bernoulli_beta, | ||
| beta_bernoulli_alpha_between = beta_bernoulli_alpha_between, beta_bernoulli_beta_between = beta_bernoulli_beta_between, | ||
| dirichlet_alpha = dirichlet_alpha, lambda = lambda, | ||
| variable_type = variable_type, | ||
| update_method = update_method, | ||
|
|
@@ -634,6 +657,8 @@ bgm = function( | |
| edge_selection = edge_selection, edge_prior = edge_prior, inclusion_probability = inclusion_probability, | ||
| beta_bernoulli_alpha = beta_bernoulli_alpha, | ||
| beta_bernoulli_beta = beta_bernoulli_beta, | ||
| beta_bernoulli_alpha_between = beta_bernoulli_alpha_between, | ||
| beta_bernoulli_beta_between = beta_bernoulli_beta_between, | ||
| dirichlet_alpha = dirichlet_alpha, lambda = lambda, | ||
| variable_type = variable_type, | ||
| update_method = update_method, | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.