47 m_components=components;
67 SG_ERROR(
"Specified features are not of type CDotFeatures\n")
72 SG_ERROR(
"No features to train on.\n")
85 REQUIRE(dotdata,
"dynamic cast from CFeatures to CDotFeatures returned NULL")
95 bool is_converged=em->
iterate_em(m_max_iters,m_conv_tol);
97 SG_WARNING(
"max iterations reached. No convergence yet!\n")
105 REQUIRE(num_param==1,
"number of parameters in mixture model is 1"
106 " (i.e. number of components). num_components should be 1. %d supplied\n",num_param)
153 if (m_components!=NULL)
156 m_components=components;
174 m_max_iters=max_iters;
206 void CMixtureModel::init()
SGVector< float64_t > cluster(SGVector< float64_t > point)
virtual void set_features(CFeatures *f)
SGVector< float64_t > weights
static CDistribution * obtain_from_generic(CSGObject *object)
virtual int32_t get_num_vectors() const =0
SGMatrix< float64_t > alpha
void set_convergence_tolerance(float64_t epsilon)
#define SG_NOTIMPLEMENTED
int32_t get_num_elements() const
CDynamicObjectArray * components
bool train(CFeatures *data=NULL)
Base class Distribution from which all methods implementing a distribution are derived.
virtual float64_t get_log_derivative(int32_t num_param, int32_t num_example)
Features that support dot products among other operations.
This is the implementation of EM specialized for Mixture models.
virtual float64_t get_log_likelihood_example(int32_t num_example)
Class SGObject is the base class of all shogun objects.
index_t get_num_components() const
static T log_sum_exp(SGVector< T > values)
virtual EFeatureClass get_feature_class() const =0
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
CDistribution * get_component(index_t index) const
SGVector< float64_t > sample()
all of classes and functions are contained in the shogun namespace
bool iterate_em(int32_t max_iters=10000, float64_t epsilon=1e-8)
int32_t get_max_iters() const
void set_max_iters(int32_t max_iters)
The class Features is the base class of all feature objects.
CDynamicObjectArray * get_components() const
static float64_t log(float64_t v)
float64_t get_log_model_parameter(int32_t num_param=1)
float64_t get_convergence_tolerance() const
CSGObject * get_element(int32_t index) const
void set_components(CDynamicObjectArray *components)
SGVector< float64_t > get_weights() const
void set_weights(SGVector< float64_t > weights)
virtual float64_t get_log_likelihood_example(int32_t num_example)=0
bool has_property(EFeatureProperty p) const
virtual EFeatureType get_feature_type() const =0