fnb.detect_distribution {fastNaiveBayes}R Documentation

Distribution Detection Function

Description

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

Usage

fnb.detect_distribution(x, nrows = nrow(x))

## Default S3 method:
fnb.detect_distribution(x, nrows = nrow(x))

Arguments

x

a numeric matrix, or a dgcMatrix

nrows

number of rows to use to detect distributions

Details

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

Value

A list of distribution names mapped to column names

Examples

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)

[Package fastNaiveBayes version 2.2.1 Index]