Description Usage Arguments Value Slots Author(s) References Examples
SpNaBaProbs is used to store probability information of the Naive Bayes model.
1 | SpNaBaProbs(Pc, Px, Pc.x, Px.c, Px.nc, ...)
|
Pc |
numeric |
Px |
numeric |
Pc.x |
numeric |
Px.c |
numeric |
Px.nc |
numeric |
... |
argument pass to other methods. |
An object of class SpNaBaProbs
. See slot section for more details.
Pc
numeric vector
. It contains the marginal probabilities of the
target variables declared in the NaBa model.
Px
numeric vector
. It contains the marginal probabilities of the
predictor variables declared in the NaBa model.
Pc.x
numeric matrix
. Each element represents the condicional
probability P(c|x). The sufix c.x
implies that the rows of this
matrix represents the target variables (c) and the columns represents the
predictors variables (x) declared in the Naive Bayes model.
Px.c
numeric matrix
. Each element represents the condicional
probability P(x|c). The sufix x.c
implies that the rows of this
matrix represents the predictors variables (x) and the columns represents
the target variables (c) declared in the Naive Bayes model.
Px.nc
numeric matrix
. Each element represents the condicional
probability P(x|c'). The sufix x.nc
implies that the rows of this
matrix represents the predictors variables (x) and the columns represents
the complement of the target variables (c') declared in the Naive Bayes
model.
Enrique Del Callejo Canal (edelcallejoc@gmail.com), based on implemented algortihms in web platform SPECIES (see References).
http://species.conabio.gob.mx/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Using SpNaBaMatrix constructor ----------------------
a <- matrix(rbinom(100, 100, runif(100, 0, 0.1)), nrow = 10, ncol = 10,
dimnames = list(paste0("id:", 1:10), letters[1:10]))
x.mat <- SpNaBaMatrix(freqmatrix = a)
# Counts calculation ----------------------------------
x.counts <- counts(x.mat)
# Probability calculation -----------------------------
x.probs <- probs(x.counts)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.