Replies: 3 comments 4 replies
-
Here's a video, since I'm aware the notebook might not load Screencast.from.03-04-24.20.17.10.webm |
Beta Was this translation helpful? Give feedback.
-
On my blog I posted a linked visualization of values from BasicTerm_SE model (excluding NB and reversing scaling by policy_count). Data is static for this but the visualization is interactive - I mostly wanted to build something using Mosaic which is a really nice framework for this kind of linked visualization and uses DuckDB database to make it scaleable. It helped me to understand the model through the data also, although there isn't a lot to discover there given pricing criteria very direct relationship to net premium on term and age at entry. Mosaic has a Jupyter widget, so can be integrated in an interactive notebook also. |
Beta Was this translation helpful? Give feedback.
-
I took the modelx option pricing example and copied it into a marimo reactive notebook and added some UI elements. I use reactive javascript a lot (Mike Bostocks observable js/hq) so glad to play with similar reactive systems in python world. Screencast.from.12-04-24.22.32.16.webmAlso started to do the same with shinylive but didn't polish it to the same extent. Shinylive embeds nicely in Quarto websites though (like my website/blog) - Shiny and Quarto both being Posit projects. In both shinylive/marimo cases running modelx through pyodide. Pyodide seems to be pretty robust. I guess that lifelib will work? in the worst case a serializer to a modelx-python syntax (like above) is possible? (i.e. as opposed to requiring a custom parser) but export to regular Python certainly works (since thats what I used to run in Jupyterlite). |
Beta Was this translation helpful? Give feedback.
-
Hello,
Great work on lifelib!
I've seen the project develop for years but quietly - it's really excellent to see the resources, capabilities and discussions evolve!
I appreciate Python a lot for data science type workloads but I've mainly been throwing myself into Javscript for visual and interactive stuff that is easily shared. I develop calculang and you'll see simple things along those lines there.
I want to integrate calculang with some Python worldly numbers, so I'm throwing myself also into Python and lifelib now.
All the Python environments will work well with Javascript on some level, but I wanted to see how lifelib will run in a Pyodide environment (Python but compiled to run in-browser).
Thankfully this was kindof easy! But I guess there is some instability that I hope can be resolved in the long run, maybe by hosting dependencies.
I used a Python export of BasicTerm_S, copied the files into my environment and then regular Python import works. I got an error on the modelx version but I guess it could be resolvable - I'm only really interested in the faster one for interactive outputs anyways!
In the notebook I use IPyWidgets to make an interaction with an Altair visual of the cashflows. I rushed this a bit (black line is the net cashflow), but it's easy to see a consistent shape in the cashflows across any selection of policies.
Below is a link to the notebook (self deployed) if someone wants to try. Let me know if you experience issues, and finally, if someone has built interactive outputs for lifelib I'd love to hear about it!
https://declann.github.io/jupyterlite-things/lab/index.html?path=lifelib%2Fbasicterm-interact.ipynb
This is a simple interaction at a policy-level, but it's clearly showing good performance needed for interactive workloads. That might break on lots of aggregate modelling over lots of data, but I guess it's still an interesting environment to work with. (besides being useful for sharing and for informative things like docs or tutorials - if reliable)
Note: since everything runs in the browser you can edit the Python code in this notebook and re-run cells. Other environments are persistent and will keep your changes across sessions. It's not a good idea to rely on persistence here and better to use the Download button if you want to keep something! (this gives a regular
ipynb
file for other sessions/notebook environments)Cheers,
Declan
Beta Was this translation helpful? Give feedback.
All reactions