ApplyBayesTheorem4Likelihoods: ApplyBayesTheorem4Likelihoods

View source: R/ApplyBayesTheorem4Likelihoods.R

ApplyBayesTheorem4LikelihoodsR Documentation

ApplyBayesTheorem4Likelihoods

Description

Calculates the posteriors, for given likelihoods and priors using the Bayes Theorem

Usage

ApplyBayesTheorem4Likelihoods(Likelihoods,Priors,threshold=.Machine$double.eps*1000)

Arguments

Likelihoods

List of d numeric matrices, one per feature, each matrix with 1:k columns containing the distribution of class 1:k.

Priors

[1:k] Numeric vector with prior probability for each class.

threshold

(Optional: Default=0.00001).

Value

Posteriors

[1:n, 1:d] Numeric matrix with posterior probability according to the bayes theorem.

Author(s)

Michael Thrun

Examples

if(requireNamespace("FCPS")){
  data(Hepta)
  Data=Hepta$Data
  Cls=Hepta$Cls
  #parametric
  #V=Train_naiveBayes(Data,Cls,Gaussian=TRUE)
  #ClsTrain=V$ClsTrain
  #table(Cls,ClsTrain)
  
  #non-parametric
  V=Train_naiveBayes(Data,Cls,Gaussian=FALSE)
  ClsTrain=V$ClsTrain
  table(Cls,ClsTrain)
}

PDEnaiveBayes documentation built on Nov. 17, 2025, 5:07 p.m.