A model for the adjective “expensive” for coffee makers, headphones, laptops, sweaters, and headphones, as presented in Lassiter and Goodman (2013).
Assume a speaker said “an expensive watch” when they could have said nothing.
x ///fold:
var alpha = 1; // rationality parameter
var utterances = ["expensive", ""];
var cost = {
"expensive": 1,
"": 0
};
var utterance_prior = function() {
return utterances[discrete(map(function(u) {return Math.exp(-cost[u]);}, utterances))];
};
var meaning = function(utterance, price, theta) {
if (utterance == "expensive") {
return price >= theta;
} else {
return true;
}
};
var literalERP = cache(function(utterance, theta, item) {
var price_prior = prior(item);
return Enumerate(function() {
var price = price_prior();
condition(meaning(utterance, price, theta));
return price;
});
});
var speakerERP = cache(function(price, theta, item) {
return Enumerate(function() {
var utterance = utterance_prior();
factor( alpha * literalERP(utterance, theta, item).score([], price) );
return utterance;
});
});
var listenerERP = function(utterance, item) {
var price_prior = prior(item);
var theta_prior = theta_prior(item);
return ParticleFilter(function() {
var price = price_prior();
var theta = theta_prior();
factor( alpha * speakerERP(price, theta, item).score([], utterance) );
return {
price: price,
theta: theta
};
}, 1000);
};
// draw graphs
///fold:
In our prior elicitation experiment, we asked participants to create a binned histogram of prices for 5 different kinds of objects (coffee maker, headphones, laptop, sweater, watch). Average responses are shown below and used as background data for our adjectives model.
// experiment data is in fold
///fold:
var prior = function(item) {
// midpoint of bin shown to participants
var prices = data[item].prices;
// average responses from participants, normalizing by item
var probabilities = data[item].probabilities;
return function() {
return prices[discrete(probabilities)];
};
}
vizPrint(
{
"coffee_maker": Enumerate(prior("coffee maker")),
"headphones": Enumerate(prior("headphones")),
"laptop": Enumerate(prior("laptop")),
"sweater": Enumerate(prior("sweater")),
"watch": Enumerate(prior("watch")),
});
References: