Learn R Programming

rtemis (version 0.79)

s.KNN: k-Nearest Neighbors Classification and Regression [C, R]

Description

Train a k-Nearest Neighbors learner for regression or classification using FNN

Usage

s.KNN(x, y = NULL, x.test = NULL, y.test = NULL, x.name = NULL,
  y.name = NULL, k = 3, algorithm = "kd_tree", print.plot = TRUE,
  plot.fitted = NULL, plot.predicted = NULL,
  plot.theme = getOption("rt.fit.theme", "lightgrid"), question = NULL,
  rtclass = NULL, verbose = TRUE, outdir = NULL,
  save.mod = ifelse(!is.null(outdir), TRUE, FALSE), ...)

Arguments

x

Numeric vector or matrix of features, i.e. independent variables

y

Numeric vector of outcome, i.e. dependent variable

x.test

(Optional) Numeric vector or matrix of validation set features must have set of columns as x

y.test

(Optional) Numeric vector of validation set outcomes

k

Integer: Number of neighbors considered

algorithm

String: Algorithm to use. Options: "kd_tree", "cover_tree", "brute"

outdir

Optional. Path to directory to save output

Value

Object of class rtMod

Details

Note: FNN's KNN does not have a predict function

See Also

elevate for external cross-validation

Other Supervised Learning: s.ADABOOST, s.ADDTREE, s.BART, s.BAYESGLM, s.BRUTO, s.C50, s.CART, s.CTREE, s.DA, s.ET, s.EVTREE, s.GAM.default, s.GAM.formula, s.GAMSEL, s.GAM, s.GBM3, s.GBM, s.GLMNET, s.GLM, s.GLS, s.H2ODL, s.H2OGBM, s.H2ORF, s.IRF, s.LDA, s.LM, s.MARS, s.MLRF, s.MXN, s.NBAYES, s.NLA, s.NLS, s.NW, s.POLYMARS, s.PPR, s.PPTREE, s.QDA, s.QRNN, s.RANGER, s.RFSRC, s.RF, s.SGD, s.SPLS, s.SVM, s.TFN, s.XGBLIN, s.XGB