ciceroOslo / ciceroscm

Python version of the CICERO-SCM simple climate model/emulator
Apache License 2.0
17 stars 4 forks source link

Allow for specified correlated parameters in _configdistro.py #103

Open benmsanderson opened 1 year ago

benmsanderson commented 1 year ago

Allow multiple parameters to be perfectly correlated in latin hypercube sampling.

possible approach - allow 'r' dimensions out of a total 'np' to be jointly sampled

in get_samples_from_distro_latin(self, numvalues), allow

np=len(self.ordering)
sampler = qmc.LatinHypercube(d=np-r)
samples_subspace = sampler.random(n=numvalues)

so samples_subspace is now a unit hypercube samping np-r dimensions

Now define parameter correlation matrix relating the hypercube to the dimensionality of the model:

e.g. if there are 5 parameters, parameters 1 and 2 are correlated, and parameters 4 and 5 are correlated: cp=np.array([[1,1,0,0,0],[0,0,1,0,0],[0,0,0,1,1]])

constructing the full unit matrix as the dot product. samples_unit=np.dot(samples_subspace,cp)

Need to think a bit more about how to generalise this...