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 default plot for regr.lm #46

Open
mllg opened this issue Aug 5, 2020 · 1 comment
Open

Add default plot for regr.lm #46

mllg opened this issue Aug 5, 2020 · 1 comment

Comments

@mllg
Copy link
Sponsor Member

mllg commented Aug 5, 2020

No description provided.

@missuse
Copy link

missuse commented Aug 7, 2020

In my opinion residual plots are suitable here.
ggfortify has a decent autoplot method for lm objects.

autoplot.LearnerRegrLM = function(object, ...) { # nolint
  if (is.null(object$model)) {
    stopf("Learner '%s' must be trained first", object$id)
    }
  if (is.null(object$model$model)) {
    stopf("Learner '%s' must be trained with `keep_model` set to `TRUE`", object$id)
    }
  require_namespaces("ggfortify")
  autoplot(object$model, ...)
}

usage:

task = tsk("mtcars")
learner = lrn("regr.lm")
learner$train(task)
autoplot(learner)

An example of the plot:
lm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants