Last active
August 2, 2016 10:02
-
-
Save kaz-yos/21c014c65cc7a04d4369e2d8d2afa868 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## オリジナル | |
result<-NULL | |
for(i in 1:20000){ | |
result<-c(result,roc(...)) | |
} | |
## 2000-vectorを最初に作成 | |
result <- as.numeric(rep(NA,2*10^4)) | |
for(i in 1:20000){ | |
result[i] <- roc(...) | |
} | |
## foreach初期化コードをさける | |
result <- foreach(i = seq_len(2*10^4)) %do% { | |
roc(...) | |
} | |
## foreachで並列化 | |
result <- foreach(i = seq_len(2*10^4)) %dopar% { | |
roc(...) | |
} | |
## bootを使用 | |
bootFun <- function(data, i) { | |
roc(data = data[i,], ...) | |
} | |
boot(data = , statistic = , R = , parallel = "multicore", ncpus = foreach::getDoParWorkers()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment