fnb.detect_distribution: Distribution Detection Function

Description Usage Arguments Details Value Examples

View source: R/fnb.detect_distribution.R

Description

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

Usage

1
2
3
4
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

 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)

fastNaiveBayes documentation built on May 4, 2020, 5:09 p.m.