SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
StudentsTLikelihood.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) 2013 Roman Votyakov
00008  * Copyright (C) 2012 Jacob Walker
00009  * Copyright (C) 2013 Roman Votyakov
00010  *
00011  * Code adapted from the GPML Toolbox:
00012  * http://www.gaussianprocess.org/gpml/code/matlab/doc/
00013  */
00014 
00015 #ifndef CSTUDENTSTLIKELIHOOD_H_
00016 #define CSTUDENTSTLIKELIHOOD_H_
00017 
00018 #include <shogun/lib/config.h>
00019 
00020 #ifdef HAVE_EIGEN3
00021 
00022 #include <shogun/machine/gp/LikelihoodModel.h>
00023 
00024 namespace shogun
00025 {
00026 
00038 class CStudentsTLikelihood: public CLikelihoodModel
00039 {
00040 public:
00042     CStudentsTLikelihood();
00043 
00049     CStudentsTLikelihood(float64_t sigma, float64_t df);
00050 
00051     virtual ~CStudentsTLikelihood();
00052 
00057     virtual const char* get_name() const { return "StudentsTLikelihood"; }
00058 
00063     float64_t get_sigma() { return m_sigma; }
00064 
00069     void set_sigma(float64_t sigma)
00070     {
00071         REQUIRE(sigma>0.0, "Scale parameter must be greater than zero\n")
00072         m_sigma=sigma;
00073     }
00074 
00079     float64_t get_degrees_freedom() { return m_df; }
00080 
00085     void set_degrees_freedom(float64_t df)
00086     {
00087         REQUIRE(df>1.0, "Number of degrees of freedom must be greater than one\n")
00088         m_df=df;
00089     }
00090 
00096     static CStudentsTLikelihood* obtain_from_generic(CLikelihoodModel* likelihood);
00097 
00112     virtual SGVector<float64_t> get_predictive_means(SGVector<float64_t> mu,
00113             SGVector<float64_t> s2, const CLabels* lab=NULL) const;
00114 
00129     virtual SGVector<float64_t> get_predictive_variances(SGVector<float64_t> mu,
00130             SGVector<float64_t> s2, const CLabels* lab=NULL) const;
00131 
00136     virtual ELikelihoodModelType get_model_type() const { return LT_STUDENTST; }
00137 
00149     virtual SGVector<float64_t> get_log_probability_f(const CLabels* lab,
00150             SGVector<float64_t> func) const;
00151 
00162     virtual SGVector<float64_t> get_log_probability_derivative_f(
00163             const CLabels* lab, SGVector<float64_t> func, index_t i) const;
00164 
00174     virtual SGVector<float64_t> get_first_derivative(const CLabels* lab,
00175             SGVector<float64_t> func, const TParameter* param) const;
00176 
00187     virtual SGVector<float64_t> get_second_derivative(const CLabels* lab,
00188             SGVector<float64_t> func, const TParameter* param) const;
00189 
00200     virtual SGVector<float64_t> get_third_derivative(const CLabels* lab,
00201             SGVector<float64_t> func, const TParameter* param) const;
00202 
00219     virtual SGVector<float64_t> get_log_zeroth_moments(SGVector<float64_t> mu,
00220             SGVector<float64_t> s2, const CLabels* lab) const;
00221 
00236     virtual float64_t get_first_moment(SGVector<float64_t> mu,
00237             SGVector<float64_t> s2, const CLabels* lab, index_t i) const;
00238 
00253     virtual float64_t get_second_moment(SGVector<float64_t> mu,
00254             SGVector<float64_t> s2, const CLabels* lab, index_t i) const;
00255 
00260     virtual bool supports_regression() const { return true; }
00261 
00262 private:
00264     void init();
00265 
00267     float64_t m_sigma;
00268 
00270     float64_t m_df;
00271 };
00272 }
00273 #endif /* HAVE_EIGEN3 */
00274 #endif /* CSTUDENTSTLIKELIHOOD_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation