Skip to content
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

SMC Mallows fails with a single particle #413

Open
osorensen opened this issue Mar 25, 2024 · 0 comments
Open

SMC Mallows fails with a single particle #413

osorensen opened this issue Mar 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@osorensen
Copy link
Collaborator

Maybe not a big deal, but it should be fixed or an informative error message should be given.

library(BayesMallows)
set.seed(1)
# UPDATING A MALLOWS MODEL WITH NEW COMPLETE RANKINGS
# Assume we first only observe the first four rankings in the potato_visual
# dataset
data_first_batch <- potato_visual[1:4, ]

# We start by fitting a model using Metropolis-Hastings
mod_init <- compute_mallows(
  data = setup_rank_data(data_first_batch),
  compute_options = set_compute_options(nmc = 10000))

# Convergence seems good after no more than 2000 iterations
assess_convergence(mod_init)

burnin(mod_init) <- 2000

# Next, assume we receive four more observations
data_second_batch <- potato_visual[5:8, ]

# We can now update the model using sequential Monte Carlo
mod_second <- update_mallows(
  model = mod_init,
  new_data = setup_rank_data(rankings = data_second_batch),
  smc_options = set_smc_options(n_particles = 1, resampler = "systematic")
)
#> Error in eval(expr, envir, enclos): Not a matrix.

Created on 2024-03-25 with reprex v2.1.0

@osorensen osorensen added the enhancement New feature or request label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant