evaluatePars: Evaluate parameters for optimization

View source: R/optimize.R

evaluateParsR Documentation

Evaluate parameters for optimization

Description

Internal soundgen function.

Usage

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 Sept. 12, 2024, 6:29 a.m.