lundi 1 février 2016

R Code to find out the highest probability for 7 different matrix

I am newbie to "R" and trying to build a prediction model using MAP, but I am stuck at the below step.

I have the following code:

VProbability <- getProbability(test.chars,V.pMatrix)
IProbability <- getProbability(test.chars,I.pMatrix)
BProbability <- getProbability(test.chars,B.pMatrix)
GProbability <- getProbability(test.chars,G.pMatrix)
YProbability <- getProbability(test.chars,Y.pMatrix)
OProbability <- getProbability(test.chars,O.pMatrix)
RProbability <- getProbability(test.chars,R.pMatrix)

I would like to classify based on the highest probability number I have from the above list.

For two categories: I use below code & it works fine.

classified<c(classified,ifelse(VProbability>YProbability,"Violet","yellow")
View(cbind(classified,test$Color))

How do I compare between the 7 different categories and categorize based on the probability with similar output?

Any help appreciated

Aucun commentaire:

Enregistrer un commentaire