0
$\begingroup$

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.

Thanks,

P

$\endgroup$
10
  • $\begingroup$ what's dim(v)? Does v contain any missing data? $\endgroup$ Commented Dec 3, 2012 at 23:37
  • $\begingroup$ Please post a reproducible example. You can create a toy dataset, or use one of the ones built into R (e.g. iris). $\endgroup$
    – Zach
    Commented Dec 4, 2012 at 1:55
  • $\begingroup$ @JonathanChristensen, I have updated the question as per ur needs. Regards, $\endgroup$
    – user16603
    Commented Dec 4, 2012 at 22:27
  • $\begingroup$ @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 $\endgroup$
    – user16603
    Commented Dec 4, 2012 at 22:28
  • 1
    $\begingroup$ 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. $\endgroup$
    – cardinal
    Commented Dec 17, 2012 at 0:57

1 Answer 1

1
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 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!!! $\endgroup$
    – user16603
    Commented Dec 8, 2012 at 20:11
  • $\begingroup$ I have a request for you. Can you please have a look at my other questions here: tinyurl.com/clu6bve, tinyurl.com/d3m57vc. Thanks. $\endgroup$
    – user16603
    Commented Dec 8, 2012 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.