Skip to content

example cleanup, fixing access to properties#23

Merged
domfournier merged 1 commit into
MiraGeoscience:refactor/regularizationfrom
thibaut-kobold:ta/refactor_regularization
Jul 28, 2022
Merged

example cleanup, fixing access to properties#23
domfournier merged 1 commit into
MiraGeoscience:refactor/regularizationfrom
thibaut-kobold:ta/refactor_regularization

Conversation

@thibaut-kobold
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@domfournier domfournier left a comment

Choose a reason for hiding this comment

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

Great, thanks for this. One question below, and we merge this in.

self.approx_hessian = approx_hessian
self.non_linear_relationships = non_linear_relationships
self.gmm = gmm
self._gmm = copy.deepcopy(gmm)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we do some checks on what the input is? Hence using the setter that does the copy as well?

Copy link
Copy Markdown
Author

@thibaut-kobold thibaut-kobold Jul 28, 2022

Choose a reason for hiding this comment

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

We could, what do you have in mind?

Some thoughts / insights:

Admittedly, this option is not often use. Its main goal is to be able to restart a PGI where the GMM is being learnt (thus the difference between the reference GMM and the GMM model). gmmref is really the most important here.

The reason I do the deepcopy is that (remembering things from several years ago) I was having issues when pointing to the original object, so it was best to have only internal to the regularization (plus, it is potentially getting modified every iteration, something that the GMM class was not originally designed for, thus the creation of a new object that overwrite the previous).

Copy link
Copy Markdown

@domfournier domfournier Jul 28, 2022

Choose a reason for hiding this comment

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

Yep for sure. I just think we should check for at least the type and shape of the input to make sure the code can fail fast with a nice message if the input doesn't make sense. We should probably do some typing of the return value as well. I don't even know myself what the input/output looks like.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

gmm is an object of class "WeightedGaussianMixture" (or one of its children class). We would need to have a validate method somewhere then.
We can think of something. This is a very quick first pass. I just checked that tests and examples were running. Up to you if you want me to have all in a single PR or if you want to merge this one and I create others as I go.

@domfournier domfournier merged commit fe7ab76 into MiraGeoscience:refactor/regularization Jul 28, 2022
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.

2 participants