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

optimizer = "bfgs" causes segfault in GCV lambda selection #2

Open
AlePalu opened this issue Dec 1, 2023 · 0 comments
Open

optimizer = "bfgs" causes segfault in GCV lambda selection #2

AlePalu opened this issue Dec 1, 2023 · 0 comments

Comments

@AlePalu
Copy link
Member

AlePalu commented Dec 1, 2023

When using BFGS as optimization method, the R wrapper crashes with cause 'memory not mapped'

MWE

data("unit_square", package = "fdaPDE2")
unit_square <- Mesh(unit_square)
df <- ## some data...

model <- SRPDE(y ~ f, domain = unit_square, data = df)
## fit with BFGS optimization
model$fit(lambda = gcv(
    optimizer = "bfgs",
    lambda = 1e-4,
    step = 1e-6
))

The problem is releated to the R wrapper, as performing a BFGS optimization of the GCV from the C++ layer does not cause any segfault.

You can reproduce the test gcv_srpde_newton_test, laplacian_nonparametric_samplingatnodes_newton_fd_exact with BFGS in place of Netwon, and obtain the correct result using a wolfe line search approach for the adaptive step.

auto GCV = model.gcv<ExactEDF>();
GCV.set_step(4e-08);
// optimize GCV
BFGS<fdapde::Dynamic> opt(10, 0.05, 1);
DVector<double> pt = SVector<1>(6.25e-06);
opt.optimize(GCV, pt, WolfeLineSearch());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant