SHOGUN
v1.1.0
|
Class GaussianNaiveBayes, a Gaussian Naive Bayes classifier.
This classifier assumes that a posteriori conditional probabilities are gaussian pdfs. For each vector gaussian naive bayes chooses the class C with maximal
Definition at line 35 of file GaussianNaiveBayes.h.
Public Member Functions | |
CGaussianNaiveBayes () | |
CGaussianNaiveBayes (CFeatures *train_examples, CLabels *train_labels) | |
virtual | ~CGaussianNaiveBayes () |
virtual void | set_features (CDotFeatures *features) |
virtual CDotFeatures * | get_features () |
virtual bool | train (CFeatures *data=NULL) |
virtual CLabels * | apply () |
virtual CLabels * | apply (CFeatures *data) |
virtual float64_t | apply (int32_t idx) |
virtual const char * | get_name () const |
virtual EClassifierType | get_classifier_type () |
![]() | |
CMachine () | |
virtual | ~CMachine () |
virtual bool | load (FILE *srcfile) |
virtual bool | save (FILE *dstfile) |
virtual void | set_labels (CLabels *lab) |
virtual CLabels * | get_labels () |
virtual float64_t | get_label (int32_t i) |
void | set_max_train_time (float64_t t) |
float64_t | get_max_train_time () |
void | set_solver_type (ESolverType st) |
ESolverType | get_solver_type () |
virtual void | set_store_model_features (bool store_model) |
![]() | |
CSGObject () | |
CSGObject (const CSGObject &orig) | |
virtual | ~CSGObject () |
virtual bool | is_generic (EPrimitiveType *generic) const |
template<class T > | |
void | set_generic () |
void | unset_generic () |
virtual void | print_serializable (const char *prefix="") |
virtual bool | save_serializable (CSerializableFile *file, const char *prefix="") |
virtual bool | load_serializable (CSerializableFile *file, const char *prefix="") |
void | set_global_io (SGIO *io) |
SGIO * | get_global_io () |
void | set_global_parallel (Parallel *parallel) |
Parallel * | get_global_parallel () |
void | set_global_version (Version *version) |
Version * | get_global_version () |
SGVector< char * > | get_modelsel_names () |
char * | get_modsel_param_descr (const char *param_name) |
index_t | get_modsel_param_index (const char *param_name) |
Protected Member Functions | |
float64_t | normal_exp (float64_t x, int32_t l_idx, int32_t f_idx) |
![]() | |
virtual bool | train_machine (CFeatures *data=NULL) |
virtual void | store_model_features () |
![]() | |
virtual void | load_serializable_pre () throw (ShogunException) |
virtual void | load_serializable_post () throw (ShogunException) |
virtual void | save_serializable_pre () throw (ShogunException) |
virtual void | save_serializable_post () throw (ShogunException) |
Protected Attributes | |
CDotFeatures * | m_features |
features for training or classifying | |
int32_t | m_min_label |
minimal label | |
int32_t | m_num_classes |
number of different classes (labels) | |
int32_t | m_dim |
dimensionality of feature space | |
SGVector< float64_t > | m_means |
means for normal distributions of features | |
SGVector< float64_t > | m_variances |
variances for normal distributions of features | |
SGVector< float64_t > | m_label_prob |
a priori probabilities of labels | |
SGVector< float64_t > | m_rates |
label rates | |
![]() | |
float64_t | max_train_time |
CLabels * | labels |
ESolverType | solver_type |
bool | m_store_model_features |
Additional Inherited Members | |
![]() | |
SGIO * | io |
Parallel * | parallel |
Version * | version |
Parameter * | m_parameters |
Parameter * | m_model_selection_parameters |
default constructor
Definition at line 20 of file GaussianNaiveBayes.cpp.
CGaussianNaiveBayes | ( | CFeatures * | train_examples, |
CLabels * | train_labels | ||
) |
constructor
train_examples | train examples |
train_labels | labels corresponding to train_examples |
Definition at line 28 of file GaussianNaiveBayes.cpp.
|
virtual |
destructor
Definition at line 40 of file GaussianNaiveBayes.cpp.
|
virtual |
classify all examples
Implements CMachine.
Definition at line 161 of file GaussianNaiveBayes.cpp.
classify specified examples
data | examples to be classified |
Implements CMachine.
Definition at line 176 of file GaussianNaiveBayes.cpp.
|
virtual |
classifiy specified example
idx | example index |
Reimplemented from CMachine.
Definition at line 191 of file GaussianNaiveBayes.cpp.
|
virtual |
get classifier type
Reimplemented from CMachine.
Definition at line 105 of file GaussianNaiveBayes.h.
|
virtual |
get features for classify
Definition at line 68 of file GaussianNaiveBayes.h.
|
virtual |
get name
Implements CSGObject.
Definition at line 100 of file GaussianNaiveBayes.h.
computes gaussian exponent by x, indexes, m_means and m_variances
x | feature value |
l_idx | index of label |
f_idx | index of feature |
Definition at line 136 of file GaussianNaiveBayes.h.
|
virtual |
set features for classify
features | features to be set |
Definition at line 58 of file GaussianNaiveBayes.h.
|
virtual |
train classifier
data | train examples |
Reimplemented from CMachine.
Definition at line 50 of file GaussianNaiveBayes.cpp.
|
protected |
dimensionality of feature space
Definition at line 119 of file GaussianNaiveBayes.h.
|
protected |
features for training or classifying
Definition at line 105 of file GaussianNaiveBayes.h.
a priori probabilities of labels
Definition at line 128 of file GaussianNaiveBayes.h.
means for normal distributions of features
Definition at line 122 of file GaussianNaiveBayes.h.
|
protected |
minimal label
Definition at line 113 of file GaussianNaiveBayes.h.
|
protected |
number of different classes (labels)
Definition at line 116 of file GaussianNaiveBayes.h.
label rates
Definition at line 142 of file GaussianNaiveBayes.h.
variances for normal distributions of features
Definition at line 125 of file GaussianNaiveBayes.h.