16 #ifndef __MLPACK_METHODS_NAIVE_BAYES_NAIVE_BAYES_CLASSIFIER_HPP 17 #define __MLPACK_METHODS_NAIVE_BAYES_NAIVE_BAYES_CLASSIFIER_HPP 22 namespace naive_bayes {
48 template<
typename MatType = arma::mat>
71 const arma::Row<size_t>& labels,
73 const bool incrementalVariance =
false);
82 const size_t classes = 0);
99 void Train(
const MatType& data,
100 const arma::Row<size_t>& labels,
101 const bool incremental =
true);
111 template<
typename VecType>
112 void Train(
const VecType& point,
const size_t label);
128 void Classify(
const MatType& data, arma::Row<size_t>& results);
146 template<
typename Archive>
147 void Serialize(Archive& ar,
const unsigned int );
164 #include "naive_bayes_classifier_impl.hpp" MatType & Means()
Modify the sample means for each class.
Linear algebra utility functions, generally performed on matrices or vectors.
void Serialize(Archive &ar, const unsigned int)
Serialize the classifier.
const MatType & Means() const
Get the sample means for each class.
The simple Naive Bayes classifier.
arma::vec probabilities
Class probabilities.
void Train(const MatType &data, const arma::Row< size_t > &labels, const bool incremental=true)
Train the Naive Bayes classifier on the given dataset.
MatType means
Sample mean for each class.
MatType & Variances()
Modify the sample variances for each class.
const MatType & Variances() const
Get the sample variances for each class.
arma::vec & Probabilities()
Modify the prior probabilities for each class.
NaiveBayesClassifier(const MatType &data, const arma::Row< size_t > &labels, const size_t classes, const bool incrementalVariance=false)
Initializes the classifier as per the input and then trains it by calculating the sample mean and var...
size_t trainingPoints
Number of training points seen so far.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
void Classify(const MatType &data, arma::Row< size_t > &results)
Given a bunch of data points, this function evaluates the class of each of those data points...
MatType variances
Sample variances for each class.
const arma::vec & Probabilities() const
Get the prior probabilities for each class.