Open ibrahimelumari opened 1 year ago
Hi, Have you tried casting your data into array of doubles ?
You could proceed as following
import numpy as np
list_of_list_of_events = [
[np.array([ 0, 150, 1440, 6960, 8040]), np.array([1140, 2160, 6480]), np.array([2190, 2640, 2970, 3210, 4380]), np.array([ 810, 1200, 1890]), np.array([ 780, 2100, 3510])],
[np.array([ 0, 150, 1500])]]
casted_list_of_list_of_events = [
[array.astype(float) for array in list_of_events]
for list_of_events in list_of_list_of_events
]
print(casted_list_of_list_of_events)
Hi @Mbompr , Thank you for your response, I followed your suggestion and it magically worked ! Was I having that problem just because of me using int instead of float data type ? I'd like a simple explanation for this if possible. (since I don't think this was explicitly mentioned in the documentation, and that the error message I kept getting was not very expressive) ` fit(events: list, start=None) Fit the model according to the given training data.
Parameters
events : list of np.array
The events of each component of the Hawkes. Namely events[j] contains a one-dimensional numpy.array of the events’ timestamps of component j
... ` Additionally, it'd be so helpful to know, for the events parameter, what are the acceptable data types (would it be possible if we use just nested Python lists or nested np.array lists ) ?
Thank you.
Hi, I've been trying to use the fit function for training using the HawkesExpKern function, but it seems that the data structure of my events list is wrong.
I'm working on some medical related data for a group of patients, so I have data for every patient, and each patient has some events that occur during a surgery. I have constructed the Hawkes process events timestamps list: that's a Python list containing sub-lists (also Python lists, one for every patient data) that contain 5 numpy.arrays each (each of these is indicating an event category, having their occurrence time in the surgery timeline (from 0 onward). Here's an extract from the list for the first 2 patients:
The problem is that I keep getting an error when running the fit function (after specifying the kernel parameters): ValueError: Expecting a double numpy array
Am I doing something wrong ?