Giter VIP home page Giter VIP logo

waywiser's Introduction

rOpenSci

Project Status: Abandoned

This repository has been archived. The former README is now in README-NOT.md.

waywiser's People

Contributors

emilhvitfeldt avatar mikemahoney218 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

waywiser's Issues

ww_multi_scale.sf requires unquoted column names

waywiser::ww_multi_scale(
  waywiser::ny_trees,
  n_trees,
  agb,
  n = 10
)
#> # A tibble: 2 × 6
#>   .metric .estimator .estimate .grid_args       .grid          .notes          
#>   <chr>   <chr>          <dbl> <list>           <list>         <list>          
#> 1 rmse    standard      10105. <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>
#> 2 mae     standard       9154. <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>

waywiser::ww_multi_scale(
  waywiser::ny_trees,
  n_trees,
  "agb",
  n = 10
)
#> Warning: There were 55 warnings in `dplyr::summarise()`.
#> The first warning was:
#> ℹ In argument: `.estimate = rlang::exec(.env[["aggregation_function"]],
#>   "agb")`.
#> ℹ In group 1: `grid_cell_idx = 8`.
#> Caused by warning in `mean.default()`:
#> ! argument is not numeric or logical: returning NA
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 54 remaining warnings.
#> # A tibble: 2 × 6
#>   .metric .estimator .estimate .grid_args       .grid          .notes          
#>   <chr>   <chr>          <dbl> <list>           <list>         <list>          
#> 1 rmse    standard         NaN <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>
#> 2 mae     standard         NaN <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>

waywiser::ww_multi_scale(
  waywiser::ny_trees,
  "n_trees",
  agb,
  n = 10
)
#> Warning: There were 55 warnings in `dplyr::summarise()`.
#> The first warning was:
#> ℹ In argument: `.truth = rlang::exec(.env[["aggregation_function"]],
#>   "n_trees")`.
#> ℹ In group 1: `grid_cell_idx = 8`.
#> Caused by warning in `mean.default()`:
#> ! argument is not numeric or logical: returning NA
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 54 remaining warnings.
#> # A tibble: 2 × 6
#>   .metric .estimator .estimate .grid_args       .grid          .notes          
#>   <chr>   <chr>          <dbl> <list>           <list>         <list>          
#> 1 rmse    standard         NaN <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>
#> 2 mae     standard         NaN <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>

waywiser::ww_multi_scale(
  waywiser::ny_trees,
  "n_trees",
  "agb",
  n = 10
)
#> Warning: There were 110 warnings in `dplyr::summarise()`.
#> The first warning was:
#> ℹ In argument: `.truth = rlang::exec(.env[["aggregation_function"]],
#>   "n_trees")`.
#> ℹ In group 1: `grid_cell_idx = 8`.
#> Caused by warning in `mean.default()`:
#> ! argument is not numeric or logical: returning NA
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 109 remaining warnings.
#> # A tibble: 2 × 6
#>   .metric .estimator .estimate .grid_args       .grid          .notes          
#>   <chr>   <chr>          <dbl> <list>           <list>         <list>          
#> 1 rmse    standard         NaN <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>
#> 2 mae     standard         NaN <tibble [1 × 1]> <sf [100 × 5]> <tibble [0 × 2]>

Created on 2023-06-09 with reprex v2.0.2

This really should work either way

Release waywiser 0.4.2

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

Upkeep for waywiser

Pre-history

  • usethis::use_readme_rmd()
  • usethis::use_roxygen_md()
  • usethis::use_github_links()
  • usethis::use_pkgdown_github_pages()
  • usethis::use_tidy_github_labels()
  • usethis::use_tidy_style()
  • usethis::use_tidy_description()
  • urlchecker::url_check()

2020

  • usethis::use_package_doc()
    Consider letting usethis manage your @importFrom directives here.
    usethis::use_import_from() is handy for this.
  • usethis::use_testthat(3) and upgrade to 3e, testthat 3e vignette
  • Align the names of R/ files and test/ files for workflow happiness.
    The docs for usethis::use_r() include a helpful script.
    usethis::rename_files() may be be useful.

2021

  • usethis::use_tidy_dependencies()
  • usethis::use_tidy_github_actions() and update artisanal actions to use setup-r-dependencies
  • Remove check environments section from cran-comments.md
  • Bump required R version in DESCRIPTION to 3.5
  • Use lifecycle instead of artisanal deprecation messages, as described in Communicate lifecycle changes in your functions
  • Make sure RStudio appears in Authors@R of DESCRIPTION like so, if appropriate:
    person("RStudio", role = c("cph", "fnd"))

2022

2023

