[R] naiveBayes question

David Meyer david.meyer at wu-wien.ac.at
Mon Jan 22 16:26:09 CET 2007


Aimin:

The problem is that the columns you choose for training (only 4 
variables) do not match the ones used for prediction (all except y).

David

----

I try to use naiveBayes

  > p.nb.90<-naiveBayes(y~aa_three+bas+bcu+aa_ss,data=training)
  > 
pr.nb.90<-table(predict(p.nb.90,training[,-13],type="class"),training[,13])

bur I get this error
Error in object$tables[[v]] : subscript out of bounds
  >
head is data set
  > head(training)
      pr aa_three aa_one aa_ss aa_pos    aas bas   ams bms        acu
bcu     omega       y index
1 1acx      ALA      A     C      1 127.71   0 69.99   0
-0.2498560   0  79.91470 outward  TRUE
2 1acx      PRO      P     C      2  68.55   0 55.44   0
-0.0949008   0  76.60380 outward  TRUE
3 1acx      ALA      A     E      3  52.72   0 47.82   0
-0.0396550   0  52.19970 outward  TRUE
4 1acx      PHE      F     E      4  22.62   0 31.21   0  0.1270330   0
169.52500  inward  TRUE
5 1acx      SER      S     E      5  71.32   0 52.84   0
-0.1312380   0   7.47528 outward  TRUE
6 1acx      VAL      V     E      6  12.92   0 22.40   0  0.1728390   0
149.09400  inward  TRUE

anyone know why?

Aimin



More information about the R-help mailing list