- function(dataHO, targetHO, param) {
- require(class)
- function(X) class::knn(dataHO, X, cl=targetHO, k=param)
+ if (task == "classification") {
+ function(dataHO, targetHO, param) {
+ require(class)
+ function(X) class::knn(dataHO, X, cl=targetHO, k=param)
+ }
+ }
+ else {
+ function(dataHO, targetHO, param) {
+ require(FNN)
+ function(X) FNN::knn.reg(dataHO, X, y=targetHO, k=param)$pred
+ }