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

{mlr3spatiotempcv} plotting functions for CAST::CreatespacetimeFolds() #13

Closed
pat-s opened this issue Apr 1, 2021 · 0 comments
Closed

Comments

@pat-s
Copy link
Contributor

pat-s commented Apr 1, 2021

Hi @HannaMeyer

here are some examples of how you/users could use the autoplot() generics in {mlr3spatiotempcv} to visualize partitions created via {CAST}.

For spacetime, one can choose whether to show the ommited observations or not (show_omitted = TRUE/FALSE)

All Cstf functions also have a 2D plotting generic but when the dataset is spatiotemporal, this options is limited due to overplotting in a 2D space.

Available from {mlr3spatiotempcv} >= 0.2.1.9003 (important bugfix for spacevar + timevar plotting in 0.3.0.9005).

library(mlr3)
library(mlr3spatiotempcv)

data <- cookfarm_sample

# tweak Date variable for plotting
data$Date <- rep(c(
  "2020-01-01", "2020-02-01", "2020-03-01", "2020-04-01",
  "2020-05-01"
), times = 1, each = 100)
b <- mlr3::as_data_backend(data)
b$hash <- "_mlr3_tasks_cookfarm_"
task <- TaskRegrST$new(
  id = "cookfarm", b, target = "PHIHOX",
  extra_args = list(
    coordinate_names = c("x", "y"), coords_as_features = FALSE,
    crs = 26911
  )
)

# time out --------------------------------------------------------------------
rsp <- rsmp("sptcv_cstf", folds = 5, time_var = "Date")
set.seed(42)
rsp$instantiate(task)

# without omitted, we have no values on the y-axis and the plot is not shown
autoplot(rsp, task, fold_id = 5, show_omitted = TRUE, plot3D = TRUE)


# space out -------------------------------------------------------------------

rsp <- rsmp("sptcv_cstf", folds = 5, space_var = "SOURCEID")
set.seed(42)
rsp$instantiate(task)

# without omitted, we have no values on the y-axis and the plot is not shown
autoplot(rsp, task, fold_id = 5, show_omitted = TRUE, plot3D = TRUE)

# spacetime out --------------------------------------------------------------------

rsp <- rsmp("sptcv_cstf", folds = 5, time_var = "Date", space_var = "SOURCEID")
set.seed(42)
rsp$instantiate(task)

# without omitted, we have no values on the y-axis and the plot is not shown
autoplot(rsp, task, fold_id = 5, show_omitted = TRUE, plot3D = TRUE)

Created on 2021-04-01 by the reprex package (v1.0.0)

Time only

time-only

Space only

space-only

Spacetime

image

HannaMeyer pushed a commit that referenced this issue Feb 7, 2024
* implement quantitative density layer

* document parameter k

* comments

* just spaces to be in sync with qmd scripts

* change QD to LPD

* update validation and maxLPD derivation

* update plot and print (#2)

* add exploreAOA function (#3)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* Dev (#4)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* Dev (#6)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* Dev (#12)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* Change `maxLPD` parameter handling & enable `trainLPD` calculation with only training data provided (no model) (#7)

* add to maxLPD percantages

* update maxLPD parameter validation

* enable trainLPD calc with only trainDat (no model)

* minor change in maxLPD setting

* Add `LPDtoErrormetric` functionality (#8)

* add LPDtoErrormetric and adjust plot functions

* small change

* minor changes on docs and comments

* major docs update

* update DItoErrormetric and LPDtoErrormetric

* New calculation methods for LPD of training data and LPD of prediction data, add DI_LPDtoErrormetric  (#9)

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* Feat train di new (#11)

* Dev (#6)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* fix error in LPDtoErrormetric

* Dev (#13)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* Change `maxLPD` parameter handling & enable `trainLPD` calculation with only training data provided (no model) (#7)

* add to maxLPD percantages

* update maxLPD parameter validation

* enable trainLPD calc with only trainDat (no model)

* minor change in maxLPD setting

* Add `LPDtoErrormetric` functionality (#8)

* add LPDtoErrormetric and adjust plot functions

* small change

* minor changes on docs and comments

* major docs update

* update DItoErrormetric and LPDtoErrormetric

* New calculation methods for LPD of training data and LPD of prediction data, add DI_LPDtoErrormetric  (#9)

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* Feat train di new (#11)

* Dev (#6)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* fix error in LPDtoErrormetric

* masking order

* adapt default degrees of freedom

* add exp and scam exp errormodels

* update docs

* update docs

* Dev (#14)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* Change `maxLPD` parameter handling & enable `trainLPD` calculation with only training data provided (no model) (#7)

* add to maxLPD percantages

* update maxLPD parameter validation

* enable trainLPD calc with only trainDat (no model)

* minor change in maxLPD setting

* Add `LPDtoErrormetric` functionality (#8)

* add LPDtoErrormetric and adjust plot functions

* small change

* minor changes on docs and comments

* major docs update

* update DItoErrormetric and LPDtoErrormetric

* New calculation methods for LPD of training data and LPD of prediction data, add DI_LPDtoErrormetric  (#9)

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* Feat train di new (#11)

* Dev (#6)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* fix error in LPDtoErrormetric

* masking order

* adapt default degrees of freedom

* add exp and scam exp errormodels

* update docs

* update docs

* Dev (#15)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* Change `maxLPD` parameter handling & enable `trainLPD` calculation with only training data provided (no model) (#7)

* add to maxLPD percantages

* update maxLPD parameter validation

* enable trainLPD calc with only trainDat (no model)

* minor change in maxLPD setting

* Add `LPDtoErrormetric` functionality (#8)

* add LPDtoErrormetric and adjust plot functions

* small change

* minor changes on docs and comments

* major docs update

* update DItoErrormetric and LPDtoErrormetric

* New calculation methods for LPD of training data and LPD of prediction data, add DI_LPDtoErrormetric  (#9)

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* Feat train di new (#11)

* Dev (#6)

* update plot and print

* add exploreAOA to package

* add message for trainLPD calculation

* update explore AOA docs

* shift package to description

* update exploreAOA docs

* update exploreAOA docs and add xmark

* update aoa, trainDI and exploreAOA docs

* update aoa docs

* change order of print.aoa

* update aoa.Rd

* update DESCRIPTION

* update aoa & trainDI

* add trainDat upload options

* raster to terra and new layout (#5)

* update plot function

* update exploreAOA

* update exploreAOA

* fix error

* fix error

* fix crs bounding box issue

* rm commented code

* update plot.aoa & exploreAOA

* fix error in trainLPD calculation

* fix MD calculation

* fix order in print.aoa & message in aoa()

* add predictors tif to CAST package

* add countryboundaries

* add elevation

* update trainLPD implementation in trainDI

* add DI_LPDtoErrormetric

* update docs

* update `toErrormetric` functions

* update `...toErrormetric` functions

* update CAST docs

* change legend position in exploreAOA

* update aoa and .knndist - enhance performance of LPD calculation

* update trainDI - add progress bars and messages

* update DI_LPDtoErrormetric & LPDtoErrormetric to enable multiCV

* fix error in LPDtoErrormetric

* masking order

* adapt default degrees of freedom

* add exp and scam exp errormodels

* update docs

* update docs
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

No branches or pull requests

2 participants