NearestMeanClassifier: Nearest Mean Classifier

View source: R/NearestMeanClassifier.R

NearestMeanClassifierR Documentation

Nearest Mean Classifier

Description

Implementation of the nearest mean classifier modeled. Classes are modeled as gaussians with equal, spherical covariance matrices. The optimal covariance matrix and means for the classes are found using maximum likelihood, which, in this case, has a closed form solution. To get true nearest mean classification, set prior as a matrix with equal probability for all classes, i.e. matrix(0.5,2).

Usage

NearestMeanClassifier(X, y, prior = NULL, x_center = FALSE,
  scale = FALSE)

Arguments

X

matrix; Design matrix for labeled data

y

factor or integer vector; Label vector

prior

matrix; Class prior probabilities. If NULL, this will be estimated from the data

x_center

logical; Should the features be centered?

scale

logical; Should the features be normalized? (default: FALSE)

Value

S4 object of class LeastSquaresClassifier with the following slots:

modelform

weight vector

prior

the prior probabilities of the classes

mean

the estimates means of the classes

sigma

The estimated covariance matrix

classnames

a vector with the classnames for each of the classes

scaling

scaling object used to transform new observations

See Also

Other RSSL classifiers: EMLeastSquaresClassifier, EMLinearDiscriminantClassifier, GRFClassifier, ICLeastSquaresClassifier, ICLinearDiscriminantClassifier, KernelLeastSquaresClassifier, LaplacianKernelLeastSquaresClassifier(), LaplacianSVM, LeastSquaresClassifier, LinearDiscriminantClassifier, LinearSVM, LinearTSVM(), LogisticLossClassifier, LogisticRegression, MCLinearDiscriminantClassifier, MCNearestMeanClassifier, MCPLDA, MajorityClassClassifier, QuadraticDiscriminantClassifier, S4VM, SVM, SelfLearning, TSVM, USMLeastSquaresClassifier, WellSVM, svmlin()


RSSL documentation built on March 31, 2023, 7:27 p.m.