Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. mmetric

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.



share|improve this question
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
up vote 1 down vote accepted

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


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! :-) )

share|improve this answer
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:, Thanks. – user16603 Dec 8 '12 at 20:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.