-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Currently, LinearRTO does not check whether the geometry has a linear par2fun and fun2par, which results in being able to use LinearRTO on posteriors it should not be able to be used. (It does work correctly when par2fun and fun2par behave linear, like with the StepExpansion)
Example to reproduce
import numpy as np
from numpy import array, zeros, linspace
import matplotlib.pyplot as plt
from cuqi.model import LinearModel
from cuqi.distribution import Gaussian, JointDistribution
from cuqi.experimental.mcmc import LinearRTO
from cuqi.geometry import Discrete, MappedGeometry
geom = Discrete(2)
geom = MappedGeometry(geom, map=lambda x : np.exp(x), imap=lambda x : np.log(x))
A_step = LinearModel(array([[1.0, 1.0]]), domain_geometry=geom)
x = Gaussian(zeros(2), 1)
y = Gaussian(A_step(x), 0.1)
joint = JointDistribution(x,y)
posterior = joint(y = y_data)
sampler = LinearRTO(posterior)
sampler.sample(1000)
samples = sampler.get_samples().samples
samples = array([geom.par2fun(samples[:, i]) for i in range(samples.shape[-1])])
plt.scatter(samples[:, 0], samples[:, 1], s = 20, zorder = 2)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working