Necessary:

  • Update copyright holder in DESCRIPTION: person(given = "Posit Software, PBC", role = c("cph", "fnd"))
  • Run devtools::document() to re-generate package-level help topic with DESCRIPTION changes
  • Double check license file uses '[package] authors' as copyright holder. Run use_mit_license()
  • Update logo (https://github.com/rstudio/hex-stickers); run use_tidy_logo()
  • usethis::use_tidy_coc()
  • Modernize citation files; see updated use_citation()
  • usethis::use_tidy_github_actions()

Optional:

  • Review 2022 checklist to see if you completed the pkgdown updates
  • Prefer pak::pak("org/pkg") over devtools::install_github("org/pkg") in README
  • Consider running use_tidy_dependencies() and/or replace compat files with use_standalone()
  • use_standalone("r-lib/rlang", "types-check") instead of home grown argument checkers
  • Add alt-text to pictures, plots, etc; see https://posit.co/blog/knitr-fig-alt/ for examples

ww_multi_scale() should give friendlier errors when arguments are missing

waywiser::ww_multi_scale(waywiser::ny_trees, n = 2)
#> Error in `data[[truth_var]]` at waywiser/R/multi_scale.R:383:2:
#> ! Can't extract column with `truth_var`.
#> ✖ Subscript `truth_var` must be size 1, not 0.
#> Backtrace:
#>      ▆
#>   1. ├─waywiser::ww_multi_scale(waywiser::ny_trees, n = 2)
#>   2. └─waywiser:::ww_multi_scale.sf(waywiser::ny_trees, n = 2) at waywiser/R/multi_scale.R:158:4
#>   3.   ├─data[[truth_var]] at waywiser/R/multi_scale.R:383:2
#>   4.   └─tibble:::`[[.tbl_df`(data, truth_var) at waywiser/R/multi_scale.R:383:2
#>   5.     └─tibble:::tbl_subset2(x, j = i, j_arg = substitute(i))
#>   6.       └─tibble:::vectbl_as_col_location2(...)
#>   7.         ├─tibble:::subclass_col_index_errors(...)
#>   8.         │ └─base::withCallingHandlers(...)
#>   9.         └─vctrs::vec_as_location2(j, n, names, call = call)
#>  10.           └─vctrs:::result_get(...)
#>  11.             └─rlang::cnd_signal(x$err)
waywiser::ww_multi_scale(waywiser::ny_trees, agb, n = 2)
#> Error in `data[[estimate_var]]` at waywiser/R/multi_scale.R:387:2:
#> ! Can't extract column with `estimate_var`.
#> ✖ Subscript `estimate_var` must be size 1, not 0.
#> Backtrace:
#>      ▆
#>   1. ├─waywiser::ww_multi_scale(waywiser::ny_trees, agb, n = 2)
#>   2. └─waywiser:::ww_multi_scale.sf(waywiser::ny_trees, agb, n = 2) at waywiser/R/multi_scale.R:158:4
#>   3.   ├─data[[estimate_var]] at waywiser/R/multi_scale.R:387:2
#>   4.   └─tibble:::`[[.tbl_df`(data, estimate_var) at waywiser/R/multi_scale.R:387:2
#>   5.     └─tibble:::tbl_subset2(x, j = i, j_arg = substitute(i))
#>   6.       └─tibble:::vectbl_as_col_location2(...)
#>   7.         ├─tibble:::subclass_col_index_errors(...)
#>   8.         │ └─base::withCallingHandlers(...)
#>   9.         └─vctrs::vec_as_location2(j, n, names, call = call)
#>  10.           └─vctrs:::result_get(...)
#>  11.             └─rlang::cnd_signal(x$err)

Created on 2023-06-14 with reprex v2.0.2

Release waywiser 0.4.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Factor out tests

Right now, most test objects are stored within large test_that() calls, which makes updating individual test objects a pain. Since most of the tests in this package are generated automatically anyway, it would be fantastic to break each element out into its own test_that() call so they might be more easily updated.

Release waywiser 0.5.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

`ww_multi_scale()` should support multi-class AUC, PR AUC, etc

Because ww_multi_scale() only takes one estimate column, and passes ... to sf::st_make_grid(), there's currently no way to pass multiple columns of probability estimates to yardstick functions. This means we can't do multi-class class probability functions at the moment.

It would be nice for at least the sf method to support this. Not sure what the interface would look like, though, since dots are already in use. Maybe a probabilities argument that accepts a list?

ww_multi_scale returns an error for categorical rasters

Hi @mikemahoney218 -- I am trying to incorporate waywiser for examples in a paper about spatial patterns comparison. The ww_multi_scale() function works fine for continuous rasters (however, it gives some CRSs warnings), but errors for categorical ones. Is this expected?

library(terra)
library(waywiser)
library(landscapemetrics)
cell_sizes = seq(10, 100, 10) * 1000
l1 = rast(landscape)
l2 = l1
clc_multi_scale = ww_multi_scale(truth = l1, estimate = l2,
                                 metrics = list(yardstick::precision), 
                                 cellsize = cell_sizes)
#> Error in `metric_set()`:
#> ! Failed to compute `<clss_mtr>()`.
#> Caused by error:
#> ! Must select at least one item.
clc_multi_scale
#> Error in eval(expr, envir, enclos): object 'clc_multi_scale' not found

count columns for sf multi-scale are incorrect when column names are quoted

pts <- sf::st_sample(
  sf::st_as_sfc(
    sf::st_bbox(
      c(xmin = 1327326, ymin = 2175524, xmax = 1971106, ymax = 2651347),
      crs = 5072
    )
  ),
  500
)
  
pts <- sf::st_as_sf(pts)
pts$truth <- rnorm(500, 123, 35)
pts$estimate <- rnorm(500, 123, 39)

cellsizes <- units::set_units(seq(20, 100, 10), "km")

waywiser::ww_multi_scale(
  pts,
  truth,
  estimate,
  cellsize = cellsizes,
  square = FALSE,
  metrics = yardstick::rmse
)$.grid |> 
  lapply(\(x) unique(x$.truth_count))
#> [[1]]
#> [1] NA  1  2  3  4
#> 
#> [[2]]
#> [1] NA  1  2  3  4  5  7
#> 
#> [[3]]
#> [1] NA  1  2  3  4  5  6  7
#> 
#> [[4]]
#> [1] NA  2  1  4  3  6  5 10  7
#> 
#> [[5]]
#>  [1] NA  2  4  3  5  7  1  8  9  6 10
#> 
#> [[6]]
#>  [1] NA  1  2  5  3  8  7  6 10  4 12 13 11  9
#> 
#> [[7]]
#>  [1] NA  2  5  3  6 10 13  1  7  8 11  4 12  9 15
#> 
#> [[8]]
#>  [1] NA  1  2  7  4 12  9 15 13  5 10  6 14 11 16  8 18 17
#> 
#> [[9]]
#>  [1] NA  1  2  8  5 15 11  7 16 20  9 10 13 18 12 19  4 24 14 17

waywiser::ww_multi_scale(
  pts,
  "truth",
  "estimate",
  cellsize = cellsizes,
  square = FALSE,
  metrics = yardstick::rmse
)$.grid |> 
  lapply(\(x) unique(x$.truth_count))
#> [[1]]
#> [1] NA  1
#> 
#> [[2]]
#> [1] NA  1
#> 
#> [[3]]
#> [1] NA  1
#> 
#> [[4]]
#> [1] NA  1
#> 
#> [[5]]
#> [1] NA  1
#> 
#> [[6]]
#> [1] NA  1
#> 
#> [[7]]
#> [1] NA  1
#> 
#> [[8]]
#> [1] NA  1
#> 
#> [[9]]
#> [1] NA  1

Created on 2023-10-15 with reprex v2.0.2

Release waywiser 0.5.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push
  • Draft blog post
  • Slack link to draft blog in #open-source-comms

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • Add preemptive link to blog post in pkgdown news menu
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)
  • Finish blog post
  • Tweet

