Skip to content
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

More sophisticated checks in restoreoptsum. #775

Merged
merged 11 commits into from
Jun 27, 2024
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
MixedModels v4.25.1 Release Notes
==============================
- Use more sophisticated checks on property names in `restoreoptsum` to allow for optsums saved by pre-v4.25 versions to be used with this version and later.

MixedModels v4.25 Release Notes
==============================
- Add type notations in `pwrss(::LinearMixedModel)` and `logdet(::LinearMixedModel)` to enhance type inference. [#773]
Expand Down Expand Up @@ -538,3 +542,4 @@ Package dependencies
[#769]: https://github.com/JuliaStats/MixedModels.jl/issues/769
[#772]: https://github.com/JuliaStats/MixedModels.jl/issues/772
[#773]: https://github.com/JuliaStats/MixedModels.jl/issues/773
[#774]: https://github.com/JuliaStats/MixedModels.jl/issues/774
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MixedModels"
uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316"
author = ["Phillip Alday <[email protected]>", "Douglas Bates <[email protected]>", "Jose Bayoan Santiago Calderon <[email protected]>"]
version = "4.25.0"
version = "4.25.1"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down
20 changes: 15 additions & 5 deletions src/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@
) where {T}
dict = JSON3.read(io)
ops = m.optsum
okay =
(setdiff(propertynames(ops), keys(dict)) == [:lowerbd]) &&
all(ops.lowerbd .≤ dict.initial) &&
all(ops.lowerbd .≤ dict.final)
if !okay
nmdiff = setdiff(
propertynames(ops), # names in freshly created optsum
union!( # names in saved optsum plus those we allow to be missing
Set(keys(dict)),
(
:lowerbd, # never saved, -Inf not allowed in JSON
:xtol_zero_abs, # added in v4.25.0
:ftol_zero_abs, # added in v4.25.0
)
)
dmbates marked this conversation as resolved.
Show resolved Hide resolved
)
if !isempty(nmdiff)
throw(ArgumentError("optsum names:", nmdiff, " not found in io"))

Check warning on line 25 in src/serialization.jl

View check run for this annotation

Codecov / codecov/patch

src/serialization.jl#L25

Added line #L25 was not covered by tests
end
if any(ops.lowerbd .> dict.initial) || any(ops.lowerbd .> dict.final)
throw(ArgumentError("initial or final parameters in io do not satisfy lowerbd"))
end
for fld in (:feval, :finitial, :fmin, :ftol_rel, :ftol_abs, :maxfeval, :nAGQ, :REML)
Expand Down
Loading