X-DataInitiative / tick

Module for statistical learning, with a particular emphasis on time-dependent modelling
https://x-datainitiative.github.io/tick/
BSD 3-Clause "New" or "Revised" License
484 stars 105 forks source link

HawkesCumulanMatching #461

Open Olivia0227 opened 4 years ago

Olivia0227 commented 4 years ago

Hi~ When I use the " from tick.hawkes import HawkesCumulanMatching .... nphc = HawkesCumulantMatching(integration_support, cs_ratio=.15, tol=1e-10, step=0.3)

nphc.fit(multi.timestamps) plot_hawkes_kernel_norms(nphc) " which is from the example https://x-datainitiative.github.io/tick/auto_examples/plot_hawkes_cumulants_matching.html#example-plot-hawkes-cumulants-matching-py. The error is said module 'tensorflow' has no attribute 'placeholder'. Could you please tell me how to solve this problem? Thank you !

KristenMoore commented 4 years ago

@Olivia0227 - I had this issue too. I believe it's because you are using Tensorflow 2 and this code only works for Tensorflow versions < 2.0.

I was able to get it to run by changing import tensorflow as tf in the file hawkes_cumulant_matching.py to the following: import tensorflow.compat.v1 as tf tf.disable_v2_behavior()

Olivia0227 commented 4 years ago

@Olivia0227 - I had this issue too. I believe it's because you are using Tensorflow 2 and this code only works for Tensorflow versions < 2.0.

I was able to get it to run by changing import tensorflow as tf in the file hawkes_cumulant_matching.py to the following: import tensorflow.compat.v1 as tf tf.disable_v2_behavior()

Thank you for your solution, I will also try it later. I have created a separate environment containing a Tensorflow which has a lower version. It also works. 😊