Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/nimble/R/Laplace.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ buildOneAGHQuad1D <- nimbleFunction(
## transMethod <<- gridType
## }
if(replace_optimControl) {
optimControl$fnscale <- -1
optimControl_ <<- optimControl
}
},
Expand Down Expand Up @@ -1163,6 +1164,7 @@ buildOneAGHQuad <- nimbleFunction(
transMethod <<- gridType
}
if(replace_optimControl) {
optimControl$fnscale <- -1
optimControl_ <<- optimControl
}
},
Expand Down
8 changes: 4 additions & 4 deletions packages/nimble/R/MCMC_configuration.R
Original file line number Diff line number Diff line change
Expand Up @@ -788,16 +788,16 @@ For internal use only
'
if(!allowData && !allowData_global) {
if(all(model$isData(targetOne))) {
messageIfVerbose(paste0(' [Note] Samplers not added to data node: ', paste0(targetOne, collapse = ', '), '.'))
messageIfVerbose(paste0(' Provide argument allowData = TRUE to addSampler method, to force sampler assignment.'))
messageIfVerbose(' [Note] Samplers not added to data node: `', paste0(targetOne, collapse = '`, `'), '`.\n',
' Provide argument `allowData = TRUE` to `addSampler` method, to force sampler assignment.')
return()
}
if(any(model$isData(targetOne))) {
targetWithSomeData <- model$expandNodeNames(targetOne)
targetOne <- filterOutDataNodes(targetOne) ## this is the salient step of this entire block
targetDataComponents <- setdiff(targetWithSomeData, targetOne)
messageIfVerbose(paste0(' [Note] Samplers not added to data node: ', paste0(targetDataComponents, collapse = ', '), '.'))
messageIfVerbose(paste0(' Provide argument allowData = TRUE to addSampler method, to force sampler assignment.'))
messageIfVerbose(' [Note] Samplers not added to data node: `', paste0(targetDataComponents, collapse = '`, `'), '`.\n',
' Provide argument `allowData = TRUE` to `addSampler` method, to force sampler assignment.')
}
}
newInd <- length(samplerConfs) + 1
Expand Down
8 changes: 4 additions & 4 deletions packages/nimble/R/nimbleFunction_Rexecution.R
Original file line number Diff line number Diff line change
Expand Up @@ -1497,15 +1497,15 @@ nimOptimDefaultControl <- function() {
control <- optimControlNimbleList$new()
control$trace <- 0
control$fnscale <- 1
control$parscale <- NA # Must be filled in to length of par
control$ndeps <- NA # Ditto
control$maxit <- NA ## The default value depends on method.
control$parscale <- as.numeric(NA) # Must be filled in to length of par
control$ndeps <- as.numeric(NA) # Ditto
control$maxit <- as.integer(NA) ## The default value depends on method.
control$abstol = -Inf
control$reltol <- sqrt(.Machine$double.eps)
control$alpha <- 1.0
control$beta <- 0.5
control$gamma <- 2.0
control$REPORT <- NA # Method dependent and not used in compiled version
control$REPORT <- as.integer(NA) # Method dependent and not used in compiled version
control$type <- 1
control$lmm <- 5
control$factr <- 1e7
Expand Down
4 changes: 2 additions & 2 deletions packages/nimble/inst/CppCode/nimOptim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ nimSmartPtr<OptimResultNimbleList> NimOptimProblem::solve(
result->hessian.initialize(NA_REAL, true, n, n);
}


// Parameters common to all methods.
double* dpar = par.getPtr();
double* X = result->par.getPtr();
Expand Down Expand Up @@ -248,7 +249,7 @@ nimSmartPtr<OptimResultNimbleList> NimOptimProblem::solve(
SEXP Scontrol = PROTECT(Rf_allocVector(VECSXP, 6));
SET_VECTOR_ELT(Scontrol, 0, PROTECT(double_2_SEXP(control_->abstol)));
SET_VECTOR_ELT(Scontrol, 1, PROTECT(double_2_SEXP(control_->reltol)));
SET_VECTOR_ELT(Scontrol, 2, PROTECT(int_2_SEXP(control_->maxit)));
SET_VECTOR_ELT(Scontrol, 2, PROTECT(int_2_SEXP(working_maxit)));
SET_VECTOR_ELT(Scontrol, 3, PROTECT(NimArr_2_SEXP<1>(working_parscale)));
SET_VECTOR_ELT(Scontrol, 4, PROTECT(double_2_SEXP(control_->fnscale)));
SET_VECTOR_ELT(Scontrol, 5, PROTECT(int_2_SEXP(control_->trace)));
Expand Down Expand Up @@ -321,7 +322,6 @@ nimSmartPtr<OptimResultNimbleList> NimOptimProblem::solve(
// NIMERROR("Unknown method_: %s", method_.c_str());
//}
result->value *= control_->fnscale;

// Compute Hessian.
// Parameters are still on the optimization scale,
// i.e. divided by parscale
Expand Down
Loading