Commit 523e640c authored by luroth's avatar luroth
Browse files

spline performance optimization

parent 4d0a1132
...@@ -72,15 +72,15 @@ fit_scam_spline_weights <- function(x, y, w, k = NA, bs = "mpi", label = NULL, o ...@@ -72,15 +72,15 @@ fit_scam_spline_weights <- function(x, y, w, k = NA, bs = "mpi", label = NULL, o
if (is.null(spline)) { if (is.null(spline)) {
print("decreasing k") print("decreasing k")
try( try(
spline <- R.utils::withTimeout(scam(y ~ s(as.numeric(x), k = k - 1, bs = bs), weights = w), timeout=0.5) spline <- R.utils::withTimeout(scam(y ~ s(as.numeric(x), k = k - 1, bs = bs), optimizer = optimizer, weights = w), timeout=0.3)
) )
if (is.null(spline)) { if (is.null(spline)) {
print("2. time decreasing k") print("2. time decreasing k")
try( try(
spline <- R.utils::withTimeout(scam(y ~ s(as.numeric(x), k = k - 2, bs = bs), weights = w), timeout=1) spline <- R.utils::withTimeout(scam(y ~ s(as.numeric(x), k = k - 2, bs = bs), optimizer = optimizer, weights = w), timeout=0.3)
) )
if (is.null(spline)) { if (is.null(spline)) {
spline <- scam(y ~ s(as.numeric(x), k = k - 1, bs = bs)) spline <- scam(y ~ s(as.numeric(x), k = 8, bs = bs), optimizer = optimizer)
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment