SHOGUN  v3.2.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 
Distribution.h
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _DISTRIBUTION_H___
12 #define _DISTRIBUTION_H___
13 
16 #include <shogun/base/SGObject.h>
17 
18 namespace shogun
19 {
20 class CFeatures;
21 class CMath;
41 class CDistribution : public CSGObject
42 {
43  public:
45  CDistribution();
46 
48  virtual ~CDistribution();
49 
58  virtual bool train(CFeatures* data=NULL)=0;
59 
66  virtual int32_t get_num_model_parameters()=0;
67 
73  virtual int32_t get_num_relevant_model_parameters();
74 
81  virtual float64_t get_log_model_parameter(int32_t num_param)=0;
82 
92  int32_t num_param, int32_t num_example)=0;
93 
101  virtual float64_t get_log_likelihood_example(int32_t num_example)=0;
102 
108 
114 
120  virtual float64_t get_model_parameter(int32_t num_param)
121  {
122  return exp(get_log_model_parameter(num_param));
123  }
124 
132  int32_t num_param, int32_t num_example)
133  {
134  return exp(get_log_derivative(num_param, num_example));
135  }
136 
142  virtual float64_t get_likelihood_example(int32_t num_example)
143  {
144  return exp(get_log_likelihood_example(num_example));
145  }
146 
152 
157  virtual void set_features(CFeatures* f)
158  {
159  SG_REF(f);
161  features=f;
162  }
163 
169  {
170  SG_REF(features);
171  return features;
172  }
173 
178  virtual void set_pseudo_count(float64_t pseudo) { pseudo_count=pseudo; }
179 
185 
186  protected:
191 };
192 }
193 #endif
virtual void set_features(CFeatures *f)
Definition: Distribution.h:157
virtual float64_t get_model_parameter(int32_t num_param)
Definition: Distribution.h:120
#define SG_UNREF(x)
Definition: SGRefObject.h:35
virtual SGVector< float64_t > get_log_likelihood()
virtual int32_t get_num_relevant_model_parameters()
virtual void set_pseudo_count(float64_t pseudo)
Definition: Distribution.h:178
Base class Distribution from which all methods implementing a distribution are derived.
Definition: Distribution.h:41
virtual float64_t get_derivative(int32_t num_param, int32_t num_example)
Definition: Distribution.h:131
virtual float64_t get_log_model_parameter(int32_t num_param)=0
virtual bool train(CFeatures *data=NULL)=0
virtual float64_t get_log_likelihood_sample()
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:102
double float64_t
Definition: common.h:48
virtual CFeatures * get_features()
Definition: Distribution.h:168
#define SG_REF(x)
Definition: SGRefObject.h:34
virtual float64_t get_likelihood_example(int32_t num_example)
Definition: Distribution.h:142
virtual float64_t get_pseudo_count()
Definition: Distribution.h:184
virtual SGVector< float64_t > get_likelihood_for_all_examples()
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:16
The class Features is the base class of all feature objects.
Definition: Features.h:62
virtual float64_t get_log_likelihood_example(int32_t num_example)=0
virtual float64_t get_log_derivative(int32_t num_param, int32_t num_example)=0
virtual int32_t get_num_model_parameters()=0

SHOGUN Machine Learning Toolbox - Documentation