Closed csaiedu closed 2 years ago
Indeed it does not seem to be correctly exposed, have you tried
with nphc._tf_graph.as_default():
R = nphc._tf_model_coeffs
inspired from the source code https://x-datainitiative.github.io/tick/_modules/tick/hawkes/inference/hawkes_cumulant_matching.html#HawkesCumulantMatching ?
Thanks for the quick reply. Pardon my ignorance but how do I get the value of R, I don't seem to be able to use numpy() or see the coefficients, only this
<tf.Variable 'model/R:0' shape=(4, 4) dtype=float64_ref>
Hum indeed, this is only a tensorflow variable. To be honest I do not remember this code well. Maybe you can retrieve the R variable by spawning a new tf session, but possibly this would have been possible only during the training. In such case you should probably edit the class to get the value of R at the end of the training, before the tf session ends.
Looking a the code this should be right. I edited my original post where the calculation were not correct.
R=scipy.linalg.inv(np.identity(n_nodes) - nphc.adjacency)
psi=R-np.identity(n_nodes)
Hi! If I'm not mistaken the HawkesCumulantMatching
object has an attribute solution
which is a numpy array that holds the solution of the optimisation. The adjacency
attribute is actually just a property that's calling solution
behind it: https://github.com/X-DataInitiative/tick/blob/bbc561804eb1fdcb4c71b9e3e2d83a66e7b13a48/tick/hawkes/inference/hawkes_cumulant_matching.py#L268-L270
Thank you
I am trying to retrieve the matrix of events of exogeneous origin using the attribute R, the "Estimated weight, linked to the integrals of Hawkes kernels. Use to derive adjacency and baseline defined in the attributes of the HawkesCumulantMatching" :
https://x-datainitiative.github.io/tick/modules/generated/tick.hawkes.HawkesCumulantMatching.html
But it doesn't seem to be defined
AttributeError: 'HawkesCumulantMatching' object has no attribute 'R'