View source: R/DiscreteLearning.R
probDiscreteVariable | R Documentation |
Compute the probabilities of a discrete variable from a dataset.
probDiscreteVariable(stateNames, Variable)
stateNames |
A |
Variable |
A |
A list of "numeric"
arrays:
coeff |
Contains the probabilities. |
sizeDataLeaf |
Number of records in each leaf of the discrete tree. |
discreteVariablesStates
## Discrete Variable
data <- data.frame(X=rep(c("yes", "no", "maybe"), 500))
data <- discreteVariables_as.character(data, "X")
n <- nrow(data)
## Probabilities
s <- discreteVariablesStates(namevariables="X", discreteData=data)
states <- s[[1]]$states
p <- probDiscreteVariable(stateNames=states, Variable=data$X)
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.