rhayes777 / PyAutoFit

PyAutoFit: Classy Probabilistic Programming
https://pyautofit.readthedocs.io/
MIT License
59 stars 11 forks source link

feature/latent variables #975

Closed rhayes777 closed 5 months ago

rhayes777 commented 6 months ago

Resolve #966 although may inefficient

The user can now provide latent variables by overriding compute_latent_variable in the Analysis class.

def compute_latent_variable(self, instance) -> Dict[str, float]:
    return {"my_variable": instance.my_variable}

If this method is not overridden no latent variable output is written.

Currently this is called for every sample every time output is written. It is also called when creating a result. It may be desirable to map instances or samples to the latent variables dictionaries that were computed for them.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 80.97%. Comparing base (6011f1d) to head (e8bab2f). Report is 26 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #975 +/- ## ========================================== + Coverage 80.93% 80.97% +0.04% ========================================== Files 194 194 Lines 14720 14721 +1 ========================================== + Hits 11914 11921 +7 + Misses 2806 2800 -6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.