Displaying 3 results from an estimated 3 matches for "classcol".
2012 Feb 02
1
knncat broken on R 2.14?
...It seems to just predict everything to be class "0".
3. I can see this problem even when running the example
script under ?knncat.
Given example from ?knncat, and expected behavior:
=======================
library(knncat)
library(MASS) # Load data set
syncat <- knncat (synth.tr, classcol=3)
## Not run: syncat
Train set misclass rate: 12.8
synpred <- predict (syncat, synth.tr, synth.te,
train.classcol=3,
newdata.classcol=3)
table (synpred, synth.te$yc)
synpred 0 1
0 460 91
1 40 409
=======================
Actual behavior:
=============...
2007 Mar 12
1
knncat question
I use knncat to make a predictive model
and get misclass rate
> knncat.m<-knncat(training.new,k=c(10,20),classcol=5)
> knncat.m
Training set misclass rate: 36.88%
then I try to calculate prediction accuracy by the following:
> pr.knncat.train <- predict
(knncat.m,training.new,training.new,train.classcol=5,newdata.classcol=5)
> tb.knncat.train <-table (pr.knncat.train, training.new$y)
>...
2009 Oct 19
1
Convert data frame entries to numbers
Hello,
I figure this is quite a simple problem really, but since I'm quite
new to R I need to ask:
If I have a data frame:
str(test) :
$ classcol: Factor w/ 3 levels "1","2","3"
How do I convert the entries in this column to numbers. I.e., I want
to be abl to do simple calculations like test[1,the_column] - test
[2,the_column] without errors.
as.numeric(test) yeilds the error "object cannot be coerced to...