Conversation
There was a problem hiding this comment.
Is there a way to not directly include this whole bit of source code? It feels a little dishonest bc it is Rachel's code and not our's. Does she have a repo with it somewhere we can pull from?
|
|
||
| self.prior_dist = self.load_prior(prior, prior_kwargs) | ||
| self.n_dims = self.thetas.shape[1] | ||
| # Uncomment this for NPE |
There was a problem hiding this comment.
Maybe the best way to do this is to check the type of self.thetas and only set n_dims f it's an array or something
| context array | ||
| """ | ||
| try: | ||
| return self.data["context"][0] # has to be made more general because in pendulum time is fixed. So we can do this |
| y_global = y_global[:, 0, :] | ||
| return y_local, y_global | ||
|
|
||
| except KeyError: |
There was a problem hiding this comment.
Can we check for the local and global parameters before this? I am afraid this key error will cause confusion. Maybe in the init after the load we run verify they're in the keys and otherwise through a valueerror
| return y_local, y_global | ||
|
|
||
| except KeyError: | ||
| raise NotImplementedError("Data does not have a `thetas` field.") |
There was a problem hiding this comment.
I don't think a NotImplementedError is the right error here - I'd make it a ValueError or something like that
| Returns: | ||
| torch.Tensor: Samples from the local thetas | ||
| """ | ||
| deep_set = self.model.deep_set |
There was a problem hiding this comment.
I'm worried about this line. Not every model will have a deep_set option. Is there a way we can this up with a different model?
If we're importing the model class anyways, can we try to assume the model itself has a sample method we can work with?
|
|
||
| from deepdiagnostics.models.model import Model | ||
|
|
||
| # import sys |
|
|
||
| def _data_setup(self, **kwargs) -> DataDisplay: | ||
| gs = kwargs.pop("global_samples", self.global_samples) | ||
| gs = bool(gs) |
There was a problem hiding this comment.
Why not just use the self.global_samples option? This option will never be run without the init
| gs = bool(gs) | ||
|
|
||
| # support attribute or callable access | ||
| x = self.data.simulator_outcome() if callable(self.data.simulator_outcome) else self.data.simulator_outcome |
There was a problem hiding this comment.
Little confused by this. Why would the simulatulator outcome be a callable?
|
|
||
| true_samples[index] = self.data.thetas[sample, :] | ||
|
|
||
| # print shape of arrays |
| else: | ||
| parity_plot = subplots[theta_dimension] | ||
| subplots[0].set_ylabel("Parity") | ||
| print('theta_dimension', theta_dimension) |
There was a problem hiding this comment.
Reminder to remove printing here
|
|
||
| """ | ||
|
|
||
| def __init__(self, model, data, global_samples: bool = True, **kwargs): |
There was a problem hiding this comment.
include_residual and global samples should probably be kwargs for the plot method? The docstrings should the args for plot but not for init






This PR includes adding Hierarchy model functionalities i.e. reading in the data and model, plot the parity, CDFranks, and Rank plots.
The PR also includes the tests for these plots and they run without any error.