Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend CRP to Pitman Yor and make hyper-parameters Loom compatible #256

Open
wants to merge 3 commits into
base: zane/hardcode-version
Choose a base branch
from

Conversation

Schaechtle
Copy link
Collaborator

What does this do?

Extends the CRP to a Pitman-Yor Process and uses Loom-style hyper-parameter grids for inference; using and modifying code from this branch but ensuring all tests pass again.

Why do we want this?

We're using CGPM in combination with Loom for structure learning. Here we use for initial inference CGPM for clean-up with fully Bayesian inference. Currently, that process is wasteful because we discard all hyper-parameters.

How was this tested?

The test suite was modified so that all CRP tests pass for Pitman-Yor with discount parameter = 0.

This PR is best-reviewed commit-by-commit.

@fsaad
Copy link
Collaborator

fsaad commented Jul 11, 2024

Use ' for string not ".

Copy link

@Joaoloula Joaoloula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, barring the structure_hypers=scalar in the tests.

@@ -1332,7 +1259,7 @@ def hypothetical(self, rowid):
def _check_partitions(self):
if not cu.check_env_debug():
return
assert self.alpha() > 0.
assert self.crp.hypers['alpha'] > 0.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to also check that the discount is between 0 and 1 (optionally, you could change the alpha check to the more permissive > -discount, even though given cgpm and loom's grid, we'll never enter the negative regime.

@@ -315,11 +315,11 @@ def gen_simple_engine(multiprocess=1):
rng=gu.gen_rng(1),
multiprocess=multiprocess,
outputs=outputs,
alpha=1.,
structure_hypers=1.,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be a dict with alpha and discount as keys?

@@ -331,11 +331,11 @@ def gen_simple_state():
state = State(
X=data,
outputs=outputs,
alpha=1.,
structure_hypers=1.,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants