SHOGUN  6.0.0
LinearLatentMachine.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) 2012 Viktor Gal
8  * Copyright (C) 2012 Viktor Gal
9  */
10 
11 #ifndef __LATENTLINEARMACHINE_H__
12 #define __LATENTLINEARMACHINE_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/lib/common.h>
18 
19 namespace shogun
20 {
21  class CFeatures;
22  class CLatentLabels;
23  class CLatentModel;
24 
29  {
30 
31  public:
32 
35 
38 
45 
46  virtual ~CLinearLatentMachine();
47 
52  virtual CLatentLabels* apply_latent() = 0;
53 
59  virtual CLatentLabels* apply_latent(CFeatures* data);
60 
65  virtual const char* get_name() const { return "LinearLatentMachine"; }
66 
71  inline void set_epsilon(float64_t eps) { m_epsilon=eps; }
72 
77  inline float64_t get_epsilon() { return m_epsilon; }
78 
83  inline void set_C(float64_t c)
84  {
85  m_C=c;
86  }
87 
92  inline float64_t get_C() { return m_C; }
93 
98  inline void set_max_iterations(int32_t iter) { m_max_iter = iter; }
99 
104  inline int32_t get_max_iterations() { return m_max_iter; }
105 
110  void set_model(CLatentModel* latent_model);
111 
112  protected:
113  virtual bool train_machine(CFeatures* data=NULL);
114 
121  virtual float64_t do_inner_loop(float64_t cooling_eps)=0;
122 
123  virtual bool train_require_labels() const { return false; }
124 
125  protected:
133  int32_t m_max_iter;
135  int32_t m_cur_iter;
136 
137  private:
139  void init();
140  };
141 }
142 
143 #endif /* __LATENTLINEARMACHINE_H__ */
virtual float64_t do_inner_loop(float64_t cooling_eps)=0
Abstract class CLatentModel It represents the application specific model and contains most of the app...
Definition: LatentModel.h:33
virtual const char * get_name() const
virtual CLatentLabels * apply_latent()=0
double float64_t
Definition: common.h:60
void set_model(CLatentModel *latent_model)
void set_max_iterations(int32_t iter)
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
Definition: LinearMachine.h:63
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
abstract implementaion of Linear Machine with latent variable This is the base implementation of all ...
The class Features is the base class of all feature objects.
Definition: Features.h:68
virtual bool train_machine(CFeatures *data=NULL)
virtual bool train_require_labels() const
abstract class for latent labels As latent labels always depends on the given application, this class only defines the API that the user has to implement for latent labels.
Definition: LatentLabels.h:26

SHOGUN Machine Learning Toolbox - Documentation