pyro-ppl / pyro

Deep universal probabilistic programming with Python and PyTorch
http://pyro.ai
Apache License 2.0
8.55k stars 986 forks source link

FR tutorial on directional distributions #2834

Open fritzo opened 3 years ago

fritzo commented 3 years ago

@OlaRonning would you be interested in collaborating on a tutorial on directional distributions, to host on https://pyro.ai/examples? I'd be happy to write up how to use VonMises, VonMises3D, ProjectedNormal, and ProjectedNormalReparam. It seems like also a nice place to promote your new toroidal distributions as well. One thing I could use help with is finding a nice public dataset to analyze. We could even write the tutorial in stages over multiple PRs, say building on @OlaRonning's proposed example.

Tasks

OlaRonning commented 3 years ago

Yes, that sounds like a fun project. We (my supervisor) have Master's students often working in Pyro/NumPyro on Directional Statistics, so I believe this would be very useful. I'm developing a Bayesian Mixture using SineSkewed and SineBivariate for phi and psi angles in 9mer data and will model a VAE for the same data after. The dataset is from another Ph.D. student (Christian Thygesen) in my group who's already agreed to upload it to the ML Repo. I can ask around for an excellent circular dataset as well.

I do have a bit of a backlog at the moment, but if you are willing to this over a month or two, I can commit some developer time as well (beyond the two examples I'm currently building).

fritzo commented 3 years ago

@OlaRonning sounds good, I'm in no hurry. I guess the first task is to find a dataset, then I could start a tutorial in the next couple weeks.

OlaRonning commented 3 years ago

I'll let you know when the first dataset is available. It shouldn't take too long on our end.

OlaRonning commented 3 years ago

Hi @fritzo, the 9mers dataset is submitted to the ML repo. Not sure how long it takes before it's available. I'll keep you posted.

OlaRonning commented 3 years ago

Hi @alexlyttle,

Saw your circular reparam over on NumPyro and figured you might be interested in collaborating on this tutorial? In particular, if you know of a high-quality public dataset with (1D) circular data (orbits measurements perhaps), that awesome.

alexlyttle commented 3 years ago

Hi @OlaRonning, I would love to help and I have been giving this some thought. At first I thought the inclination angle of stars may be a good example, but I don't think the problem is circular and requires a different kind of reparameterization. In my own work, I have been using VonMises to model a phase parameter in a model (e.g b in y ~ sin(a*x + b)). The science behind this work a bit unusual, so it wouldn't make a good tutorial. Regarding orbits, I think the angle tends not be important as we care more about the period and distance from the star.

That being said, I will have a deeper look into datasets, it would be cool to have an example from astronomy.

alexlyttle commented 3 years ago

@OlaRonning

Regarding orbits, I think the angle tends not be important as we care more about the period and distance from the star.

I was wrong here... I think the "argument of periasteron" might be a good circular parameter example, which is involved in modelling the orbits of exoplanets. I can't find an example of someone using Von Mises but it may well be appropriate here. I will first try recreating this tutorial from the exoplanet code (which uses public data) but in numpyro and reparameterize some of it to make use of a circular variable.

I'll get back to you if there is progress on this, and may ask for help from exoplanet researcher friends!

OlaRonning commented 3 years ago

@alexlyttle that looks very neat. Would be cool if the directional treatment works out well. I look forward to seeing it!