SHOGUN  v3.2.0
LatentModel.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 __LATENTMODEL_H__
12 #define __LATENTMODEL_H__
13 
18 
19 namespace shogun
20 {
31  class CLatentModel: public CSGObject
32  {
33  public:
35  CLatentModel();
36 
43  CLatentModel(CLatentFeatures* feats, CLatentLabels* labels, bool do_caching = true);
44 
46  virtual ~CLatentModel();
47 
52  virtual int32_t get_num_vectors() const;
53 
58  virtual int32_t get_dim() const=0;
59 
64  void set_labels(CLatentLabels* labs);
65 
70  CLatentLabels* get_labels() const;
71 
76  void set_features(CLatentFeatures* feats);
77 
83 
89 
98  virtual CData* infer_latent_variable(const SGVector<float64_t>& w, index_t idx)=0;
99 
105  virtual void argmax_h(const SGVector<float64_t>& w);
106 
110  void cache_psi_features();
111 
117 
122  inline bool get_caching() const
123  {
124  return m_do_caching;
125  }
126 
131  inline void set_caching(bool caching)
132  {
133  m_do_caching = caching;
134  }
135 
140  virtual const char* get_name() const { return "LatentModel"; }
141 
142  protected:
151 
152  private:
154  void register_parameters();
155  };
156 }
157 
158 #endif /* __LATENTMODEL_H__ */
159 
CDotFeatures * m_cached_psi
Definition: LatentModel.h:150
Abstract class CLatentModel It represents the application specific model and contains most of the app...
Definition: LatentModel.h:31
Latent Features class The class if for representing features for latent learning, e...
int32_t index_t
Definition: common.h:60
void set_caching(bool caching)
Definition: LatentModel.h:131
bool get_caching() const
Definition: LatentModel.h:122
Features that support dot products among other operations.
Definition: DotFeatures.h:41
void set_labels(CLatentLabels *labs)
Definition: LatentModel.cpp:48
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:102
CLatentLabels * m_labels
Definition: LatentModel.h:146
dummy data holder
Definition: Data.h:23
CLatentLabels * get_labels() const
Definition: LatentModel.cpp:55
virtual CData * infer_latent_variable(const SGVector< float64_t > &w, index_t idx)=0
CLatentFeatures * m_features
Definition: LatentModel.h:144
virtual void argmax_h(const SGVector< float64_t > &w)
Definition: LatentModel.cpp:68
virtual CDotFeatures * get_psi_feature_vectors()=0
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:16
virtual const char * get_name() const
Definition: LatentModel.h:140
virtual int32_t get_dim() const =0
CLatentFeatures * get_features() const
Definition: LatentModel.cpp:96
void set_features(CLatentFeatures *feats)
Definition: LatentModel.cpp:61
CDotFeatures * get_cached_psi_features() 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
virtual int32_t get_num_vectors() const
Definition: LatentModel.cpp:43

SHOGUN Machine Learning Toolbox - Documentation