[Rd] confusion() -- generic function in package mda -- generally useful?
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Wed, 14 Nov 2001 16:59:08 +0100
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._