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

Visualization #14

Merged
merged 43 commits into from Aug 28, 2019
Merged

Visualization #14

merged 43 commits into from Aug 28, 2019

Conversation

be-marc
Copy link
Member

@be-marc be-marc commented Aug 12, 2019

#6

plot.ResamplingSpCVBlock, plot.ResamplingSpCVEnv, plot.ResamplingSpCVKmeans are the same. We could create a super class to just have one plotting function. plot.ResamplingSpCVBuffer is different because it is a leave-one-out cross-validation, which cannot be visualized in the same way.

  • Single fold plot

  • Single train-test plot

  • Multi train-test plot

  • Unify redundant code

  • Update documentation

  • add tests

Examples are in inst/mlr3spatiotemporal_test.R at the end of the file.

@codecov-io
Copy link

Codecov Report

Merging #14 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #14    +/-   ##
=====================================
  Coverage       0%    0%            
=====================================
  Files           4     8     +4     
  Lines          74   257   +183     
=====================================
- Misses         74   257   +183
Impacted Files Coverage Δ
R/ResamplingSpCVEnv.R 0% <0%> (ø)
R/VizFold.R 0% <0%> (ø)
R/zzz.R 0% <0%> (ø) ⬆️
R/Task_classif_ecuador.R 0% <0%> (ø) ⬆️
R/ResamplingSpCVBlock.R 0% <0%> (ø)
R/ResamplingSpCVBuffer.R 0% <0%> (ø)
R/TaskClassifST.R 0% <0%> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1532e9...2a209a6. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Aug 12, 2019

Codecov Report

Merging #14 into master will increase coverage by 77.37%.
The diff coverage is 94.59%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #14       +/-   ##
===========================================
+ Coverage       0%   77.37%   +77.37%     
===========================================
  Files           7        9        +2     
  Lines         222      274       +52     
===========================================
+ Hits            0      212      +212     
+ Misses        222       62      -160
Impacted Files Coverage Δ
R/zzz.R 0% <ø> (ø) ⬆️
R/ResamplingSpCVCoords.R 82.75% <ø> (+82.75%) ⬆️
R/helper.R 0% <0%> (ø)
R/ResamplingSpCVEnv.R 80.43% <100%> (+80.43%) ⬆️
R/autoplot.R 100% <100%> (ø)
R/ResamplingSpCVBlock.R 82% <100%> (+82%) ⬆️
R/ResamplingSpCVBuffer.R 77.77% <100%> (+77.77%) ⬆️
R/TaskClassifST.R 38.7% <50%> (+38.7%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12999f9...0c4523a. Read the comment docs.

@be-marc
Copy link
Member Author

be-marc commented Aug 15, 2019

We have two different notes in the R CMD check.

autoplot.ResamplingSpCVBlock: no visible binding for global variable ‘fold’

These notes are related to ggplot2 and data.table functions used in S3 classes. The solution for ggplot2 is to use aes_string instead of aes. Do we also have a solution for data.table functions? There are various solutions but all seem a little bit hacky.

Unexported object imported by a ':::' call: ‘mlr3:::translate_types’

We need the translate_types function in TaskClassifST.R. The function is located in helper.R in the mlr3 package. If we use :::, we get a note.

@pat-s
Copy link
Member

pat-s commented Aug 15, 2019

  1. I remember using "Add a call to globalVariables(c("x.values", "y.values")) somewhere in the top-level of your package." in the past but yeah, it is not nice.

    @mllg Whats your convention here?

  2. @mllg Can we export mlr3:::translate_types()? Otherwise you (@be-marc) can copy it into this package and use it internally.

@pat-s
Copy link
Member

pat-s commented Aug 20, 2019

The "undefined global variables" issue is a general problem with data.tables syntax and can be solved by Rdatatable/data.table#850 (comment).

@pat-s
Copy link
Member

pat-s commented Aug 20, 2019

I've added some improvements:

  • Legend symbols are now points instead of squares
  • The user can set grid = FALSE to only get the list of ggplot2 objects returned and do the grid-alignment manually
  • Added a Label indicating the fold id of each subplot if multiple folds are plotted
  • improved documentation

These changes have only been applied to autoplot.ResamplingSpCVBlock() so far.

Maybe we can reduce the whitespace between the subplots.
The axis labelling is automatic and is ok if the plot is stretched to a normal size.
For publication ready plot one would use grid = FALSE anyways.

image

@pat-s
Copy link
Member

pat-s commented Aug 21, 2019

@be-marc

  • I unified the underlying plotting code into an internal function called autoplot_spatial()
  • autoplot.SpCVBuffer() now works in the same way as the others due to some small magic
  • Merged all documentation into a single .Rd file

Example of autoplot.SpCVBuffer()

image

@pat-s
Copy link
Member

pat-s commented Aug 28, 2019

Thanks again Marc!

@pat-s pat-s merged commit dc39578 into master Aug 28, 2019
@pat-s pat-s deleted the visualization branch August 28, 2019 13:28
pat-s added a commit that referenced this pull request Jun 17, 2022
pat-s added a commit that referenced this pull request Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants