SHOGUN  v3.2.0
LinearLatentMachine.h
浏览该文件的文档.
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/common.h>
17 
18 namespace shogun
19 {
24  {
25 
26  public:
27 
30 
33 
40 
41  virtual ~CLinearLatentMachine();
42 
47  virtual CLatentLabels* apply_latent() = 0;
48 
54  virtual CLatentLabels* apply_latent(CFeatures* data);
55 
60  virtual const char* get_name() const { return "LinearLatentMachine"; }
61 
66  inline void set_epsilon(float64_t eps) { m_epsilon=eps; }
67 
72  inline float64_t get_epsilon() { return m_epsilon; }
73 
78  inline void set_C(float64_t c)
79  {
80  m_C=c;
81  }
82 
87  inline float64_t get_C() { return m_C; }
88 
93  inline void set_max_iterations(int32_t iter) { m_max_iter = iter; }
94 
99  inline int32_t get_max_iterations() { return m_max_iter; }
100 
105  void set_model(CLatentModel* latent_model);
106 
107  protected:
108  virtual bool train_machine(CFeatures* data=NULL);
109 
116  virtual float64_t do_inner_loop(float64_t cooling_eps)=0;
117 
118  virtual bool train_require_labels() const { return false; }
119 
120  protected:
128  int32_t m_max_iter;
130  int32_t m_cur_iter;
131 
132  private:
134  void init();
135  };
136 }
137 
138 #endif /* __LATENTLINEARMACHINE_H__ */
139 
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:31
virtual const char * get_name() const
virtual CLatentLabels * apply_latent()=0
double float64_t
Definition: common.h:48
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:61
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:16
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:62
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:24

SHOGUN Machine Learning Toolbox - Documentation