@@ -30,7 +30,6 @@ function MixedModels.optimize!(m::LinearMixedModel, ::PRIMABackend; progress::Bo
3030 fitlog = optsum. fitlog
3131
3232 function obj (x)
33- isempty (g) || throw (ArgumentError (" g should be empty for this objective" ))
3433 iter += 1
3534 val = if isone (iter) && x == optsum. initial
3635 optsum. finitial
@@ -52,25 +51,11 @@ function MixedModels.optimize!(m::LinearMixedModel, ::PRIMABackend; progress::Bo
5251 return val
5352 end
5453
55- try
56- # use explicit evaluation w/o calling opt to avoid confusing iteration count
57- optsum. finitial = objective! (m, optsum. initial)
58- catch ex
59- ex isa PosDefException || rethrow ()
60- # give it one more try with a massive change in scaling
61- @info " Initial objective evaluation failed, rescaling initial guess and trying again."
62- @warn """ Failure of the initial evaluation is often indicative of a model specification
63- that is not well supported by the data and/or a poorly scaled model.
64- """
65- optsum. initial ./=
66- (isempty (m. sqrtwts) ? 1.0 : maximum (m. sqrtwts)^ 2 ) *
67- maximum (response (m))
68- optsum. finitial = objective! (m, optsum. initial)
69- end
7054 empty! (fitlog)
7155 push! (fitlog, (copy (optsum. initial), optsum. finitial))
56+ maxfun = optsum. maxfeval > 0 ? optsum. maxfeval : 500 * length (optsum. initial)
7257 info = prima_optimizer! (Val (optsum. optimizer), obj, optsum. final;
73- xl= optsum. lowerbd, maxfun= optsum . maxfeval ,
58+ xl= optsum. lowerbd, maxfun,
7459 optsum. rhoend, optsum. rhobeg)
7560 ProgressMeter. finish! (prog)
7661 optsum. feval = info. nf
0 commit comments