Skip to content

feature/laplace dynamic delta - #566

Merged
rhayes777 merged 4 commits into
masterfrom
feature/laplace_dynamic_delta
Jul 29, 2022
Merged

feature/laplace dynamic delta#566
rhayes777 merged 4 commits into
masterfrom
feature/laplace_dynamic_delta

Conversation

@rhayes777

Copy link
Copy Markdown
Collaborator

Better unifies the optimize function between Laplace and other optimisers.

This allows the delta computed from the number of shared factors for a given variable to be applied in the case of Laplace. It also illustrated the in the case of classical autofit optimisers a projection was applied to a factor then to the model; in the case of Laplace it only seems that projection is applied to the model. Classical optimisers now implement the same behaviour as Laplace.

else:
delta = self.delta

projection, status = factor_approx.project(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This projection step does not occur anymore. @matthewghgriffiths is this correct?

logger = logger.debug

def __init__(self, initial_values=None, deltas=None, inplace=False, delta=1):
def __init__(self, initial_values=None, deltas=None, inplace=False, delta=1, dynamic_delta=False):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the default optimiser would need to be passed with dynamic_delta=True explicitly. I'm tempted to make the default dynamic_delta=True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once I test this feature set properly I suspect we'll end up making it True by default.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense. I also need to look at incorporating it into the Laplace optimiser

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait that's what this PR does lol

@rhayes777
rhayes777 merged commit e47df98 into master Jul 29, 2022
@rhayes777
rhayes777 deleted the feature/laplace_dynamic_delta branch July 29, 2022 14:08
self.deltas = deltas or {}
self.dynamic_delta = dynamic_delta

def update_model_approx(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest deleting this method and merging functionality into EPOptimiser class

return new_approx, status

@abstractmethod
def optimise(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should have signature,

def optimise(
    self, factorApprox: FactorApproximation
) -> Tuple[FactorApproximation, Status]:

@matthewghgriffiths matthewghgriffiths left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finishing review

@matthewghgriffiths

Copy link
Copy Markdown
Collaborator

https://github.com/rhayes777/PyAutoFit/blob/74ab906da27001c3dca6a28b9b1ff619dc9edeb5/autofit/graphical/expectation_propagation/factor_optimiser.py#L61

exact_fit should be moved to be a FactorApproximation method but returning a new FactorApproximation object with the factor_dist or model_dist being updated as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants