Skip to content

Commit

Permalink
a day of chasing the RNG bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bcjaeger committed Oct 3, 2023
1 parent 4b602a4 commit 0696ee1
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 139 deletions.
9 changes: 6 additions & 3 deletions R/orsf.R
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,13 @@ orsf <- function(data,
y_sort <- y[sorted, , drop = FALSE]
w_sort <- weights[sorted]

if(length(tree_seeds) == 1) set.seed(tree_seeds)
if(length(tree_seeds) == 1 && n_tree > 1){
set.seed(tree_seeds)
tree_seeds <- sample(x = n_tree*10, size = n_tree, replace = FALSE)
} else if(is.null(tree_seeds)){
tree_seeds <- sample(x = n_tree*10, size = n_tree, replace = FALSE)
}

if(is.null(tree_seeds) || length(tree_seeds) == 1)
tree_seeds <- sample(x = n_tree*2, size = n_tree, replace = FALSE)

vi_max_pvalue = 0.01
tree_type_R = 3
Expand Down
12 changes: 6 additions & 6 deletions man/orsf_control_custom.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions man/orsf_ice_oob.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions man/orsf_pd_oob.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 43 additions & 45 deletions man/orsf_vi.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions man/predict.orsf_fit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions scratch.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ library(survival)
tictoc::tic()
fit <- orsf(pbc_orsf,
formula = time+status ~ . - id,
oobag_pred_type = 'none',
sample_with_replacement = FALSE,
sample_fraction = 2/3)
n_tree = 2)
tictoc::toc()

all(fit$data == pbc_orsf)
Expand Down
3 changes: 1 addition & 2 deletions src/Forest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ void Forest::compute_oobag_vi() {
progress = 0;

if(n_thread == 1){
vec* vi_numer_ptr = &vi_numer;
compute_oobag_vi_single_thread(vi_numer_ptr);
compute_oobag_vi_single_thread(&vi_numer);
return;
}

Expand Down
1 change: 0 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CXX_STD = CXX17
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
CXXFLAGS += -O3 -march=native -DNDEBUG
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
1 change: 0 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CXX_STD = CXX17
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
CXXFLAGS += -O3 -march=native -DNDEBUG
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
Loading

0 comments on commit 0696ee1

Please sign in to comment.