Skip to content

Commit ee1027f

Browse files
committed
poor reproducibility
1 parent 5f1ea1a commit ee1027f

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

R/utils.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ vimp <- function(object, ...) {
3030
#' @param forest An Rforce object
3131
#' @return A matrix containing variable importance statistics for each variable in each tree of the forest,
3232
#' row correspond to trees and columns correspond to variables.
33-
3433
vimp.Rforce <- function(forest) {
3534
if (!inherits(forest, "Rforce")) {
3635
stop("forest must be an Rforce object.")

TODO

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,20 @@ fit <- Rforce(
3030
mtry = 2,
3131
n_splits = 5
3232
)
33+
34+
35+
Rforce train -d ./raw/Intervals_designMatrixY_wide.csv \
36+
-a ./raw/Intervals_auxiliaryFeature_wide.csv \
37+
-u ./raw/units_of_cpiu.csv \
38+
-o ./rst \
39+
-m 8 \
40+
-n 10 \
41+
-g 0.01 \
42+
-t 5 \
43+
-s 6 \
44+
-k 99 \
45+
-r 100 \
46+
-e 926 \
47+
--pseudorisk2 \
48+
--phi2 \
49+
--threads 10

vignettes/get-started.Rmd

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ break_points <- stats::quantile(
8181
)
8282
break_points[1] <- 0.0 # ensure starting at 0
8383
break_points[n_intervals + 1] <- max(observed_times, na.rm = TRUE) * 1.001 # ensure ending at max time
84-
units_of_cpius <- diff(break_points)
84+
intervals <- diff(break_points)
8585
cpiu_wide <- patients_to_cpius(
8686
data_to_convert = df,
87-
units_of_cpiu = units_of_cpiu
87+
units_of_cpiu = intervals
8888
)
8989
names(cpiu_wide)
9090
class(cpiu_wide)
@@ -128,7 +128,14 @@ cpiu_wide <- cpius_to_dummy(cpiu_wide, cols_to_keep = NULL)
128128
```{r}
129129
fit <- Rforce(
130130
cpius = cpiu_wide,
131-
split_rule = "Rforce-QLR"
131+
split_rule = "Rforce-QLR",
132+
n_trees = 1
133+
)
134+
135+
fitt <- Rforce(
136+
cpius = cpiu_wide,
137+
split_rule = "Rforce-QLR",
138+
n_trees = 1
132139
)
133140
```
134141

@@ -138,12 +145,26 @@ fit <- Rforce(
138145
* `Rforce` is also a bigger wrapper function for `Step 1 - 3`
139146

140147
```{r}
141-
fit <- Rforce(
148+
fit1 <- Rforce(
149+
data = df,
150+
formula = Surv(Id, X, Status) ~ .,
151+
n_intervals = 10,
152+
split_rule = "Rforce-QLR",
153+
n_trees = 200
154+
)
155+
156+
fit2 <- Rforce(
142157
data = df,
143158
formula = Surv(Id, X, Status) ~ .,
144159
n_intervals = 10,
145-
split_rule = "Rforce-QLR"
160+
split_rule = "Rforce-QLR",
161+
n_trees = 200
146162
)
163+
all.equal(fit1, fit2)
164+
saveRforce(fit1, "output/fit1/")
165+
saveRforce(fit2, "output/fit2/")
166+
167+
fit1 <- loadRforce("/home/yu89975/r-dev/Rforce/output/fit1/")
147168
```
148169

149170
## Reference

0 commit comments

Comments
 (0)