rmnldwg / lymph

Python package for statistical modelling of lymphatic metastatic spread in head & neck cancer.

Home Page:https://lymph-model.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

if things are expensive, they should look expensive

rmnldwg opened this issue · comments

Right now, the package makes heavy use of Python's @property decorator. For example, loading data is as "easy" as writing

model.patient_data = some_pandas_table

This looks like I am only storing the table inside the model object. But actually, it is computing the diagnose matrix which is rather expensive. So, making this a function instead of a property would give it the look and feel of something potentially resource-intensive:

model.load_patient_data(some_pandas_table)

A lot has happened with the new 1.0 API. In particular, setting new parameters does not immediately trigger a recomputation of expensive stuff like the transition matrix.

Thus, in keeping with this issue, it would make sense to replace model.transition_matrx with model.transition_matrix() to hint at the user that this might be expensive (although it often is not due to caching).