
Draw a validation sample from a pool of events
Source:R/05_validation_sample.R
pam_validation_sample.RdPure function (no file access). Strategies:
"stratified": up ton_per_cellevents per species x confidence band; restrict to some species withspecies."random":nevents drawn at random from the whole pool (or fromspecies)."rare": species with at mostrare_max_eventsevents in the pool; up torare_nevents of each.
Arguments
- pool
Events from
pam_validation_pool().- strategy
One of "stratified", "random", "rare".
- bands
Increasing confidence band edges.
- n_per_cell, n, rare_max_events, rare_n
See above.
- species
Optional names (scientific, common or "Scientific_Common").
- seed
Random seed.
- exclude_ids
event_ids already sampled; never drawn again.
Examples
ex <- pam_example_project()
# the later stages read the master table that the scan builds
res <- suppressMessages(pam_scan_audio(ex$cfg))
pool <- suppressMessages(pam_validation_pool(ex$cfg))
bands <- unlist(ex$cfg$validation$bands)
# at most one event per species and confidence band
smp <- pam_validation_sample(pool, "stratified", bands = bands, n_per_cell = 1)
as.data.frame(smp)[, c("species", "confidence", "band")]
#> species confidence band
#> 1 Ducula nicobarica_Nicobar Imperial-Pigeon 0.71 0.70-1.00
#> 2 Psittacula longicauda_Long-tailed Parakeet 0.74 0.70-1.00
#> 3 Ducula nicobarica_Nicobar Imperial-Pigeon 0.64 0.50-0.70
#> 4 Gracula religiosa_Common Hill Myna 0.31 0.30-0.40
#> 5 Psittacula longicauda_Long-tailed Parakeet 0.66 0.50-0.70
#> 6 Gracula religiosa_Common Hill Myna 0.95 0.70-1.00
#> 7 Psittacula longicauda_Long-tailed Parakeet 0.45 0.40-0.50
# five events at random from the whole pool
rnd <- pam_validation_sample(pool, "random", bands = bands, n = 5, seed = 42)
nrow(rnd)
#> [1] 5