NaiveBayes.HybridNBType

Initialize a HybridNB model with continuous and/or discrete features

Constructors

HybridNB(labels::AbstractVector, kde_names::AbstractVector, discrete_names::AbstractVector)
HybridNB(labels::AbstractVector, kde_names::AbstractVector)
HybridNB(labels::AbstractVector, num_kde::Int, num_discrete::Int)

Arguments

  • labels : An AbstractVector{Any} of feature labels
  • kde_names : An AbstractVector{Any} of the names of continuous features
  • discrete_names : An AbstractVector{Any} of the names of discrete features
  • num_kde : Number of continuous features
  • num_discrete : Number of discrete features
NaiveBayes.HybridNBMethod
HybridNB(labels::Vector{Int64}) -> model_h

HybridNB(labels::Vector{Int64}, AstractString) -> model_h

A constructor for both types of features

NaiveBayes.MultinomialNBMethod

Multinomial Naive Bayes classifier

classes : array of objects Class names n_vars : Int64 Number of variables in observations alpha : Number (optional, default 1) Smoothing parameter. E.g. if alpha equals 1, each variable in each class is believed to have 1 observation by default

NaiveBayes.NBModelType

Base type for Naive Bayes models. Inherited classes should have at least following fields: ccounts::Dict{C, Int64} - count of ocurrences of each class nobs::Int64 - total number of observations

NaiveBayes.predict_logprobsMethod
predict_logprobs(m::HybridNB, features_c::Vector{Vector{Float64}, features_d::Vector{Vector{Int})

Return the log-probabilities for each column of X, where each row is the class

NaiveBayes.predict_probaMethod
predict_proba{V<:Number}(m::HybridNB, f_c::Vector{Vector{Float64}}, f_d::Vector{Vector{Int64}})

Predict log-probabilities for the input features. Returns tuples of predicted class and its log-probability estimate.

NaiveBayes.to_matrixMethod
to_matrix(D::Dict{Symbol, Vector}}) -> M::Matrix

convert a dictionary of vectors into a matrix

NaiveBayes.trainMethod
train(HybridNB, continuous, discrete, labels) -> model2
StatsBase.fitMethod
fit(m::HybridNB, f_c::Vector{Vector{Float64}}, f_d::Vector{Vector{Int64}}, labels::Vector{Int64})

Train NB model with discrete and continuous features by estimating P(x⃗|c)

StatsBase.fitMethod
fit(m::HybridNB, f_c::Matrix{Float64}, labels::Vector{Int64})

Train NB model with continuous features only

StatsBase.predictMethod
predict(m::HybridNB, f_c::Vector{Vector{Float64}}, f_d::Vector{Vector{Int64}}) -> labels

Predict hybrid naive bayes for continuos featuers only

NaiveBayes.ePDFType

a wrapper around key value pairs for a discrete probability distribution