Martin Maechler
2001-Nov-14 15:59 UTC
[Rd] confusion() -- generic function in package mda -- generally useful?
For a private package ("soon" to be on CRAN), I started looking at and thinking about the function confusion() from the mda package and wondered if it wouldn't make sense to provide the generic function in base R and also think about making the default for the `true' argument equal to fitted(object). One could write methods for confusion() for almost all classifiers which would be a nice universal approach. Also, the value (a confusion matrix contingency table with some "useful" attributes) could be made a bit more explicit. Good or not so good idea? alternatives? Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><>> Confusion Matrices >> >> Description: >> >> Compute the confusion matrix between two factors, or for an fda or >> mda object. >> >> Usage: >> >> confusion(object, true, ...) >> confusion(object, data, ...) >> >> Arguments: >> >> object: the predicted factor, or an fda or mda model object. >> >> true: the true factor. >> >> data: a data frame (list) containing the test data. >> >> ...: further arguments to be passed to or from methods. >> >> Details: >> >> This is a generic function. >> >> Value: >> >> For the default method essentially `table(object, true)', but with >> some useful attribute(s). >> >> See Also: >> >> `fda', `predict.fda' >> >> Examples: >> >> data(iris) >> irisfit <- fda(Species ~ ., data = iris) >> confusion(predict(irisfit, iris), iris$Species) >> ## Setosa Versicolor Virginica >> ## Setosa 50 0 0 >> ## Versicolor 0 48 1 >> ## Virginica 0 2 49 >> ## attr(, "error"): >> ## [1] 0.02-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Kurt Hornik
2001-Nov-20 18:44 UTC
[Rd] Re: confusion() -- generic function in package mda -- generally useful?
>>>>> Martin Maechler writes:> For a private package ("soon" to be on CRAN),> I started looking at and thinking about the function confusion() from > the mda package and wondered if it wouldn't make sense to provide the > generic function in base R and also think about making the default for > the `true' argument equal to fitted(object).> One could write methods for confusion() for almost all classifiers > which would be a nice universal approach. Also, the value (a > confusion matrix contingency table with some "useful" attributes) > could be made a bit more explicit.> Good or not so good idea? alternatives?I think it would be nice to unify some of the existing code for classification, e.g. the types in the predict methods. Re confusion(), what would this do exactly? The stuff in mda does too much as exemplified by \method{confusion}{default}(object, true, \dots) \method{confusion}{fda}(object, data, \dots) so the default and fda methods have surprising arguments ...? (I think you only want the versions for fitted model objects.) -k -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._