Skip to content

johnmyleswhite/NaiveBayes.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NaiveBayes.jl

NOTICE

This package is unmaintained. Its reliability is not guaranteed.

Introduction

The Gaussian Naive Bayes model:

include("naive_bayes.jl")
include("bernoulli_nb.jl")

d = GaussianNaiveBayes([0.0 10.0;
	                    0.0 2.0],
	                   [1.0 1.0;
	                    1.0 1.0],
	                   [0.25, 0.75])

X, c = rand(d, 10_000)

d = fit(GaussianNaiveBayes, X, c)

predict(d, X)

loglikelihood(d, X, c)

logpdf(d, X[:, 1], c[1])
logpdf(d, X, c)

mean(d)

fit(GaussianNaiveBayes, rand(d, 1_000)...)

cor(X[:, c .== 1]')
cor(X[:, c .== 2]')

The Bernoulli Naive Bayes model:

d = BernoulliNaiveBayes([0.1 0.9;
	                     0.9 0.1],
	                    [0.25, 0.75])

X, c = rand(d, 10_000)

d = fit(BernoulliNaiveBayes, X, c)

predict(d, X)

loglikelihood(d, X, c)

logpdf(d, X[:, 1], c[1])
logpdf(d, X, c)

mean(d)

fit(BernoulliNaiveBayes, rand(d, 1_000)...)

cor(X[:, c .== 1]')
cor(X[:, c .== 2]')

About

Naive Bayes models in Julia

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages