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

Continuous input distributions #128

Open
trappmartin opened this issue Jan 23, 2023 · 2 comments · May be fixed by #129
Open

Continuous input distributions #128

trappmartin opened this issue Jan 23, 2023 · 2 comments · May be fixed by #129

Comments

@trappmartin
Copy link

Hi,
@ams939 and I just realized that there are no continuous input nodes. We would add codes for Gaussian distributions. Are there any things we should keep in mind when doing so?

Thanks,
Martin

@trappmartin
Copy link
Author

@khosravipasha Do you have any suggestions on how to best code up the GPU related bits?

@khosravipasha
Copy link
Contributor

Hi,
Adding Guassian should be relatively straightforward. Mainly need to keep track of sufficient statisitics needed during training.
We all the flow function to accumulate the sufficent statistics needed, also need to multiply them by the flow value which is basically probability of getting to that input node given input x. The formula would be similar to equition 7 from einsum network paper (difference is if you have missing values during training we have a special case for that, need to also track "missing flow").

image

I guess for guassian with fixed sigma, only need to track the sum node_flow and sum node_flow * value (and if might have missing data during training also want to add up flow for missing values, see example for binomial here, should be very similar for Gaussian

https://github.com/Juice-jl/ProbabilisticCircuits.jl/blob/27cb093439c8db5b6e59f75567800ff92d4fffa6/src/nodes/binomial_dist.jl#L70-L79

For GPU learning we need the following functions implemented:

  • For each input type we have two Strcuts, one is for cpu version and one is for gpu (eg. Binomial vs BitsBinomial)
  • bits: converts the input node into bits (i.e. continigous arrays) for paramters and temporary heap memory for keeping track of required suffiecient statistics for that input node.
  • unbits: does the opposite and reads from the heap and moves it to cpu into Julia structs.
  • flow: for the bits version of input nodes
  • update_params: this does the EM update (either mini batch for full batch) with some intertia.

let me know if you run into any other issues, will be happy to help.

@ams939 ams939 linked a pull request Feb 3, 2023 that will close this issue
@khosravipasha khosravipasha linked a pull request Feb 10, 2023 that will close this issue
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 a pull request may close this issue.

2 participants