Predict referent selection for a single trial from an association matrix
Source:R/evaluation.R
predict_referent.RdGiven a model's word-object association matrix, returns the probability
distribution over a trial's candidate objects for one heard word – the
quantity to compare against a participant's choice on a referent-selection
(m-alternative forced choice) trial. This is model-agnostic: it works on the
matrix of any xslFit (or any word-by-object matrix), reading each entry
as an association strength / meaning weight.
Usage
predict_referent(
m,
word,
objects,
prior = NULL,
pragmatic = FALSE,
threshold = NULL,
rsa_alpha = 3,
depth = 1,
d = NULL
)Arguments
- m
A word-by-object association matrix (e.g.
xsl_run(mod, data)$fits[[1]]$matrix). Assumed non-negative; negative entries are clamped to 0.dimnamesare used to resolve characterword/objects.- word
The heard word: a row name of
m, or a positive integer row index. A value not present inmis treated as a novel word.- objects
The candidate objects present on the trial: column names of
m, or positive integer column indices. An entry not present inmis treated as an unnamed (novel) object.- prior
Optional prior over
objects(lengthlength(objects), non-negative). Defaults to uniform. Set an entry to 0 to remove that object from consideration entirely (e.g. an object the speaker has no epistemic access to).- pragmatic
If
TRUE, use the RSA pragmatic listener instead of the literal one.- threshold
Optional; binarize
mat this value (m >= threshold) before predicting. The RSA layer is sharpest on a binary lexicon.- rsa_alpha, depth
Speaker rationality and recursion depth for the RSA listener (only used when
pragmatic = TRUE).- d
Optional exponent for an exponentiated (power) choice rule: the (clamped, possibly thresholded) associations are raised to
dbefore choice, as inget_perf().NULL(the default) leaves them unchanged.xsl_run()passes a model'sch_decparameter here, so thatbayesian_decay()scores test trials with the same decision rule it uses elsewhere.
Details
The literal rule is Bayes' rule on the word's row,
P(object | word) proportional to m[word, object] * prior(object),
normalized over the objects present. With pragmatic = TRUE the objects are
instead resolved by a one-step Rational Speech Act pragmatic listener
(rsa_listener()), which additionally reasons that the speaker could have
used a different word – this is what yields strong mutual exclusivity when
a heard word is lexically ambiguous and a competitor word names one of the
candidates. A truly novel (unseen) word carries no lexical evidence and
returns the prior in either mode.