Learn R Programming

fastNaiveBayes (version 1.1.2)

fastNaiveBayes.detect_distribution: Distribution Detection Function

Description

Determines which distribution to use for which columns in the matrix based on a set of rules.

Usage

fastNaiveBayes.detect_distribution(x, nrows = 10)

# S3 method for default fastNaiveBayes.detect_distribution(x, nrows = 10)

Arguments

x

a numeric matrix, or a dgcMatrix

nrows

number of rows to use to detect distributions

...

Not used.

Value

A list of distribution names mapped to column names

Details

A simple utility function to detect the distribution to use for each columns

Examples

Run this code
# NOT RUN {
rm(list = ls())
library(fastNaiveBayes)
cars <- mtcars
y <- as.factor(ifelse(cars$mpg > 25, "High", "Low"))
x <- cars[, 2:ncol(cars)]

# Uses default of top 10 rows to determine distributions
dist <- fastNaiveBayes.detect_distribution(x)
print(dist)

# Uses all rows of x to determine distributions
dist <- fastNaiveBayes.detect_distribution(x, nrows = nrow(x))
print(dist)
# }

Run the code above in your browser using DataLab