probcomp/bayeslite

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

Open

#461 ouverte le 15 juil. 2016

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)Python (63 forks)batch import
help wantedk min/hr

Métriques du dépôt

Stars
 (915 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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.

Guide contributeur