I think that might be overkill. Here was my solution, and I think it’s pretty generalizeable:
z0 = np.percentile(trace.get_values('z',chains=[0]),50,axis=0) z1 = np.percentile(trace.get_values('z',chains=[1]),50,axis=0) z= pd.DataFrame( {'z00':z0[:,0], 'z01':z0[:,1], 'z02':z0[:,2], 'z10':z1[:,0], 'z11':z1[:,1], 'z12':z1[:,2],}) z.corr()
Here’s the output:
z00 | z01 | z02 | z10 | z11 | z12 | |
---|---|---|---|---|---|---|
z00 | 1.000000 | -0.037718 | 0.273659 | -0.047861 | 0.999247 | 0.309811 |
z01 | -0.037718 | 1.000000 | 0.196097 | 0.999248 | -0.019276 | 0.157059 |
z02 | 0.273659 | 0.196097 | 1.000000 | 0.227347 | 0.246043 | 0.998589 |
z10 | -0.047861 | 0.999248 | 0.227347 | 1.000000 | -0.030644 | 0.187845 |
z11 | 0.999247 | -0.019276 | 0.246043 | -0.030644 | 1.000000 | 0.281592 |
z12 | 0.309811 | 0.157059 | 0.998589 | 0.187845 | 0.281592 | 1.000000 |
Here, it was very clear that dimension 0 should be switched with dimension 1 in the second trace because the two dimensions were correlated with one another at their median. If we just set a threshold for correlation, maybe check for consistency across a handful of percentiles, then use that to remap. If it fails, then just say that there was no obvious remapping, and asks the user to supply one. If none match, then that’s also a sign that it didn’t converge.