SHOGUN  v2.0.0
 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 
11 #ifndef MKLMULTICLASSGRADIENT_H_
12 #define MKLMULTICLASSGRADIENT_H_
13 
14 #include <vector>
15 #include <cmath>
16 #include <cassert>
17 #include <shogun/base/SGObject.h>
19 
20 
21 namespace shogun
22 {
29 {
30 public:
38  virtual ~MKLMulticlassGradient();
39 
44 
49 
56  virtual void setup(const int32_t numkernels2);
57 
66  virtual void addconstraint(const ::std::vector<float64_t> & normw2,
67  const float64_t sumofpositivealphas);
68 
74  virtual void computeweights(std::vector<float64_t> & weights2);
75 
77  inline virtual const char* get_name() const
78  {
79  return "MKLMulticlassGradient";
80  }
81 
85  virtual void set_mkl_norm(float64_t norm);
86 
87 protected:
94  void genbetas( ::std::vector<float64_t> & weights ,const ::std::vector<float64_t> & gammas);
95 
103  void gengammagradient( ::std::vector<float64_t> & gammagradient ,const ::std::vector<float64_t> & gammas,const int32_t dim);
110  float64_t objectives(const ::std::vector<float64_t> & weights, const int32_t index);
111 
118  void linesearch(std::vector<float64_t> & finalbeta,const std::vector<float64_t> & oldweights);
119 
120 protected:
122  int32_t numkernels;
123 
125  ::std::vector< ::std::vector<float64_t> > normsofsubkernels;
127  ::std::vector< float64_t > sumsofalphas ;
130 };
131 }
132 
133 #endif

SHOGUN Machine Learning Toolbox - Documentation