-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access lower_limits_lists
and other quantities via model name
#1026
Comments
Are you talking about physical centres of just grid variables or any variable? Do we want this for the prior or posterior?
Presumably you mean that these values would be returned in an array the same shape as the grid search? From looking at the code it appears this is already supported for a grid search of arbitrary number of dimensions |
I was only talking about grid variables, but having it work for any variable would be fine and actually preferable now that I think about it (and this appears to be what the current PR implementation does). We want it to be for priors, e.g. the values used to set up the grid before the analysis runs. Doing the equivalent for the posterior requires the result. |
Cool ok so I think that's what this implementation does; as the model for each fit should depend on the grid limits the model alone should be sufficient. Asymmetric distributions are an exception as the mean will no longer be the centre of the grid square |
Rather than using the mean of the samples, should the code not be using Something using this function I think?
The physical values should be the centres of the priors, although maybe these both achieve the same thing. |
It could but that would be a much more complicated way of obtaining the same value for all except LogNormal priors |
The subhalo mass will be a |
Cool will look at implementing it that way |
At the moment the grid priors are all converted to UniformPrior to peform the grid search. def make_arguments(self, values, grid_priors):
arguments = {}
for value, grid_prior in zip(values, grid_priors):
if (
float("-inf") == grid_prior.lower_limit
or float("inf") == grid_prior.upper_limit
):
raise exc.PriorException(
"Priors passed to the grid search must have definite limits"
)
lower_limit = grid_prior.lower_limit + value * grid_prior.width
upper_limit = (
grid_prior.lower_limit + (value + self.step_size) * grid_prior.width
)
prior = p.UniformPrior(lower_limit=lower_limit, upper_limit=upper_limit)
arguments[grid_prior] = prior
return arguments |
Also it looks like the implementation of mean is the physical value at half unit value: >>> import autofit as af
>>> af.UniformPrior(1, 2).mean
1.5
>>> af.LogUniformPrior(1, 2).mean
1.4142135623730951
>>> af.LogUniformPrior(lower_limit=1.0, upper_limit=2.0).value_for(0.5)
1.4142135623730951 |
Ok, that will be why it works I guess. |
A
lower_limits_lists
is passed into aGridSearchResult
The
lower_limits_lists
is a list of list (of list of lists....) of the lower limit of the prior of every parameter that is searched over the grid search.If the grid search has 3 dimensions,
lower_limits_list
will consist of 3 lists.The quantities in
lower_limits_list
are used to compute other quantities, like the phyiscal value at the centre of each prior:This is used in PyAutoLens to determine the centre of the cells where a subhalo search is performed, for visualization:
Up to now, this has always relied on a subhalo search being 2D (only being over the y and x coordinates). We may soon be doing higher dimensional grid searches and thus need to genelize the above method.
We basically just need a function which returns
physical_centres_lists
for the input model path, so something like:centre_0_lists = self.physical_centres_lists_from("galaxies.subhalo.mass.centre.centre_0")
We also need support for multiple attribute inputs:
centre_lists = self.physical_centres_lists_from(["galaxies.subhalo.mass.centre.centre_0", "galaxies.subhalo.mass.centre.centre_1"])
It is crucial that the solution always maintains the structure of the
physical_centres_lists
used in the actual grid search.However, the solution must work on all these different attribute,s as you can see above
self.physical_step_sizes
is also used in the function and would become ill defined if the grid search went to 3D.Attribute Grid
A function exists in
GridSearchResult
which plays a similar role to the requested code above:Which is called via:
The difference for this function is that it returns the maximum log likelihood values of every input parameter based on model-path, as opposed to the values that define where the grid cell.
The text was updated successfully, but these errors were encountered: