-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add more asserts to task operator #1474
Conversation
|
c132415
to
9e54d19
Compare
rebased on master for travis fix from @jakob-r |
Why is everything in |
uuh. mistake. fixing |
please donte merge, this is harder than expected |
ok, new try @larskotthoff
read carefully |
#' | ||
#' @template arg_task_or_desc | ||
#' @return [\code{\link{TaskDesc}}]. | ||
#' @return ret_taskdesc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be @template ret_taskdesc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx yes
R/getFeatureImportance.R
Outdated
makeS3Obj("FeatureImportance", | ||
res = imp, | ||
task.desc = getTaskDescription(object), | ||
task.desc = object$task.desc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the getter anymore here?
the reason that i cannot is basically the larger change i did here. before my PR getTaskDesc had an undefined API. which class was i allowed to pass in? now in that piece of code "object" is a WrappedModel. I can do that. Was simply a bit lazy and needed to catch the night bus |
If our policy is still to add getters for everything rather than doing it manually, then yes, you should add the getter :) |
R/Task_operators.R
Outdated
#' @export | ||
getTaskDescription.TaskDesc = function(x) { | ||
x | ||
checkTask(x, allow.desc = TRUE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are dodging S3 here? Should be getTaskDescription.Task()
and getTaskDescription.TaskDescription()
.
R/Task_operators.R
Outdated
|
||
#' @export | ||
getTaskClassLevels.TaskDescClassif = function(x) { | ||
checkTask(x, allow.desc = TRUE, task.type = c("classif", "multilabel")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getTaskClassLevels.ClassifTask()
+ getTaskClassLevels.MultilabelTask()
?
R/Task_operators.R
Outdated
#' Target column name is not included. | ||
#' | ||
#' @template arg_task | ||
#' @return [\code{character}]. | ||
#' @family task | ||
#' @export | ||
getTaskFeatureNames = function(task) { | ||
assertClass(task, "Task") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getTaskFeatureNames.SupervisedTask()
?
R/Task_operators.R
Outdated
@@ -252,6 +253,8 @@ getTaskTargets.CostSensTask = function(task, recode.target = "no") { | |||
#' head(getTaskData(task, subset = 1:100, recode.target = "01")) | |||
getTaskData = function(task, subset, features, target.extra = FALSE, recode.target = "no") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be getTaskData.Task()
R/Task_operators.R
Outdated
@@ -380,6 +386,7 @@ recodeSurvivalTimes = function(y, from, to) { | |||
#' @family task | |||
#' @export | |||
getTaskCosts = function(task, subset) { | |||
assertClass(task, "Task") | |||
if (task$task.desc$type != "costsens") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getTaskCosts.CostSensTask()
tried to merge master, many conflicts ... :( |
shit. where are we now? in what state? shall i roll something back? i want to have this in now, otherwise all work is lost... |
i should really not have followed @jakob-r request for renaming. this is the result now. we have to do this more carefully! |
Continued in other PR. |
* re-implemented #1474 * add default for getTaskDesc * missing NAMESPACE * fix for plotViperCharts * fix costsens bug * getTaskCosts only for Tasks
fixes #1467