'Simulator' object has no attribute 'np_clip_param' when following diffxpy tutorial
davidhbrann opened this issue · 2 comments
davidhbrann commented
I tried to run the diffxpy tutorial here, but ran into the following issue. I also had the same issue when trying the numpy backend of the Simulator.
from batchglm.api.models.tf1.glm_nb import Simulator
sim = Simulator(num_observations=200, num_features=100)
sim.generate_sample_description(num_batches=0, num_conditions=2)
sim.generate_params(
rand_fn_loc=lambda shape: np.random.uniform(-0.1, 0.1, shape),
rand_fn_scale=lambda shape: np.random.uniform(0.1, 2, shape)
)
sim.generate_data()
Here's the traceback:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-15-cdb736ba0fd1> in <module>
7 rand_fn_scale=lambda shape: np.random.uniform(0.1, 2, shape)
8 )
----> 9 sim.generate_data()
~/source/batchglm/batchglm/models/glm_nb/simulator.py in generate_data(self)
47 """
48 data_matrix = np.random.negative_binomial(
---> 49 n=self.phi,
50 p=1 - self.mu / (self.phi + self.mu),
51 size=None
~/source/batchglm/batchglm/models/glm_nb/model.py in phi(self)
52 @property
53 def phi(self) -> np.ndarray:
---> 54 return self.scale
~/source/batchglm/batchglm/models/base_glm/model.py in scale(self)
109 @property
110 def scale(self):
--> 111 return self.inverse_link_scale(self.eta_scale)
112
113 @abc.abstractmethod
~/source/batchglm/batchglm/models/base_glm/model.py in eta_scale(self)
100 def eta_scale(self) -> np.ndarray:
101 eta = np.matmul(self.design_scale, self.b)
--> 102 eta = self.np_clip_param(eta, "eta_scale")
103 return eta
104
AttributeError: 'Simulator' object has no attribute 'np_clip_param'
Here's the versions I'm using:
[('tensorflow', '1.15.0'),
('tensorflow_probability', '0.8.0'),
('anndata', <Version('0.7.1')>),
('seaborn', '0.10.0'),
('logging', '0.5.1.2'),
('numpy', '1.18.1'),
('pandas', '1.0.0'),
('scipy', '1.4.1'),
('diffxpy.api', 'v0.7.3+15.g00f8a83')]
davidsebfischer commented
Hi @dhb2128, thanks for the issue! Can you try installing diffxpy and batchglm from dev? The issue should be resolved there now.
davidhbrann commented
Sorry, I didn't see your response on the diffxpy issue. That fixed my problem, thanks!