You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case this is of interest, I stumbled upon an implementation of kernel regression in one dimension that offers significant speed improvements and scalability compared to npreg (and this is an understatement). The package is called FKSUM (an interesting name choice), and you can find a link to it here.
Below is the SuperLearner wrapper I have been using. I used the Nadaraya-Watson implementation, but `fk_regression' also supports local linear regression, which may be a better option.
SL.fastkernel <- function (Y, X, newX, family = gaussian(), obsWeights = rep(1,
length(Y)), rangeThresh = 1e-07, ...)
{
X <- as.matrix(X)
newX <- as.matrix(newX)
if(ncol(X) > 1) {
stop("Univariate X kernel smooths only.")
}
fit <- FKSUM::fk_regression(X, Y, type = 'NW')
pred <- predict(fit, xtest = newX)
fit <- list(object = fit)
class(fit) <- "SL.fastkernel"
out <- list(pred = pred, fit = fit)
return(out)
}
predict.SL.fastkernel <- function (object, newdata, ...)
{
pred <- predict(object, xtest = as.matrix(newdata))
return(pred)
}
The text was updated successfully, but these errors were encountered:
In case this is of interest, I stumbled upon an implementation of kernel regression in one dimension that offers significant speed improvements and scalability compared to npreg (and this is an understatement). The package is called FKSUM (an interesting name choice), and you can find a link to it here.
Below is the SuperLearner wrapper I have been using. I used the Nadaraya-Watson implementation, but `fk_regression' also supports local linear regression, which may be a better option.
The text was updated successfully, but these errors were encountered: