Hello Mahdi,
A MemoryError is surprising to me, but some kind of error is to be expected in that case (when the probabilities are not constants but vary depending on the individual) because, in that case, the choice is implemented as something like:
u: uniform()
if(u < proba1, outcome1,
if(u < proba1+proba2, outcome2,
…
outcomeN))
This means you will hit numexpr's limitations (31 different unique variables and 255 registers – variables or temporaries).
See https://github.com/pydata/numexpr/issues/167 for a bit more details.
One thing you could try is to transform your choice to the above expression manually, so you can split it as needed.
I admit this would be awfully long and ugly but I don't have another idea which does not involve modifying LIAM2's code at this point. That said, you could also try to modify liam2 code to automatically split these expression when they become too large (doing this in all generality might be hard, but doing just for these choice expressions should be relatively easy).
Sadly this whole translation is necessary in the first place because np.digitize does not support arrays for bins boundaries (i.e. have different bins per individuals). The best solution would of course be to implement (in cython or numba) a digitize-like function supporting arrays as bounds but that might require more work than you are ready to put into this 😉.
Hope it helps,
Gaëtan
--
You received this message because you are subscribed to the Google Groups "liam2-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
liam2-users...@googlegroups.com.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/liam2-users/CA%2BAkwSff%2B8brNrCRs%3DJV96e9tGZmYqHPTk66URNQfzyKHn0ecw%40mail.gmail.com.