PEtab-dev / petab_select

Repository for development of the model selection extension
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

issues with serialisation of `model.to_yaml` #39

Closed fbergmann closed 1 year ago

fbergmann commented 1 year ago

trying to compare some of the results with the expected ones in the test_cases, I encountered an issue, where the result files serialised by running to_yaml after the selection on the best model yields rather cryptic yaml files. Where I was hoping for files with floating point numbers, as you have in the expected files, I receive files like:

criteria:
  AIC: !!python/object/apply:numpy.core.multiarray.scalar
  - &id001 !!python/object/apply:numpy.dtype
    args:
    - f8
    - false
    - true
    state: !!python/tuple
    - 3
    - <
    - null
    - null
    - null
    - -1
    - -1
    - 0
  - !!binary |
    bPioMii0tEA=
  AICc: !!python/object/apply:numpy.core.multiarray.scalar
  - *id001
  - !!binary |
    bPioMii1tEA=
  BIC: !!python/object/apply:numpy.core.multiarray.scalar
  - *id001
  - !!binary |
    Dpto4/KztEA=
  LLH: !!python/object/apply:numpy.core.multiarray.scalar
  - *id001
  - !!binary |
    bPioMiiypMA=

is that on my end, or would it be something that petab_select could do to cast the elements into basic types?

I use:

    test_model.set_criterion(Criterion.LLH, llh)

    test_model.compute_criterion(Criterion.AIC)
    test_model.compute_criterion(Criterion.AICC)
    test_model.compute_criterion(Criterion.BIC)
fbergmann commented 1 year ago

for now

    test_model.set_criterion(Criterion.LLH, float(llh))

gives me the result I wanted to have. I leave the issue open as question anyways.

dilpath commented 1 year ago

Thanks for reporting! I agree, it will be cast to float internally, in the next release.