PositionalPWM.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2011 Soeren Sonnenburg
00008  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
00009  */
00010 
00011 #ifndef _POSITIONAL_PWM_H__
00012 #define _POSITIONAL_PWM_H__
00013 
00014 #include <shogun/distributions/Distribution.h>
00015 #include <shogun/features/StringFeatures.h>
00016 #include <shogun/lib/common.h>
00017 #include <shogun/mathematics/Math.h>
00018 
00019 namespace shogun
00020 {
00022 class CPositionalPWM : public CDistribution
00023 {
00024     public:
00026         CPositionalPWM();
00027 
00028         virtual ~CPositionalPWM();
00029 
00036         virtual bool train(CFeatures* data=NULL);
00037 
00042         virtual int32_t get_num_model_parameters();
00043 
00049         virtual float64_t get_log_model_parameter(int32_t num_param);
00050 
00057         virtual float64_t get_log_derivative(
00058             int32_t num_param, int32_t num_example);
00059 
00067         virtual float64_t get_log_likelihood_example(int32_t num_example);
00068 
00074         float64_t get_log_likelihood_window(uint8_t* window, int32_t len, float64_t pos);
00075 
00078         virtual float64_t get_sigma()
00079         {
00080             return m_sigma;
00081         }
00082 
00087         virtual void set_sigma(float64_t sigma)
00088         {
00089             m_sigma=sigma;
00090         }
00091 
00094         virtual float64_t get_mean()
00095         {
00096             return m_mean;
00097         }
00098 
00103         virtual void set_mean(float64_t mean)
00104         {
00105             m_mean=mean;
00106         }
00107 
00112         virtual void set_pwm(SGMatrix<float64_t> pwm)
00113         {
00114             m_pwm = pwm;
00115         }
00116 
00121         virtual SGMatrix<float64_t> get_pwm() const
00122         {
00123             return m_pwm;
00124         }
00125 
00130         virtual SGMatrix<float64_t> get_w() const
00131         {
00132             return m_w;
00133         }
00134 
00141         virtual SGMatrix<float64_t> get_scoring(int32_t d);
00142 
00146         void compute_w(int32_t num_pos);
00147 
00151         void compute_scoring(int32_t max_degree);
00152 
00154         virtual const char* get_name() const { return "PositionalPWM"; }
00155 
00156     private:
00158         void register_params();
00159 
00160     protected:
00161 
00163         SGMatrix<float64_t> m_pwm;
00164 
00166         float64_t m_sigma;
00167 
00169         float64_t m_mean;
00170 
00172         SGMatrix<float64_t> m_w;
00173 
00175         SGVector<float64_t> m_poim;
00176 
00177 };
00178 }
00179 #endif //_POSITIONAL_PWM_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation