18 using namespace shogun;
21 CMachine(), m_features(NULL), m_min_label(0),
22 m_num_classes(0), m_dim(0), m_means(),
23 m_variances(), m_label_prob(), m_rates()
29 CMachine(), m_features(NULL), m_min_label(0),
30 m_num_classes(0), m_dim(0), m_means(),
31 m_variances(), m_label_prob(), m_rates()
36 SG_ERROR(
"Specified features are not of type CDotFeatures\n");
56 SG_ERROR(
"Specified features are not of type CDotFeatures\n");
65 int32_t min_label = train_labels.
vector[0];
66 int32_t max_label = train_labels.
vector[0];
70 for (i=1; i<train_labels.
vlen; i++)
77 for (i=0; i<train_labels.
vlen; i++)
78 train_labels.
vector[i]-= min_label;
120 for (i=0; i<train_labels.
vlen; i++)
122 for (j=0; j<
m_dim; j++)
131 for (j=0; j<
m_dim; j++)
136 for (i=0; i<train_labels.
vlen; i++)
138 for (j=0; j<
m_dim; j++)
146 for (j=0; j<
m_dim; j++)
170 for (
int i=0; i<n; i++)
180 SG_ERROR(
"No features specified\n");
182 SG_ERROR(
"Specified features are not of type CDotFeatures\n");
212 for (k=0; k<
m_dim; k++)
217 int32_t max_label_idx = 0;
bool has_property(EFeatureProperty p)
SGVector< float64_t > m_label_prob
a priori probabilities of labels
bool set_label(int32_t idx, float64_t label)
The class Labels models labels, i.e. class assignments of objects.
virtual ~CGaussianNaiveBayes()
virtual int32_t get_num_vectors() const =0
Features that support dot products among other operations.
A generic learning machine interface.
SGVector< float64_t > m_rates
label rates
virtual int32_t get_dim_feature_space() const =0
virtual void free_vector()
virtual CLabels * apply()
SGVector< int32_t > get_int_labels()
int32_t m_num_classes
number of different classes (labels)
SGVector< float64_t > m_means
means for normal distributions of features
virtual void destroy_vector()
int32_t m_min_label
minimal label
static T max(T a, T b)
return the maximum of two integers
int32_t m_dim
dimensionality of feature space
float64_t normal_exp(float64_t x, int32_t l_idx, int32_t f_idx)
virtual void set_features(CDotFeatures *features)
virtual bool train(CFeatures *data=NULL)
The class Features is the base class of all feature objects.
static T min(T a, T b)
return the minimum of two integers
SGVector< float64_t > m_variances
variances for normal distributions of features
SGVector< float64_t > get_computed_dot_feature_vector(int32_t num)
SGMatrix< float64_t > get_computed_dot_feature_matrix()
static float32_t sqrt(float32_t x)
x^0.5
virtual void set_labels(CLabels *lab)
#define SG_MALLOC(type, len)
CDotFeatures * m_features
features for training or classifying