bayesiains / nflows

Normalizing flows in PyTorch
MIT License
849 stars 118 forks source link

How to construct a flow with a very high dim base distribution #69

Closed wyyfffff closed 1 year ago

wyyfffff commented 1 year ago

Thanks for your excellent works!

I want to use the normalizing flow to learn a flow from a high dim distribution (e.g. 128 dims) to a 2-D Gaussian distribution, so how to modify the code to satisfy thay?

What I want to do is to map the high-dim data onto this 2-D plane

imurray commented 1 year ago

A standard normalizing flow is defined by a reversible transformation for which we can compute the determinant of the Jacobian of the transformation. That means we only consider dimension-preserving transformations, otherwise we aren't going to be able to reverse the transformation in at least one direction, and the Jacobian won't be square and so doesn't have a determinant.

There are a variety of ways you could use flows as part of a dimensionality-reducing scheme. @arturbekasov wrote a paper, "Ordering Dimensions with Nested Dropout Normalizing Flows", complete with code that uses nflows. His thesis has an expanded treatment. Some other approaches are cited in the paper and extended thesis version.