Set of Jupyter (iPython) notebooks (and few pdf-presentations) about things that I am interested on, like Computer Science, Statistics and Machine-Learning, Artificial Intelligence (AI), Financial Engineering, Optimization, Stochastic Modelling, Time-Series forecasting, Science in general... and more.
A quick fix (and a huge speedup) is possible via Boltons package from boltons.cacheutils import cachedproperty and then using @cachedproperty instead of @property everywhere.
I understand that the source code is pretty old, so just letting you know this in case you're still maintaining it (or any derivations of it). I found it useful, so possibly others find it useful too.
Thanks a lot, avish.
You are right, that's something that I build 5 years ago and never thought about that. As soon as I have some spare time I will have a look. Your suggestion looks definitely interesting.
Using your implementation of LSM MC for derivatives pricing from https://github.com/jpcolino/IPython_notebooks/blob/master/Least%20Square%20Monte%20Carlo%20Implementation%20in%20a%20Python%20Class.ipynb - thanks! Noticed that the class is immutable and you're using
@property
decorator for all calculated properties. Unfortunately,@property
doesn't cache (memoize) the results so all the "expensive" properties (e.g.MCprice_matrix
) are recalculated many times over when referenced from other methods.A quick fix (and a huge speedup) is possible via Boltons package
from boltons.cacheutils import cachedproperty
and then using@cachedproperty
instead of@property
everywhere.I understand that the source code is pretty old, so just letting you know this in case you're still maintaining it (or any derivations of it). I found it useful, so possibly others find it useful too.
Thanks.