Skip to content

caiohamamura/tabularMLC

Repository files navigation

Tabular Maximum Likelihood Classifier

The maximum likelihood classifier (MLC) is one of the most common classifiers used for remote sensing imagery.

Maximum likelihood classifier, also known as Gaussian Discriminant Analysis (GDA) is based on the joint distribution gaussian distribution for the set of predictors.

The most common implementation, like in this package, will assume joint normal distributed variables within classes, and calculate the sample distances, based on Mahalanobis distance.

This package uses 'RcppArmadillo' to provide a fast and efficient implementation of the MLC to train and predict over tabular data (data.frame).

The algorithms were based on Mather (1985) doi:10.1080/01431168508948456 method.

Example

data(iris)
n = length(iris$Species)

set.seed(42)
# Split training by 70% holdout
training = sample(1:n, size=n*0.7)
validation = (1:n)[-training]

# Train model with training dataset
mlcModel = MLC(Species ~ ., iris[training,])

# Predict using validation dataset
predict = predict(mlcModel, iris[validation,])

# Print confusion matrix
confusionMatrix = table(predicted=predict, observed=iris$Species[validation])
print(confusionMatrix)

#            observed
# predicted    setosa versicolor virginica
#   setosa         12          0         0
#   versicolor      0         14         1
#   virginica       0          1        17
#

About

R package for tabular maximum likelihood classifier

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors