Skip to content

Commit

Permalink
update R6 docs checks; reduce pip output
Browse files Browse the repository at this point in the history
  • Loading branch information
nhejazi committed Mar 5, 2020
1 parent fd2d36c commit 7d7d4a6
Show file tree
Hide file tree
Showing 72 changed files with 101 additions and 6,976 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ r:
before_install:
- sudo apt-get -y install libx11-dev mesa-common-dev libglu1-mesa-dev
- sudo apt-get -y install python3 python3-pip python3-setuptools
- sudo -H pip3 install --upgrade pip setuptools
- sudo -H pip3 install --ignore-installed numpy tensorflow keras
- sudo -H pip3 install --quiet --progress-bar off --upgrade pip setuptools
- sudo -H pip3 install --quiet --progress-bar off --ignore-installed numpy tensorflow keras
#- Rscript -e 'update.packages(ask = FALSE)'

r_packages:
Expand Down
6 changes: 1 addition & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,9 @@ Suggests:
caret,
mgcv
Remotes:
github::osofr/simcausal,
github::osofr/condensier,
github::tlverse/delayed,
github::tlverse/origami,
github::tlverse/hal9001,
github::nhejazi/haldensify,
github::vdorie/dbarts,
github::tpospisi/RFCDE/r
License: GPL-3
URL: https://tlverse.org/sl3
Expand All @@ -104,4 +100,4 @@ VignetteBuilder:
knitr,
R.rsp
RoxygenNote: 7.0.2
Roxygen: list(markdown = TRUE)
Roxygen: list(markdown = TRUE, old_usage = TRUE, r6 = FALSE)
6 changes: 3 additions & 3 deletions R/Lrnr_bilstm.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ Lrnr_bilstm <- R6Class(

# Build the model
model <- kerasR::Sequential()
#keras::bidirectional(
# keras::bidirectional(
# object = model, layer = kerasR::LSTM(args$units,
# return_sequences = TRUE
# ),
# input_shape = c(num_steps, num_features)
#)
model$add(kerasR::Bidirectional(kerasR::LSTM(args$units,return_sequences = TRUE)))
# )
model$add(kerasR::Bidirectional(kerasR::LSTM(args$units, return_sequences = TRUE)))
model$add(kerasR::Dropout(rate = args$dropout))
model$add(kerasR::Flatten())
model$add(kerasR::Dense(args$dense))
Expand Down
2 changes: 1 addition & 1 deletion R/Lrnr_lstm.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Lrnr_lstm <- R6Class(
epochs = args$epochs
)
fit_object <- model

return(fit_object)
},

Expand Down
6 changes: 3 additions & 3 deletions R/Lrnr_sl.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ Lrnr_sl <- R6Class(
return(private$.fit_object$cv_meta_fit$fit_object)
},
cv_risk = function(loss_fun) {

# get risks for cv learners (nested cv)
cv_stack_fit <- self$fit_object$cv_fit
stack_risks <- cv_stack_fit$cv_risk(loss_fun)

coefs <- self$coefficients
if (!is.null(coefs)) {
ordered_coefs <- coefs[match(stack_risks$learner, names(coefs))]
Expand All @@ -96,7 +96,7 @@ Lrnr_sl <- R6Class(
ordered_coefs <- rep(NA, length(stack_risks$learner))
}
set(stack_risks, , "coefficients", ordered_coefs)

# Make sure that coefficients is the second column, even if the metalearner
# did not provide coefficients.
data.table::setcolorder(stack_risks, c(names(stack_risks)[1], "coefficients"))
Expand Down
34 changes: 19 additions & 15 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ knitr::opts_chunk$set(
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3558317.svg)](https://doi.org/10.5281/zenodo.3558317)

> A modern implementation of the Super Learner algorithm for ensemble learning
> and model stacking
> A modern implementation of the Super Learner ensemble learning algorithm
__Authors:__ [Jeremy Coyle](https://github.com/jeremyrcoyle), [Nima
Hejazi](https://nimahejazi.org), [Ivana
Expand Down Expand Up @@ -138,9 +137,9 @@ head(preds)

## Learner Properties

You can find the properties that sl3 learners support in the table below:
Properties supported by `sl3` learners are presented in the following table:

```{r warning=FALSE, echo = FALSE, message = FALSE}
```{r sl3-learner-properties, warning=FALSE, echo = FALSE, message = FALSE}
library(sl3)
library(kableExtra)
Expand All @@ -164,25 +163,30 @@ get_learner_class_properties <- function(learner_class) {
}
learner_property_lst <- lapply(all_learners, get_learner_class_properties)
# get a list where each element is a list of True/False's indicating whether a learner has a property or not
# get a list where each element is a list of logicals indicating whether a
# learner has a property or not
get_learner_class_properties_ownership <- function(properties) {
return(sl3_list_properties() %in% unlist(properties))
}
learner_property_ownership_mat <- lapply(learner_property_lst, get_learner_class_properties_ownership)
learner_property_ownership <- lapply(learner_property_lst,
get_learner_class_properties_ownership)
get_learner_name <- function(learner_class) {
return(learner_class$classname)
}
learner_names <- lapply(all_learners, get_learner_name)
# generate the data matrix, whose columns are properties and rows are learner names
final_mat <- matrix(unlist(learner_property_ownership_mat), nrow = length(learner_property_ownership_mat), ncol = length(sl3_list_properties()), byrow = TRUE)
# generate matrix whose columns are properties and rows are learner names
final_mat <- matrix(unlist(learner_property_ownership),
nrow = length(learner_property_ownership),
ncol = length(sl3_list_properties()), byrow = TRUE)
dimnames(final_mat) <- list(unlist(learner_names), sl3_list_properties())
final_mat.df <- as.data.frame(final_mat)
char_final_mat.df <- ifelse(final_mat.df == TRUE, "√", "x")
kable(char_final_mat.df) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed",
"responsive")) %>%
scroll_box(width = "100%", height = "200px", fixed_thead = T)
```

Expand All @@ -201,23 +205,23 @@ submitting a pull request.

After using the `sl3` R package, please cite the following:

@manual{coyle2019sl3,
@manual{coyle2020sl3,
author = {Coyle, Jeremy R and Hejazi, Nima S and Malenica, Ivana and
Sofrygin, Oleg},
title = {{sl3}: Modern Pipelines for Machine Learning and {Super
Learning}},
year = {2019},
year = {2020},
howpublished = {\url{https://github.com/tlverse/sl3}},
note = {{R} package version 1.3.5},
url = {https://doi.org/10.5281/zenodo.3558317},
doi = {10.5281/zenodo.3558317}
note = {{R} package version 1.3.7},
url = {},
doi = {}
}

---

## License

&copy; 2017-2019 [Jeremy R. Coyle](https://github.com/jeremyrcoyle), [Nima S.
&copy; 2017-2020 [Jeremy R. Coyle](https://github.com/jeremyrcoyle), [Nima S.
Hejazi](https://nimahejazi.org), [Ivana
Malenica](https://github.com/podTockom), [Oleg
Sofrygin](https://github.com/osofr)
Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ bibentry(bibtype = "Manual",
person("Oleg", "Sofrygin")),
year = year,
note = note,
doi = "10.5281/zenodo.3558317",
doi = "",
url = "https://github.com/tlverse/sl3")
118 changes: 6 additions & 112 deletions man/Custom_chain.Rd

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

Loading

0 comments on commit 7d7d4a6

Please sign in to comment.