forked from mlr-org/mlr3learners
-
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
10 changed files
with
189 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
^tic\.R$ | ||
^appveyor\.yml$ | ||
.ignore | ||
.editorconfig | ||
.gitignore | ||
^\.travis\.yml$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^man-roxygen$ | ||
^attic$ |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# See http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
trim_trailing_whitespace = true | ||
|
||
[*.{r,R,md,Rmd}] | ||
indent_size = 2 | ||
|
||
[*.{c,h}] | ||
indent_size = 4 | ||
|
||
[*.{cpp,hpp}] | ||
indent_size = 4 | ||
|
||
[{NEWS.md,DESCRIPTION,LICENSE}] | ||
max_line_length = 80 |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# History files | ||
.Rhistory | ||
.Rapp.history | ||
|
||
# Session Data files | ||
.RData | ||
# Example code in package build process | ||
*-Ex.R | ||
# Output files from R CMD build | ||
/*.tar.gz | ||
# Output files from R CMD check | ||
/*.Rcheck/ | ||
# RStudio files | ||
.Rproj.user/ | ||
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 | ||
.httr-oauth | ||
# knitr and R markdown default cache directories | ||
/*_cache/ | ||
/cache/ | ||
# Temporary files created by R markdown | ||
*.utf8.md | ||
*.knit.md | ||
inst/doc | ||
|
||
.DS_Store | ||
.Rproj.user |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
man/ | ||
docs/ | ||
inst/doc/ | ||
attic/ | ||
vignettes/*.html |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Package: mlr3learners | ||
Title: Recommended learners for mlr3 | ||
Version: 0.1.0-9000 | ||
Authors@R: | ||
person(given = "Michel", | ||
family = "Lang", | ||
role = c("cre", "aut"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0001-9754-0393")) | ||
Description: Recommended Learners for mlr3. Extends mlr3 with interfaces to the | ||
most popular machine learning packages on CRAN. | ||
License: MIT + file LICENSE | ||
Depends: | ||
R (>= 3.1.0) | ||
Imports: | ||
backports, | ||
mlr3, | ||
paradox, | ||
R6 | ||
Suggests: | ||
ranger, | ||
testthat | ||
VignetteBuilder: | ||
knitr | ||
ByteCompile: true | ||
Encoding: UTF-8 | ||
NeedsCompilation: no | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 6.1.0 | ||
URL: https://github.com/mlr-org/mlr3learners | ||
BugReports: https://github.com/mlr-org/mlr3learners/issues |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
import(paradox) | ||
importFrom(R6,R6Class) | ||
importFrom(mlr3,LearnerClassif) | ||
importFrom(mlr3,mlr_learners) |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
LearnerClassifRanger = R6Class("LearnerClassifRanger", inherit = LearnerClassif, | ||
public = list( | ||
initialize = function(id = "classif.ranger") { | ||
super$initialize( | ||
id = id, | ||
packages = "ranger", | ||
feature_types = c("logical", "integer", "numeric", "character", "factor", "ordered"), | ||
predict_types = c("response", "prob"), | ||
par_set = ParamSet$new( | ||
params = list( | ||
ParamInt$new(id = "num.trees", default = 500L, lower = 1L), | ||
ParamReal$new(id = "mtry", lower = 1) | ||
) | ||
), | ||
properties = c("twoclass", "multiclass") | ||
) | ||
}, | ||
|
||
train = function(task, ...) { | ||
ranger::ranger(task$formula, task$data(), probability = (self$predict_type == "prob"), ...) | ||
}, | ||
|
||
predict = function(model, task, ...) { | ||
newdata = task$data(cols = task$feature_names) | ||
preds = predict(model, data = newdata, predict.type = "response") | ||
|
||
if (self$predict_type == "response") { | ||
prob = NULL | ||
response = preds$predictions | ||
} else { | ||
prob = preds$predictions | ||
response = colnames(prob)[apply(prob, 1, which.max)] | ||
} | ||
|
||
PredictionClassif$new(task, response, prob) | ||
} | ||
) | ||
) |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#' @import paradox | ||
#' @importFrom R6 R6Class | ||
#' @importFrom mlr3 mlr_learners LearnerClassif | ||
"_PACKAGE" | ||
|
||
.onLoad = function(libname, pkgname) { | ||
mlr_learners$add("classif.ranger", LearnerClassifRanger) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageRoxygenize: rd,collate,namespace |