cagatayyildiz / npde Goto Github PK
View Code? Open in Web Editor NEWNonparametric Differential Equation Modeling
License: MIT License
Nonparametric Differential Equation Modeling
License: MIT License
Is it possible to formulate an ODE on the form
dx/dt=f(t,x,u)
where u is a vector of n time varying parameters?
Hi there,
When I try to run the third code cell of the demo.ipynb notebook I get the following error:
Model being initialized...
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-3-852cca2bc894> in <module>
3 # step size (eta) must be carefully tuned for different data sets
4 npde = npde_fit(sess, t, Y, model='ode', sf0=1.0, ell0=np.ones(2), W=6, ktype="id",
----> 5 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_)
102 ktype=ktype,
103 fix_ell=fix_ell,
--> 104 fix_sf=fix_sf)
105
106 if model is 'ode':
~/Downloads/npde-master/kernels.py in __init__(self, sf0, ell0, ktype, learning_rate, summ, block, name, fix_sf, fix_ell)
48 summ = summ,
49 fix_sf = fix_sf,
---> 50 fix_ell = fix_ell)
51 self.ndims = len(ell0)
52 self.ktype=ktype
~/Downloads/npde-master/kernels.py in __init__(self, sf0, ell0, name, learning_rate, summ, fix_sf, fix_ell)
23 summ = summ,
24 fixed = fix_ell)
---> 25 self.sf = sf()
26 self.ell = ell()
27
~/Downloads/npde-master/param.py in __call__(self)
55 return self.tf_opt_var
56 else:
---> 57 return self.transform.forward_tensor(self.tf_opt_var)
58
59 def variable_summaries(self,var):
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gpflow/transforms.py in forward_tensor(self, x)
151
152 def forward_tensor(self, x):
--> 153 return tf.nn.softplus(x) + self._lower
154
155 def backward_tensor(self, y):
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py in softplus(features, name)
7268 if _ctx is None or not _ctx._eager_context.is_eager:
7269 _, _, _op = _op_def_lib._apply_op_helper(
-> 7270 "Softplus", features=features, name=name)
7271 _result = _op.outputs[:]
7272 _inputs_flat = _op.inputs
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
508 dtype=dtype,
509 as_ref=input_arg.is_ref,
--> 510 preferred_dtype=default_dtype)
511 except TypeError as err:
512 if dtype is None:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx)
1144
1145 if ret is None:
-> 1146 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1147
1148 if ret is NotImplemented:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/variables.py in _TensorConversionFunction(v, dtype, name, as_ref)
830 return v._ref() # pylint: disable=protected-access
831 else:
--> 832 return v.value()
833
834 @staticmethod
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/variables.py in value(self)
401 A `Tensor` containing the value of the variable.
402 """
--> 403 raise NotImplementedError
404
405 def read_value(self):
NotImplementedError:
Any idea how this occurs? I'm running this on my laptop using Python 3.6 with the latest versions of both TensorFlow (1.12.0) and GPFlow (1.3.0)
Hello,
I am getting the following error, I believe its because of the "true path plotting". Is there an option to turn it off? Thanks so much.
npde = npde_fit(sess, t, Y, model='sde', sf0=1.0, ell0=np.ones(5, dtype=np.float64), ellg0=[1.0], W=2, ktype="id",
... fix_Z=True, Nw=200, num_iter=500, print_int=100, eta=0.01, plot_=True)
Model being initialized...
Adam optimizer being initialized...
Optimization starts.
iteration objective
1 34633.532
100 30749.023
oh yeah 200 29533.534
300 28658.060
400 27934.877
500 27265.514
Optimization ends.
Plotting...
noise variance: [1.60207482 1.05628679 1.09402518 1.21820736 1.53764724]
signal variance: 0.6738406245387211
lengthscales: [0.36330872 0.77718864 0.68213066 0.60997537 0.37128257]
diff signal variance: 2.7179468499240924
diff lengthscales: [2.82314066]
Traceback (most recent call last):
File "", line 2, in
File "/athena/mezeylab/scratch/as3397/npde/npde_helper.py", line 184, in npde_fit
plot_model(npde,Nw=50)
File "/athena/mezeylab/scratch/as3397/npde/utils.py", line 87, in plot_model
true_path = em_int(vdp,g,npde.x0[0,:],vdpts)
File "/athena/mezeylab/scratch/as3397/npde/utils.py", line 64, in em_int
Xs[i+1,:] = Xs[i,:] + fdt + gdt.flatten()
ValueError: operands could not be broadcast together with shapes (5,) (2,)
Great repo! Hope you would be able to help me out here.
The dimension of the output of the K(self, X,X2=None)
operation in kernels.py
seems to be
A subsequent and more relevant question to my application, is that how to compute the entropy from the kernel representing the posterior? For the scalar-valued GP, one would need to add the learnt noise variance
However, here the noise variance
Thank you!
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
Hello, the dataset dimensions are Y (1, 2244, 569), and t(1, 2244), however when I run the following command, I get the following error:
npde = npde_fit(sess, t, Y, model='sde', W=1.0058, ktype="id", fix_Z=True, Nw=10, num_iter=100, print_int=100, eta=0.02, plot_=True, ell0=np.ones(569), ellg0=[1e5])
Model being initialized...
Traceback (most recent call last):
File "", line 1, in
File "/athena/mezeylab/scratch/as3397/npde/npde_helper.py", line 80, in npde_fit
vecs = np.meshgrid(*grids)
File "/home/as3397/.conda/envs/tf-gpu2/lib/python3.5/site-packages/numpy/lib/function_base.py", line 4048, in meshgrid
for i, x in enumerate(xi)]
File "/home/as3397/.conda/envs/tf-gpu2/lib/python3.5/site-packages/numpy/lib/function_base.py", line 4048, in
for i, x in enumerate(xi)]
ValueError: sequence too large; cannot be greater than 32
Do you have any idea why this might be happening?
Hello, I am trying to understand whats the format of the input data to the algorithm npde_fit from gen_data. Please let me know if I understand this correctly:
If I understand this correctly, then do you think it is possible to still make an inference from a dataset that has following dimensions:
The main concern I have here is how the method may perform because the number of observations is 1 i.e. a single snapshot, do you think reasonable inference can still be made? Moreover do you think the dimensions of X/Y would impact the inference as well. Any insight in this matter would be highly appreciated! Thanks again for your help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.