powered by
A function that predicts the class of points based on the nearest centroid
# S3 method for nearestCentroid predict(object, X, ...)
An object of class nearestCentroid, with the following attributes:
nearestCentroid
centroids[K, d] the centroids of each class with K classes in d dimensions.
[K, d]
K
d
ylabs[K] the ylabels for each of the K unique classes, ordered.
[K]
priors[K] the priors for each of the K classes.
[n, d] the data to classify with n samples in d dimensions.
[n, d]
n
optional args.
Yhat [n] the predicted class of each of the n data point in X.
[n]
X
For more details see the help vignette: vignette("centroid", package = "lolR")
vignette("centroid", package = "lolR")
# NOT RUN { library(lolR) data <- lol.sims.rtrunk(n=200, d=30) # 200 examples of 30 dimensions X <- data$X; Y <- data$Y model <- lol.classify.nearestCentroid(X, Y) Yh <- predict(model, X) # }
Run the code above in your browser using DataLab