forked from tlverse/sl3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
389 additions
and
169 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
Package: sl3 | ||
Title: Machine Learning Pipelines | ||
Version: 0.2 | ||
Date: 2017-08-01 | ||
Title: Pipelines for Machine Learning and Super Learning | ||
Version: 0.2.1.0 | ||
Authors@R: c( | ||
person("Jeremy", "Coyle", email = "[email protected]", | ||
role = c("aut", "cre", "cph")), | ||
person("Nima", "Hejazi", email = "[email protected]", role = "aut"), | ||
person("Oleg", "Sofrygin", email="[email protected]", role = "aut"), | ||
person("Ivana", "Malenica", email = "[email protected]", role = "aut") | ||
person("Jeremy", "Coyle", email = "[email protected]", | ||
role = c("aut", "cre", "cph")), | ||
person("Nima", "Hejazi", email = "[email protected]", role = "aut"), | ||
person("Oleg", "Sofrygin", email="[email protected]", role = "aut"), | ||
person("Ivana", "Malenica", email = "[email protected]", role = "aut") | ||
) | ||
Maintainer: Jeremy Coyle <[email protected]> | ||
Description: Implements the super learner prediction method and contains a | ||
library of prediction algorithms to be used in the super learner. | ||
License: GPL-3 | ||
URL: https://github.com/jeremyrcoyle/sl3 | ||
BugReports: https://github.com/jeremyrcoyle/sl3/issues | ||
Depends: | ||
R (>= 2.14.0) | ||
library of prediction algorithms to be used in the super learner. | ||
Depends: R (>= 2.14.0) | ||
Imports: | ||
data.table, | ||
assertthat, | ||
origami, | ||
future, | ||
R6, | ||
uuid, | ||
memoise, | ||
digest, | ||
BBmisc, | ||
delayed, | ||
methods, | ||
stats | ||
data.table, | ||
assertthat, | ||
origami, | ||
future, | ||
R6, | ||
uuid, | ||
memoise, | ||
digest, | ||
BBmisc, | ||
delayed, | ||
methods, | ||
stats | ||
Suggests: | ||
testthat, | ||
knitr, | ||
rmarkdown, | ||
glmnet, | ||
devtools, | ||
dplyr, | ||
rgl, | ||
Rsolnp, | ||
condensier, | ||
cvAUC, | ||
h2o, | ||
xgboost, | ||
forecast, | ||
nloptr, | ||
rugarch, | ||
nnls, | ||
SuperLearner, | ||
tsDyn, | ||
randomForest | ||
testthat, | ||
knitr, | ||
rmarkdown, | ||
glmnet, | ||
devtools, | ||
dplyr, | ||
rgl, | ||
Rsolnp, | ||
condensier, | ||
cvAUC, | ||
h2o, | ||
xgboost, | ||
forecast, | ||
nloptr, | ||
rugarch, | ||
nnls, | ||
SuperLearner, | ||
tsDyn, | ||
randomForest | ||
Remotes: | ||
github::osofr/condensier, | ||
github::jeremyrcoyle/delayed | ||
github::osofr/condensier, | ||
github::jeremyrcoyle/delayed | ||
License: GPL-3 | ||
URL: https://github.com/jeremyrcoyle/sl3 | ||
BugReports: https://github.com/jeremyrcoyle/sl3/issues | ||
Encoding: UTF-8 | ||
LazyData: yes | ||
LazyLoad: yes | ||
VignetteBuilder: knitr | ||
RoxygenNote: 6.0.1.9000 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,54 @@ | ||
|
||
#' GLM Fits | ||
#' | ||
#' This learner provides fitting procedures for generalized linear models by way | ||
#' of a wrapper relying on \code{stats::glm}. | ||
#' | ||
#' @docType class | ||
#' | ||
#' @keywords data | ||
#' | ||
#' @return \code{\link{Lrnr_base}} object with methods for training and | ||
#' prediction. | ||
#' | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @field family A \code{family} object from package \code{stats} describing the | ||
#' error family of the model to be fit. See the documentation for the package | ||
#' \code{stats} for details, or consult \code{stats::family} directly. | ||
#' @field ... Additional arguments. | ||
#' | ||
#' @importFrom R6 R6Class | ||
#' @importFrom stats glm predict family | ||
#' | ||
#' @export | ||
#' @rdname undocumented_learner | ||
Lrnr_glm <- R6Class(classname = "Lrnr_glm", inherit = Lrnr_base, portable = TRUE, | ||
class = TRUE, public = list( | ||
initialize = function(family = gaussian(), ...) { | ||
params <- list(family = family, ...) | ||
super$initialize(params = params, ...) | ||
}), | ||
private = list( | ||
.train = function(task) { | ||
params <- self$params | ||
family <- params[["family"]] | ||
if (is.character(family)) { | ||
family <- get(family, mode = "function", envir = parent.frame()) | ||
family <- family() | ||
} | ||
# todo: if possible have this use task$Xmat with glm.fit or speedglm | ||
Y <- task$Y | ||
fit_object <- glm(Y ~ ., data = task$X, family = family, weights = task$weights) | ||
return(fit_object) | ||
|
||
}, | ||
.predict = function(task = NULL) { | ||
predictions <- predict(private$.fit_object, newdata = task$X, type = "response") | ||
return(predictions) | ||
} | ||
), | ||
# | ||
Lrnr_glm <- R6Class(classname = "Lrnr_glm", inherit = Lrnr_base, | ||
portable = TRUE, class = TRUE, | ||
public = list( | ||
initialize = function(family = gaussian(), ...) { | ||
params <- list(family = family, ...) | ||
super$initialize(params = params, ...) | ||
} | ||
), | ||
private = list( | ||
.train = function(task) { | ||
params <- self$params | ||
family <- params[["family"]] | ||
if (is.character(family)) { | ||
family <- get(family, mode = "function", envir = parent.frame()) | ||
family <- stats::family() | ||
} | ||
# TODO: if possible have this use task$Xmat with glm.fit or speedglm | ||
Y <- task$Y | ||
fit_object <- stats::glm(Y ~ ., data = task$X, family = family, | ||
weights = task$weights) | ||
return(fit_object) | ||
}, | ||
.predict = function(task = NULL) { | ||
predictions <- stats::predict(private$.fit_object, newdata = task$X, | ||
type = "response") | ||
return(predictions) | ||
} | ||
), | ||
) | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains 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
Oops, something went wrong.