MLPACK  1.0.11
naive_bayes_classifier.hpp
Go to the documentation of this file.
1 
24 #ifndef __MLPACK_METHODS_NAIVE_BAYES_NAIVE_BAYES_CLASSIFIER_HPP
25 #define __MLPACK_METHODS_NAIVE_BAYES_NAIVE_BAYES_CLASSIFIER_HPP
26 
27 #include <mlpack/core.hpp>
29 
30 namespace mlpack {
31 namespace naive_bayes {
32 
57 template<typename MatType = arma::mat>
59 {
60  private:
62  MatType means;
63 
65  MatType variances;
66 
68  arma::vec probabilities;
69 
70  public:
91  NaiveBayesClassifier(const MatType& data,
92  const arma::Col<size_t>& labels,
93  const size_t classes,
94  const bool incrementalVariance = false);
95 
110  void Classify(const MatType& data, arma::Col<size_t>& results);
111 
113  const MatType& Means() const { return means; }
115  MatType& Means() { return means; }
116 
118  const MatType& Variances() const { return variances; }
120  MatType& Variances() { return variances; }
121 
123  const arma::vec& Probabilities() const { return probabilities; }
125  arma::vec& Probabilities() { return probabilities; }
126 };
127 
128 }; // namespace naive_bayes
129 }; // namespace mlpack
130 
131 // Include implementation.
132 #include "naive_bayes_classifier_impl.hpp"
133 
134 #endif