-
Notifications
You must be signed in to change notification settings - Fork 48
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
Define StructType for OptSummary #506
Conversation
Codecov Report
@@ Coverage Diff @@
## main #506 +/- ##
==========================================
+ Coverage 93.98% 94.02% +0.03%
==========================================
Files 26 26
Lines 2162 2191 +29
==========================================
+ Hits 2032 2060 +28
- Misses 130 131 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we define a stable serialization format and a stable set of properties, we might consider making the set of fields an implementation detail, in which case a lot of the breaking optimizations we've done lately would no longer be breaking.
@@ -110,3 +110,6 @@ function NLopt.Opt(optsum::OptSummary) | |||
end | |||
opt | |||
end | |||
|
|||
StructTypes.StructType(::Type{<:OptSummary}) = StructTypes.Mutable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since OptSummary
is a concrete type, there can't be subtypes and the subtype operator can't really do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subtype operator is necessary because OptSummary
is a parametric type. The concrete types are OptSummary{Float64}
, etc. I had drafted an issue on whether it makes sense to continue to have OptSummary
be a parametric type - it is closely tied to the NLopt
package for which the only floating point type that can be used is Float64
- but I didn't post it.
Anyway, the choices are to use the subtype operator here or to remove the parameter for OptSummary
and I chose to keep the parameter. It's a house of cards in a way - if we remove the parameter on OptSummary
we might as well remove it everywhere. I think it is better to retain the redundant parameter on OptSummary
and modify that struct if we decide to incorporate other optimizers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah I had forgotten that OptSummary
is parametric. I think it's worth keeping around the type parameter. On my long list of dream projects is changing the internals to take advantage of MathOptInterface
, which I think NLopt finally supports. Then we could trivially support additional optimizers.
@palday I plan to add a save/restore pair and have been thinking about what to call them. I am leaning toward signatures like |
I don't have a better idea for names right now (and I think we should probably avoid using But: the restore function needs a bang, doesn't it (like |
@palday Agree that the name of the restore function should end with |
I'm not sure that I am being sufficiently paranoid about the tests built into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thoughts for future PRs:
- GLMM. I think it actually should be pretty easy to do.
- using the same logic here to update a model to have the fit from a particular bootstrap iteration
- serializing bootstrap this way
(Future PRs because I suspect the devil is in the details for all of those.)
Co-authored-by: Phillip Alday <[email protected]>
StructTypes
andJSON3
StructType
andexcludes
forOptSummary