actuarialopensource / benchmarks

Some performance tests for actuarial applications
MIT License
14 stars 4 forks source link

Reimplement the lifelib ME_EX4 model #30

Closed serenity4 closed 1 year ago

serenity4 commented 1 year ago

The idea is to reimplement lifelib's ME_EX4 model in Julia, using an iterative approach as opposed to the caching-based cell/formula approach used by lifelib. This change in implementation was motivated by having a simpler design than the lifelib model, better readability, extensibility and memory usage.

Once this is done, we can produce benchmarks against lifelib's Python implementation and optimize ours.

MatthewCaseres commented 1 year ago

Nice. Seems like there is randomness in investment returns, will it be possible to iron this out and make it deterministic so we can have a single value that is reproduces by both?

serenity4 commented 1 year ago

It's not randomness per se (in that the implementation is deterministic), but I agree that it would be better to directly provide values for investment rates. Currently we allow any vector to be specified as the stochastic part of a brownian motion, but we could directly require a time series instead (which, to be consistent with the Python implementation, would be some user-provided Brownian motion).

serenity4 commented 1 year ago

Though for the concern of reproducibility between implementations, it should be fully reproducible in the current state (and we test that we can generate the same values).

MatthewCaseres commented 1 year ago

Any form of evidence that the two implementations are totally equivalent is good. This evidence will end up being reported in the README, so it is good if it is easily serialized into text (not a plot of distributions across run, although that is possible as well).

serenity4 commented 1 year ago

I ended up integrating the present value of net cash flows summed over all policies. I wouldn't try to hash the result, unless we do some rounding, because different implementations will likely have different floating-point accuracy.

MatthewCaseres commented 1 year ago

When I say hash I am usually meaning "a single number to verify the systems are the same" and it seems we have one.