-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Keming <[email protected]>
- Loading branch information
Showing
11 changed files
with
67 additions
and
178 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
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,5 +1,6 @@ | ||
# syntax=v1 | ||
|
||
|
||
def build(): | ||
base(dev=True) | ||
install.julia() | ||
|
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# syntax=v1 | ||
|
||
|
||
def build(): | ||
base(dev=True) | ||
install.apt_packages(name=["build-essential"]) | ||
install.r_lang() | ||
install.r_packages(name=["mlr3", "mlr3learners"]) | ||
runtime.command(commands={"rlang-iris": "Rscript iris.r 2> /dev/null"}) |
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,36 @@ | ||
# Example from https://github.com/mlr-org/mlr3gallery | ||
# MIT License Copyright (c) 2019 mlr-org | ||
|
||
library(mlr3learners) | ||
|
||
# creates mlr3 task from scratch, from a data.frame | ||
# 'target' names the column in the dataset we want to learn to predict | ||
task = as_task_classif(iris, target = "Species") | ||
# in this case we could also take the iris example from mlr3's dictionary of shipped example tasks | ||
# 2 equivalent calls to create a task. The second is just sugar for the user. | ||
task = mlr_tasks$get("iris") | ||
task = tsk("iris") | ||
# print(task) | ||
# create learner from dictionary of mlr3learners | ||
# 2 equivalent calls: | ||
learner_1 = mlr_learners$get("classif.rpart") | ||
learner_1 = lrn("classif.rpart") | ||
# print(learner_1) | ||
|
||
# train learner on subset of task | ||
learner_1$train(task, row_ids = 1:120) | ||
# this is what the decision tree looks like | ||
# print(learner_1$model) | ||
# predict using observations from task | ||
prediction = learner_1$predict(task, row_ids = 121:150) | ||
# predict using "new" observations from an external data.frame | ||
prediction = learner_1$predict_newdata(newdata = iris[121:150, ]) | ||
# print(prediction) | ||
|
||
# head(as.data.table(mlr_measures)) | ||
scores = prediction$score(msr("classif.acc")) | ||
print(scores) | ||
scores = prediction$score(msrs(c("classif.acc", "classif.ce"))) | ||
print(scores) | ||
cm = prediction$confusion | ||
print(cm) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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