-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update based on some recent developments (#379)
* bookkeeping * removed unnecessary call * marking as const * adding more consts * additional safety measures * parallelization working (#355) * parallelization working * updating tests * styling * updating test * added info about parallelization * correcting an error in docs * update cran-comments * updating comments * updating news * deleting submission file * Adding support for sampling from prior (#360) * added prior sampling * updating news * deleting submission file * fixing the prior sampling * styling * added unit test for SMC starting from prior * added test for sample_prior * updating test after merging with TBB * styling * updating news * fixed error in update_mallows.SMCMallows * updated failing test and added namespace qualifier * added long-running SMC test from prior * Take care of item names properly (#363) * fixing item name issue * updating a unit test * styling * Can now deal with a single vector of input data (#364) * added handling of vector data #361 * styling * updating news * updated set_priors function * closes #370 * Added a gamma prior (#371) * updated set_priors function * closes #370 * Had forgot to implement the change... (#372) * updated set_priors function * closes #370 * fixed forgotten implementation * Added lag option (#373) * updated documentation * adding references section * more documentation updates * updated set_priors function * closes #370 * implemented user-defined lag * added lag, closes #369 * styling * ready for the change * Resampling issue 365 (#376) * updated set_priors function * closes #370 * ready for the change * implemented the resampler in cpp * added various resampling options. tests are missing * fixed numerical overflow problem and forgotten mcmc loop * added a simple test for the resampler * styling * added missing memory header * removed two tests where my M1 mac gives different results * removed git conflict marker * added a line shift * removing const-ref from built-in types * refactoring limits functions for pairwise augmentation * increasing test strictness * added some more work * moving distance code into implementation file * moved partition function code into cpp files * added code for reproducing Liu et al 2019 review * changed updating frequency for pkgdown. closes #380 * adding ignore to codecov * fixing #381 (#382) * Heatplot issue 381 (#383) * fixing #381 * added unit test for #381 * updated news
- Loading branch information
Showing
85 changed files
with
1,784 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' Sample from prior distribution | ||
#' | ||
#' Function to obtain samples from the prior distributions of the Bayesian | ||
#' Mallows model. Intended to be given to [update_mallows()]. | ||
#' | ||
#' @param n An integer specifying the number of samples to take. | ||
#' @param n_items An integer specifying the number of items to be ranked. | ||
#' @param priors An object of class "BayesMallowsPriors" returned from | ||
#' [set_priors()]. | ||
#' | ||
#' @return An object of class "BayesMallowsPriorSample", containing `n` | ||
#' independent samples of \eqn{\alpha} and \eqn{\rho}. | ||
#' | ||
#' @export | ||
#' | ||
#' @family modeling | ||
#' @example /inst/examples/sample_prior_example.R | ||
sample_prior <- function(n, n_items, priors = set_priors()) { | ||
validate_positive(n) | ||
validate_positive(n_items) | ||
ret <- list( | ||
alpha = stats::rgamma(n, shape = priors$gamma, rate = priors$lambda), | ||
rho = replicate(n, sample(n_items, n_items)), | ||
priors = priors, | ||
n_items = n_items, | ||
items = seq_len(n_items) | ||
) | ||
class(ret) <- "BayesMallowsPriorSamples" | ||
ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.