probcomp/bayeslite

gracefully report error in CGPM for latent categoricals without specified number of categories

Open

#461 aperta il 15 lug 2016

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)Python (63 fork)batch import
help wantedk min/hr

Metriche repository

Star
 (915 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor