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

Support for conditional sampling #343

Open
isurulucky opened this issue Jan 23, 2025 · 0 comments
Open

Support for conditional sampling #343

isurulucky opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@isurulucky
Copy link
Collaborator

isurulucky commented Jan 23, 2025

Hi,

I tried out $subject and the implementation can be found in the PR #344.

I saw that there is already an issue created to change sampling implementation to top down, just sending this PR in case there is interest in using it till top down sampling is available. Would be happy to receive any suggestions for improvements. Planning to send a separate PR with some units tests, in case this is merged.

Code snippet for trying out conditional sampling:

    height = 28
    width = 28
    image_scope = np.array(range(height * width)).reshape(height, width)
    marginalize_idx = list(image_scope[0:round(height / 2), :].reshape(-1))
    vars_to_marginalize = Scope(marginalize_idx)
    sampling_query = SamplingQuery(cct)

    samples = sampling_query(x=input_to_condition.unsqueeze(1), integrate_vars=vars_to_marginalize)
    leaf_samples = samples[0]
    leaf_samples = leaf_samples[:, 0, :]

Thanks and regards,
Isuru

@isurulucky isurulucky added the enhancement New feature or request label Jan 23, 2025
@isurulucky isurulucky reopened this Jan 23, 2025
@isurulucky isurulucky self-assigned this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant