Skip to content

Commit

Permalink
Added TODOs and FIXMEs (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
wleoncio committed Sep 17, 2024
1 parent 320bc08 commit 59484e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/func_MCMC_graph_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ arma::mat construct_G_MRF(arma::mat G, arma::vec b, uint S, int p, bool MRF_2b)
}
} else {
// one value for b in MRF prior for all subgraphs
G_MRF = b[0] * G;
G_MRF = b[0] * G; // TODO: replace [] with () for bound check
}
return G_MRF;
}
Expand Down Expand Up @@ -58,7 +58,7 @@ Rcpp::List func_MCMC_graph_cpp(
Rcpp::List C = Rcpp::as<Rcpp::List>(ini["C.ini"]);

Rcpp::List gamma_ini_list = Rcpp::as<Rcpp::List>(ini["gamma.ini"]);
arma::vec gamma_ini = Rcpp::as<arma::vec>(gamma_ini_list[0]); // TODO: Test for S > 1, not sure the results are correct.
arma::vec gamma_ini = Rcpp::as<arma::vec>(gamma_ini_list[0]); // FIXME: use list_to_matrix() and change with S

if (MRF_2b) {
// two different values for b in MRF prior for subgraphs G_ss and G_rs
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-cpp_translation.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ hyperPooled = list(
)
hyperPooled_2S <- hyperPooled
hyperPooled_2S$G <- Matrix::bdiag(simData$G, simData$G)
hyperPooled_2S$b <- c(0.1, 0.2)

# Run a 'Pooled' Bayesian Cox model with graphical learning

Expand All @@ -39,7 +38,10 @@ BayesSurvive_wrap <- function(
MRF_G = TRUE, MRF_2b = FALSE, verbose = FALSE
) {
if (!MRF_G) {
if (!is.null(names(data))) data <- list(data)
if (!is.null(names(data))) {
data <- list(data)
# hyper$b <- c(0.1, 0.2) # TODO: uncomment for !MRF_2b cases
}
hyper$lambda <- 3 # TODO: mandatory for !MRG.G? Add validation!
hyper$nu0 <- 0.05
hyper$nu1 <- 5
Expand All @@ -59,7 +61,7 @@ fit_C_noMRFG <- BayesSurvive_wrap(data, initial, hyperPooled, MRF_G = FALSE, use
fit_R_2b <- BayesSurvive_wrap(data, initial, hyperPooled, MRF_2b = TRUE)
fit_C_2b <- BayesSurvive_wrap(data, initial, hyperPooled, MRF_2b = TRUE, use_cpp = TRUE)
fit_R_2b_no_G <- BayesSurvive_wrap(data_2S, initial, hyperPooled_2S, MRF_2b = TRUE, MRF_G = FALSE, n_iter = 2L)
# fit_C_2b_no_G <- BayesSurvive_wrap(data_2S, initial, hyperPooled_2S, MRF_2b = TRUE, MRF_G = FALSE, use_cpp = TRUE, n_iter = 2L) // FIXME: broken
# fit_C_2b_no_G <- BayesSurvive_wrap(data_2S, initial, hyperPooled_2S, MRF_2b = TRUE, MRF_G = FALSE, use_cpp = TRUE, n_iter = 2L) # FIXME: broken

# TODO: reorganize tests so that they come right after each fit_R/fit_C pair
test_that("R and C++ objects are similar", {
Expand Down

0 comments on commit 59484e3

Please sign in to comment.