Sweep the lexicon-size prior alpha for an FGT model
Source:R/model-fgt2009.R
fgt2009_sweep_alpha.Rdfgt2009()'s alpha trades lexicon size against fit and must scale with
corpus size, and the fit-vs-alpha curve is single-peaked – so a coarse
sweep is the right way to choose it (and to evaluate the model fairly),
rather than a general-purpose optimizer. This runs xsl_run() for each
alpha and returns the per-value SSE against the dataset's human accuracy.
Usage
fgt2009_sweep_alpha(
data,
alphas,
rsa = FALSE,
gold = NULL,
...,
control = xslControl()
)Arguments
- data
An
xslDataobject (or list of them).- alphas
Numeric vector of
alphavalues to try.- rsa
Logical; if
TRUE, sweepfgt2009_rsa()instead offgt2009().- gold
Optional gold-standard lexicon as
list(words, objects). When given, the result gains anf_maxcolumn (best-threshold F-score againstgold).datamust be a singlexslDatain this case.- ...
Further arguments to the model constructor (e.g.
gamma,kappa, sampler controls).- control
Control arguments passed to
xsl_run().
Value
A data frame with columns alpha and sse (plus unweighted_sse
when data is a list, or f_max when gold is given).
Details
For a naturalistic corpus (e.g. rollins_corpus, fm_corpus) there is no
human accuracy vector; pass gold (a list(words, objects) lexicon) to also
get the best-threshold F-score of the learned matrix against it (via
get_roc_max()) at each alpha. Remember such corpora also want the
naturalistic-speech gamma = 0.1, kappa = 0.05 rather than the defaults
(see fgt2009()).
Examples
fgt2009_sweep_alpha(get_example_ambiguous_condition(),
alphas = c(1, 2, 4, 8))
#> alpha sse
#> 1 1 0.0002831451
#> 2 2 0.0238093922
#> 3 4 0.0132282220
#> 4 8 0.2031250000