Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

berndbischl
Copy link
Sponsor Member

@berndbischl berndbischl commented Feb 2, 2017

fixes #1467

@berndbischl
Copy link
Sponsor Member Author

berndbischl commented Feb 2, 2017

  • please make commit msg better when you squash, srewed this up

  • this is a base change read CAREFULLY

@berndbischl
Copy link
Sponsor Member Author

rebased on master for travis fix from @jakob-r

@larskotthoff
Copy link
Sponsor Member

Why is everything in checkTaskOrDesc commented out?

@berndbischl
Copy link
Sponsor Member Author

Why is everything in checkTaskOrDesc commented out?

uuh. mistake. fixing

@berndbischl
Copy link
Sponsor Member Author

please donte merge, this is harder than expected

@berndbischl
Copy link
Sponsor Member Author

ok, new try @larskotthoff

  • i had to touch way too much, but opted to make the structure better.
  • i changed NEWS already

read carefully

#'
#' @template arg_task_or_desc
#' @return [\code{\link{TaskDesc}}].
#' @return ret_taskdesc
Copy link
Sponsor Member

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?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx yes

makeS3Obj("FeatureImportance",
res = imp,
task.desc = getTaskDescription(object),
task.desc = object$task.desc,
Copy link
Sponsor Member

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?

@berndbischl
Copy link
Sponsor Member Author

task.desc = getTaskDescription(object)
vs
task.desc = object$task.desc

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?
(docs were wrong and arg checks did not exist)
it was also against our policy to have s3 methods that "wildly dispatch across many different classes"
getters are supposed to be called getClassSlot.

now in that piece of code "object" is a WrappedModel.
If you want me to complete the PR in a better way I would need to add the getter
getWModelTaskDescription

I can do that. Was simply a bit lazy and needed to catch the night bus

@larskotthoff
Copy link
Sponsor Member

If our policy is still to add getters for everything rather than doing it manually, then yes, you should add the getter :)

#' @export
getTaskDescription.TaskDesc = function(x) {
x
checkTask(x, allow.desc = TRUE)
Copy link
Sponsor Member

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().


#' @export
getTaskClassLevels.TaskDescClassif = function(x) {
checkTask(x, allow.desc = TRUE, task.type = c("classif", "multilabel"))
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTaskClassLevels.ClassifTask() + getTaskClassLevels.MultilabelTask()?

#' Target column name is not included.
#'
#' @template arg_task
#' @return [\code{character}].
#' @family task
#' @export
getTaskFeatureNames = function(task) {
assertClass(task, "Task")
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTaskFeatureNames.SupervisedTask()?

@@ -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") {
Copy link
Sponsor Member

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()

@@ -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")
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTaskCosts.CostSensTask()

@mllg mllg self-assigned this Mar 8, 2017
@mllg
Copy link
Sponsor Member

mllg commented Mar 19, 2017

tried to merge master, many conflicts ... :(

@berndbischl
Copy link
Sponsor Member Author

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...

@berndbischl
Copy link
Sponsor Member Author

i should really not have followed @jakob-r request for renaming. this is the result now. we have to do this more carefully!

mllg added a commit that referenced this pull request Mar 19, 2017
@mllg
Copy link
Sponsor Member

mllg commented Mar 19, 2017

Continued in other PR.

@mllg mllg closed this Mar 19, 2017
@mllg mllg mentioned this pull request Mar 19, 2017
larskotthoff pushed a commit that referenced this pull request Mar 28, 2017
* re-implemented #1474

* add default for getTaskDesc

* missing NAMESPACE

* fix for plotViperCharts

* fix costsens bug

* getTaskCosts only for Tasks
@mllg mllg deleted the add_asserts_to_task_operators branch April 18, 2017 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getTaskFormula should check if x is actually a task object
4 participants