Release waywiser 0.3.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push
  • Draft blog post
  • Slack link to draft blog in #open-source-comms

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Consider adding `.by` to `ww_multi_scale()`

dplyr functions (including summarise() and mutate(), among others) now have an argument, .by, which allows for per-operation grouping, removing the need for group_by() in simple pipelines. It'd be nice for ww_multi_scale() to support the same (for the sf method; raster methods don't support grouping, and probably never will), such that these calls were equivalent:

ww_multi_scale(
      dplyr::group_by(ames_sf, Neighborhood),
      Sale_Price,
      predictions,
      n = list(
        c(10, 10),
        c(1, 1)
      ),
      square = FALSE
    )
ww_multi_scale(
      ames_sf,
      Sale_Price,
      predictions,
      n = list(
        c(10, 10),
        c(1, 1)
      ),
      square = FALSE,
    .by = Neighborhood
    )

For what it's worth, note that dplyr errors when trying to mix group_by() and .by:

> dplyr::group_by(iris, Species) |> dplyr::summarise(m = mean(Sepal.Length), .by = Species)
Error in `dplyr::summarise()`:
! Can't supply `.by` when `.data` is a grouped data frame.
Run `rlang::last_trace()` to see where the error occurred.

Release waywiser 0.4.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push

Release waywiser 0.6.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push
  • Draft blog post
  • Slack link to draft blog in #open-source-comms
  • cffr::cff_write()
  • codemetar::write_codemeta()
  • styler::style_pkg()
  • Rscript inst/generate_srr.R

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • Finish & publish blog post
  • Add link to blog post in pkgdown news menu
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)
  • Tweet

Release waywiser 0.2.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push
  • Draft blog post
  • Slack link to draft blog in #open-source-comms

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Release waywiser 0.5.2

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::cloud_check()
  • Update cran-comments.md
  • git push
  • cffr::cff_write()
  • codemetar::write_codemeta()
  • styler::style_pkg()
  • Rscript inst/generate_srr.R

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

Rewrite README

This package is now much bigger than it was last version, which is great, but the docs don't match. Should update the docs.

Release waywiser 0.1.0

First release:

Prepare for release:

  • git pull
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.