cagatayyildiz / npde

Nonparametric Differential Equation Modeling
MIT License
51 stars 9 forks source link

IndexError: index 1 is out of bounds for axis 0 with size 1 #5

Open roofya opened 4 years ago

roofya commented 4 years ago

Hello I'm running the Demo for 100 cells with time and its working for ODE part and I could get the plots however for SDE part I got this error Model being initialized...

IndexError Traceback (most recent call last)

in 1 # in order to constant diffusion, lengthscale of the diffusion process (ellg0) must be big 2 npde = npde_fit(sess, t, Y, model='sde', sf0=1.0, ell0=np.ones(2), ellg0=[1e5], W=6, ----> 3 ktype="id", Nw=50, num_iter=500, print_int=100, eta=0.02, plot_=True) ~/Downloads/npde-master/npde_helper.py in npde_fit(sess, t, Y, model, sf0, ell0, sfg0, ellg0, W, ktype, whiten, Nw, fix_ell, fix_sf, fix_Z, fix_U, fix_sn, fix_ellg, fix_sfg, fix_Zg, fix_Ug, num_iter, print_int, eta, dec_step, dec_rate, plot_) 150 fix_sn=fix_sn) 151 with tf.name_scope("cost"): --> 152 Xs = npde.forward(Nw=Nw) 153 ll = 0 154 for i in range(len(Y)): ~/Downloads/npde-master/npde.py in forward(self, Nw, x0, ts) 212 213 def forward(self,Nw=1,x0=None,ts=None): --> 214 return self.integrator.forward(Nw=Nw,x0=x0,ts=ts) 215 216 def sample(self,Nw,x0,t): ~/Downloads/npde-master/integrators.py in forward(self, Nw, x0, ts) 92 time_grid = ops.convert_to_tensor(t, preferred_dtype=float_type, name='t') 93 time_delta_grid = time_grid[1:] - time_grid[:-1] ---> 94 y0 = np.repeat(x0[i,:].reshape((1,-1)),Nw,axis=0) 95 y0 = ops.convert_to_tensor(y0, name='y0') 96 scan_func = self._make_scan_func(self.model.f,self.model.diffus.g) IndexError: index 1 is out of bounds for axis 0 with size 1 Predictions¶ I really appreciate if you could help me to fix this error. Thank you
cagatayyildiz commented 4 years ago

Hi, could your x0 be a 1D tensor? It should be of shape [N,n] where N is the number of initial values and n is the state dimensionality.