probcomp / hierarchical-irm

Probabilistic structure discovery for rich relational systems
Apache License 2.0
1 stars 1 forks source link

Support different relation/distribution types using std::variant. #33

Closed emilyfertig closed 3 weeks ago

emilyfertig commented 1 month ago

Non-Bernoulli models are still pretty sparsely tested (I added some minimal coverage in test_misc) but I think this is in a reviewable state.

I'll add support for Categoricals in a follow-up. Plumbing the num_categories parameter through is a little tricky (one idea is to include the number of categories in the distribution name, e.g. categorical12 and then parse it inside of Relation when we need a new distribution instance.)

I changed SampleType to S in DistributionAdapter (which was an alternative approach to generalizing distribution types, which I think we no longer need assuming this PR looks good) due to a name collision with the SampleType that I put in the base class. I moved function/method definitions from normal.hh to normal.cc to avoid multiple-definition errors for logZ.

emilyfertig commented 3 weeks ago

I'm going to merge this now to unblock since Srinivas reviewed it. If others have comments I'll address them in a follow-up.