naiveBayes_likelihood: Naive Bayes likelihood

View source: R/naiveBayes.R

naiveBayes_likelihoodR Documentation

Naive Bayes likelihood

Description

Internal soundgen function

Usage

naiveBayes_likelihood(
  d,
  nObs = nrow(d),
  mod_train,
  class_names,
  nClasses = length(class_names),
  like_names,
  predictors,
  nPredictors = length(predictors)
)

Arguments

d

dataframe containing the observations

nObs

the number of observations

mod_train

the output of naiveBayes_train()

class_names

names of outcome classes

nClasses

the number of outcome classes

like_names

the names of variables holding likelihoods

predictors

the names of predictor variables

nPredictors

the number of predicto variables

Details

A Helper function called by naiveBayes to calculate the likelihood of each observation. Algorithm: for each predictor and class, the likelihood is dnorm(observation, mean_per_class, sd_per_class). I tried non-Gaussian probability distributions (Student's t to accommodate outliers), but Gaussian actually seems to be more robust.


soundgen documentation built on Sept. 12, 2024, 6:29 a.m.