SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MKLMulticlassGradient.h
Go to the documentation of this file.
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) 2009 Alexander Binder
8  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  *
10  * Update to patch 0.10.0 - thanks to Eric aka Yoo (thereisnoknife@gmail.com)
11  *
12  */
13 
14 #ifndef MKLMulticlassGRADIENT_H_
15 #define MKLMulticlassGRADIENT_H_
16 
17 #include <shogun/lib/config.h>
18 
19 #include <vector>
20 #include <cmath>
21 #include <cassert>
22 #include <shogun/base/SGObject.h>
24 
25 
26 namespace shogun
27 {
34 {
35 public:
43  virtual ~MKLMulticlassGradient();
44 
49 
54 
61  virtual void setup(const int32_t numkernels2);
62 
71  virtual void addconstraint(const ::std::vector<float64_t> & normw2,
72  const float64_t sumofpositivealphas);
73 
79  virtual void computeweights(std::vector<float64_t> & weights2);
80 
82  virtual const char* get_name() const { return "MKLMulticlassGradient"; }
83 
87  virtual void set_mkl_norm(float64_t norm);
88 
89 protected:
96  void linesearch2(std::vector<float64_t> & finalbeta,const std::vector<float64_t> & oldweights);
97 
104  void genbetas( ::std::vector<float64_t> & weights ,const ::std::vector<float64_t> & gammas);
105 
113  void gengammagradient( ::std::vector<float64_t> & gammagradient ,const ::std::vector<float64_t> & gammas,const int32_t dim);
114 
121  float64_t objectives(const ::std::vector<float64_t> & weights, const int32_t index);
122 
129  void linesearch(std::vector<float64_t> & finalbeta,const std::vector<float64_t> & oldweights);
130 
131 protected:
133  int32_t numkernels;
134 
135 
137  ::std::vector< ::std::vector<float64_t> > normsofsubkernels;
139  ::std::vector< float64_t > sumsofalphas ;
142 };
143 }
144 
145 #endif

SHOGUN Machine Learning Toolbox - Documentation