probcomp/bayeslite
View on GitHubgracefully report error in CGPM for latent categoricals without specified number of categories
Open
#461 opened on Jul 15, 2016
help wantedk min/hr
Description
CREATE GENERATOR g FOR p USING cgpm (
LATENT y CATEGORICAL,
MODEL y GIVEN x USING whatever,
MODEL z GIVEN y USING frobnosticator
)
In order to use the latent categorical (or, 'nominal') variable y as an input of the frobnosticator model, CGPM wants to know fictitious distribution parameters, namely the number of categories (or, 'names' or 'labels'), but there is no way to ascertain this because x is latent and does not actually appear in the table. The _default_categorical (or, _default_nominal) method will fail trying to select a nonexistent variable from the table -- or maybe quietly return 1 because of the usual sqlite3 quotation misfeature.
Not tested; observed by code inspection.
Alternative fix: Obviate the need to specify fictitious distribution parameters. This requires changes to CGPM.