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

Create update function for smc_mallows_new_users() #331

Closed
osorensen opened this issue Oct 20, 2023 · 1 comment · Fixed by #347
Closed

Create update function for smc_mallows_new_users() #331

osorensen opened this issue Oct 20, 2023 · 1 comment · Fixed by #347

Comments

@osorensen
Copy link
Collaborator

I'm thinking of something like this.

First, the user runs smc_mallows_new_users() on the data they have on of these:

# one of these:
smc_init <- smc_mallows_new_users(...)
smc_init <- smc_mallows_new_item_rank(...)

If the S3 class of smc_init tells whether they are from the "new users" or "new item rank" case, then we can have a common update function smc_mallows_update. When they get new data, they do this:

smc_updated <- smc_mallows_update(smc_init, ...)
@osorensen
Copy link
Collaborator Author

For smc_mallows_new_users(), I think the initialize phase can be easily done in R, and then we're left with a loop over new users in the C++ code:

/* ====================================================== */
/* Initialise Phase */
/* ====================================================== */
int n_users = R_obs.n_rows; // total number of users
if(type == "complete"){
if (Time > n_users / num_new_obs) {
Rcpp::warning( \
"Time should not exceed n_users / num_new_obs. Recalculating."\
);
Time = n_users / num_new_obs;
}
}
/* generate rho samples using uniform prior ------------- */
cube rho_samples(N, n_items, Time + 1);
rho_samples.slice(0) = initialize_rho(n_items, N).t();
/* generate alpha samples using exponential prior ------- */
mat alpha_samples;
if(type != "partial_alpha_fixed") {
alpha_samples = zeros(N, Time + 1);
alpha_samples.col(0) = initialize_alpha(N);
}
/* generate vector to store ESS */
rowvec ESS_vec(Time);
// this is to store the augmentations of the observed rankings for each particle
cube aug_rankings; // no. users by items by particles
if(type == "partial" || type == "partial_alpha_fixed"){
aug_rankings = zeros(n_users, n_items, N);
}

osorensen added a commit that referenced this issue Oct 23, 2023
@osorensen osorensen linked a pull request Jan 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant