evaluatePars: Evaluate parameters for optimization

Description Usage Arguments Details Value

View source: R/optimize.R

Description

Internal soundgen function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
evaluatePars(
  p,
  pars,
  myfun,
  bounds = NULL,
  fitnessPar,
  fitnessFun = function(x) 1 - cor(x, key, use = "pairwise.complete.obs"),
  myfolder,
  key,
  otherPars = list(plot = FALSE),
  verbose = TRUE
)

Arguments

p

numeric vector of evaluated values of parameters

pars

names of arguments to myfun that should be optimized

myfun

the function being optimized: either 'segment' or 'analyze' (in quotes)

bounds

a list setting the lower and upper boundaries for possible values of optimized parameters. For ex., if we optimize smooth and smoothOverlap, reasonable bounds might be list(low = c(5, 0), high = c(500, 95))

fitnessPar

the name of output variable that we are comparing with the key, e.g. 'nBursts' or 'pitch_median'

fitnessFun

the function used to evaluate how well the output of myfun fits the key. Defaults to 1 - Pearson's correlation (i.e. 0 is perfect fit, 1 is awful fit). For pitch, log scale is more meaningful, so a good fitness criterion is "function(x) 1 - cor(log(x), log(key), use = 'pairwise.complete.obs')"

myfolder

path to where the .wav files live

key

a vector containing the "correct" measurement that we are aiming to reproduce

otherPars

a list of additional arguments to myfun

verbose

if TRUE, reports the values of parameters evaluated and fitness

Details

Called by optimizePars.

Value

Returns 1 - Pearson's correlation between fitness measure and the key (i.e. 0 is perfect fit, 1 is awful fit).


soundgen documentation built on June 20, 2021, 1:06 a.m.