knn.distance.features <- function(preProcess = c("center", "scale", "zv"),
description = NULL, ...)
{
library(featureExtraction)
library(caret)
function()
{
model.name <- "knn.distance.features"
model_ <- NULL
preProcess_ <- NULL
train_ <- function(X_train, y)
{
if(is.null(preProcess) == FALSE)
{
preProcess_ <<- caret::preProcess(X_train, method = preProcess)
X_train <- predict(preProcess_, X_train)
}
model_ <<- knn.dist.features(X_train, y, ...)
invisible()
}
predict_ <- function(X_test)
{
if(is.null(preProcess_) == FALSE)
{
X_test <- predict(preProcess_, X_test)
}
features <- predict(model_, X_test)
features
}
list(
train_ = train_,
predict_ = predict_,
name = model.name,
description = description
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.