From 754b04fcdbe7b734a6eb20af6edfb6879fb26276 Mon Sep 17 00:00:00 2001 From: naeemkh Date: Wed, 16 Mar 2022 09:27:10 -0400 Subject: [PATCH] Remove commented code. --- R/create_matching.R | 58 +++------------------------------------------ 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/R/create_matching.R b/R/create_matching.R index 570eeff4..a5e216a0 100755 --- a/R/create_matching.R +++ b/R/create_matching.R @@ -60,42 +60,7 @@ create_matching <- function(dataset, bin_seq = NULL, gps_model = "parametric", logger::log_debug("Started generating matched set ...") st_t_m <- proc.time() - lfp <- get_options("logger_file_path") - - # p5_c_t_s <- proc.time() - # cl <- parallel::makeCluster(nthread, type="PSOCK", - # outfile= lfp) - - # seed_val <- .Random.seed - # parallel::clusterSetRNGStream(cl = cl, iseed = seed_val) - - # parallel::clusterEvalQ(cl, {library("CausalGPS")}) - # p_c_t_e <- proc.time() - - # logger::log_debug("Wall clock time to create cluster with ", - # "{nthread} core(s): {p_c_t_e[[3]] - p_c_t_s[[3]]} s.") - # parallel::clusterExport(cl=cl, - # varlist = c("bin_num", "matching_fun", "dataset", - # "gps_mx", "w_mx", "delta_n", "scale", - # "nthread", "compute_closest_wgps", - # "compute_resid", "compute_density"), - # envir=environment()) - - # matched_set <- parallel::parLapply(cl, - # bin_num, - # matching_fun, - # dataset=dataset[[1]], - # e_gps_pred = dataset[[2]], - # e_gps_std_pred = dataset[[3]], - # w_resid=dataset[[4]], - # gps_mx = gps_mx, - # w_mx = w_mx, - # gps_model = gps_model, - # delta_n = delta_n, - # scale = scale, - # nthread = nthread, - # optimized_compile = optimized_compile) - # parallel::stopCluster(cl) + #lfp <- get_options("logger_file_path") matched_set <- lapply(bin_num, matching_fun, @@ -110,7 +75,6 @@ create_matching <- function(dataset, bin_seq = NULL, gps_model = "parametric", scale = scale, nthread = nthread, optimized_compile = optimized_compile) - #parallel::stopCluster(cl) e_t_m <- proc.time() logger::log_debug("Finished generating matched set (Wall clock time: ", @@ -124,29 +88,13 @@ create_matching <- function(dataset, bin_seq = NULL, gps_model = "parametric", s_comp_p <- proc.time() - # # old solution - # s_old <- proc.time() - # - # cp_original_data <- dataset[[1]] - # bind_matched_set = do.call(rbind,matched_set) - # freq_table = as.data.frame(table(bind_matched_set)) - # index_of_data <- as.numeric(as.character(freq_table[1][,1])) - # added_count <- as.numeric(as.character(freq_table[2][,1])) - # #index_of_data <- freq_table[1][,1] - # #added_count <- freq_table[2][,1] - # - # e_old <- proc.time() - # - # print(paste0("Finished old version (Wall clock time: ", - # (e_old - s_old)[[3]]," seconds).")) - - # New solution cp_original_data <- dataset[[1]] logger::log_debug("Started working on binding the matched set ... ") s_bindlist <- proc.time() bind_matched_set <- data.table::rbindlist(matched_set) e_bindlist <- proc.time() - logger::log_debug(paste0("Finished binding the matched set - rbindlist(Wall clock time: ", + logger::log_debug(paste0("Finished binding the matched set -", + "rbindlist(Wall clock time: ", (e_bindlist - s_bindlist)[[3]]," seconds).")) bind_matched_set$row_index <- as.integer(bind_matched_set$row_index)