-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 8/5/13 1:00 PM, Anindya Sankar Dey wrote: > Hi All, > > I applied the naiveBayes function in e1071 package with the iris > data, and here's the list that was created > > structure(list(apriori = structure(c(50L, 50L, 50L), .Dim = 3L, > .Dimnames = structure(list( Y = c("setosa", "versicolor", > "virginica")), .Names = "Y"), class = "table"), tables = > structure(list(Sepal.Length = structure(c(5.006, 5.936, 6.588, > 0.352489687213451, 0.516171147063863, 0.635879593274432 ), .Dim = > c(3L, 2L), .Dimnames = structure(list(Y = c("setosa", > "versicolor", "virginica"), Sepal.Length = NULL), .Names = c("Y", > "Sepal.Length"))), Sepal.Width = structure(c(3.428, 2.77, 2.974, > 0.379064369096289, 0.313798323378411, 0.322496638172637 ), .Dim = > c(3L, 2L), .Dimnames = structure(list(Y = c("setosa", > "versicolor", "virginica"), Sepal.Width = NULL), .Names = c("Y", > "Sepal.Width"))), Petal.Length = structure(c(1.462, 4.26, 5.552, > 0.173663996480184, 0.469910977239958, 0.551894695663983 ), .Dim = > c(3L, 2L), .Dimnames = structure(list(Y = c("setosa", > "versicolor", "virginica"), Petal.Length = NULL), .Names = c("Y", > "Petal.Length"))), Petal.Width = structure(c(0.246, 1.326, 2.026, > 0.105385589380046, 0.197752680004544, 0.274650055636667 ), .Dim = > c(3L, 2L), .Dimnames = structure(list(Y = c("setosa", > "versicolor", "virginica"), Petal.Width = NULL), .Names = c("Y", > "Petal.Width")))), .Names = c("Sepal.Length", "Sepal.Width", > "Petal.Length", "Petal.Width")), levels = c("setosa", "versicolor", > "virginica"), call = quote(naiveBayes.default(x = X, y = Y, laplace > = laplace))), .Names = c("apriori", "tables", "levels", "call"), > class = "naiveBayes") > > > I'm unable to understand that the first element of the list should > be a vector like (50,50,50) but its correctly showing > (0.33,0.33,0.33). > > Can anyone tell me which part of the code is doing this? >
It is the function print.naiveBayes in naiveBayes.R of the e1071 package. Line 89 in my version of the file. Best, Bart -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.19 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJR/5uLAAoJEKkUzIFxkHoM2wkH+gJymhP2lk8HFLi/tIEYvLD2 eNKQw83Ciyi5woEPQU8NS/faPcSnu3W6ohf73jHL9CtpDEp925BRhGKzkZsZm6fa Kme6jMMSTjEXmCyHTEe0voWc8W2YgDCAVoKz7gMmLa+VMXnJgBlc76Eljzz98/1Y 88CGFMgMMlj5lfv47cn+s04wWuNfnx3Imb6+3x5lWqve61whTUylHsOMy5Iet5CY uMHhBykNPiPEWvMdhrR9iNSwKHIPSW5J+obUla+IdynOR1gDGncvu2wFAFUgx73z xRGzAofrGZHQpZm+9lpFgDTcSnq+Z6mvz+mxXthXBdKD8vUr4j9AIyShudzfFck= =sAqq -----END PGP SIGNATURE----- ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.