PyAutoFit
PyAutoFit copied to clipboard
Better model.info for graphical model all fitted simultaneously
The following script composes a graphical model using AnalysisFactor's and a FactorGraphModel (but fits them not using expectation propagation, but instead as just one big model):
https://github.com/Jammy2211/autofit_workspace/blob/release/scripts/howtofit/chapter_graphical_models/tutorial_2_graphical_model.py
The model.info file appears as follows:
Total Free Parameters = 7
model CollectionPriorModel (N=7)
0 Gaussian (N=3)
1 Gaussian (N=3)
2 Gaussian (N=3)
0
centre UniformPrior, lower_limit = 0.0, upper_limit = 100.0
normalization UniformPrior, lower_limit = 0.0, upper_limit = 100.0
sigma UniformPrior, lower_limit = 0.0, upper_limit = 25.0
1
centre UniformPrior, lower_limit = 0.0, upper_limit = 100.0
normalization UniformPrior, lower_limit = 0.0, upper_limit = 100.0
sigma UniformPrior, lower_limit = 0.0, upper_limit = 25.0
2
centre UniformPrior, lower_limit = 0.0, upper_limit = 100.0
normalization UniformPrior, lower_limit = 0.0, upper_limit = 100.0
sigma UniformPrior, lower_limit = 0.0, upper_limit = 25.0
The model.results file is:
Bayesian Evidence 527.75383275
Maximum Log Likelihood 551.00961857
Maximum Log Posterior 551.00961857
model CollectionPriorModel (N=7)
0 Gaussian (N=3)
1 Gaussian (N=3)
2 Gaussian (N=3)
Maximum Log Likelihood Model:
2
centre 50.329
normalization 4.623
sigma 13.379
0
normalization 1.903
sigma 7.046
1
normalization 1.882
sigma 8.156
Summary (3.0 sigma limits):
2
centre 50.32 (48.09, 52.19)
normalization 4.69 (3.88, 5.71)
sigma 13.58 (11.28, 17.43)
0
normalization 1.77 (1.24, 2.38)
sigma 6.91 (4.47, 10.28)
1
normalization 1.97 (1.27, 2.82)
sigma 8.59 (5.41, 13.20)
Summary (1.0 sigma limits):
2
centre 50.32 (49.69, 50.98)
normalization 4.69 (4.37, 4.99)
sigma 13.58 (12.83, 14.50)
0
normalization 1.77 (1.58, 2.00)
sigma 6.91 (6.10, 7.92)
1
normalization 1.97 (1.76, 2.18)
sigma 8.59 (7.57, 9.75)
instances
Following https://github.com/rhayes777/PyAutoFit/issues/418, are there ways that we can use the same functionality to produce files that better describe the graph's structure?
This is a bit tricky because at the moment the thing being optimised is just a classical AutoFit model.
I could probably change the model.info quite easily but the model.results is constructed in a very different way for factor graphs