Samreay / ChainConsumer

Corner plots, LaTeX tables and plotting walks.
https://samreay.github.io/ChainConsumer
MIT License
79 stars 17 forks source link

Add a weight option to chainconsumer #129

Closed Samreay closed 5 months ago

Samreay commented 5 months ago

Discussed in https://github.com/Samreay/ChainConsumer/discussions/123

Originally posted by **dreese80** April 17, 2024 Currently, an intern of mine is working on clustering MCMC samples, i.e. separating it into different groups based on local maxima in the posterior probability distribution. We have been using chainconsumer to render these different clusters using different colors, and chainconsumer does a very nice job. However, we noticed that with this strategy, a cluster with few samples will be given the same weight as one with many samples. This can lead to misleading histograms (along the diagonal of the corner plot) by overemphasizing small clusters. We therefore thought it would be a useful feature to add a weight field to the chain object and use this to weight the individual histograms shown along the diagonal. Attached is a modified version of chainconsumer that achieves this (in case it is useful). [chainconsumerweight.zip](https://github.com/Samreay/ChainConsumer/files/15009343/chainconsumerweight.zip)