# Error while calculating metrics like AUC, ACC in R

I am trying to make predictions on my validation data using a decision tree model created with training data set. I am able to do that with success but, I am not able to calculate various metrics like Area under curve (AUC), and overall classification rate (ACC) using mmetric() command in R. Here is the screen shot with errors and commands that I used. Note: Right click the image and select view image to see it clearly. "t" is my training data set and "v" is validation data set.

Note: You can download my training data set "t" and validation data set "v" as a .csv files from here: Click here I used the same commands for a different data set and it worked perfectly, so could be this due to some problem with my data set.

Thanks,

P

-
what's dim(v)? Does v contain any missing data? –  Jonathan Christensen Dec 3 '12 at 23:37
Please post a reproducible example. You can create a toy dataset, or use one of the ones built into R (e.g. iris). –  Zach Dec 4 '12 at 1:55
@JonathanChristensen, I have updated the question as per ur needs. Regards, –  user16603 Dec 4 '12 at 22:27
@Zach this error is not reproducible for dataset that are in R-tool.(I mentioned that above!) this command works fine for iris data set. Regards –  user16603 Dec 4 '12 at 22:28
It is not clear to me whether you are having technical issues editing your questions or whether you are purposefully vandalizing them. If the latter, please stop. –  cardinal Dec 17 '12 at 0:57

You need to tell predict() to return classes and not probabilities:

vpredict=predict(tree,t,type="class")


The default for classification with predict.rpart() is to return a matrix with probabilities of each class. However, mmetric wants the classes.

(I also think people are having / have had difficulty helping because you did not include your data or information on the libraries your commands came from and you used a screenshot rather than text that people could copy and paste. Help us to help you! :-) )

-
First of all thank you very much!!! I shall keep your suggestion in mind while I post next time. The size of my data is so big that it would make my question a messed up crap if I pasted my data here thats why I didn't do that. Regards and have a nice weekend!!! –  user16603 Dec 8 '12 at 20:11
I have a request for you. Can you please have a look at my other questions here: tinyurl.com/clu6bve, tinyurl.com/d3m57vc. Thanks. –  user16603 Dec 8 '12 at 20:17