Determines which distribution to use for which columns in the matrix based on a set of rules.
1 2 3 4
a numeric matrix, or a dgcMatrix
number of rows to use to detect distributions
A simple utility function to detect the distribution to use for each columns
A list of distribution names mapped to column names
1 2 3 4 5 6 7 8 9 10 11 12 13 14
rm(list = ls()) library(fastNaiveBayes) cars <- mtcars y <- as.factor(ifelse(cars$mpg > 25, "High", "Low")) x <- cars[, 2:ncol(cars)] # Uses default of all rows to determine distributions dist <- fnb.detect_distribution(x) print(dist) # Uses top 10 rows of x to determine distributions. If top 10 rows # are representative this is can be much faster. dist <- fnb.detect_distribution(x, nrows = 10) print(dist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.