SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FactorGraphLabels.h
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2013 Shell Hu
00008  * Copyright (C) 2013 Shell Hu
00009  */
00010 
00011 #ifndef __FACTORGRAPH_LABELS_H__
00012 #define __FACTORGRAPH_LABELS_H__
00013 
00014 #include <shogun/labels/StructuredLabels.h>
00015 #include <shogun/lib/SGVector.h>
00016 #include <shogun/lib/StructuredData.h>
00017 #include <shogun/lib/StructuredDataTypes.h>
00018 
00019 namespace shogun
00020 {
00021 
00022 class CFactorGraphLabels;
00023 
00026 class CFactorGraphObservation : public CStructuredData
00027 {
00028 public:
00030     STRUCTURED_DATA_TYPE(SDT_FACTOR_GRAPH);
00031 
00033     CFactorGraphObservation() : CStructuredData() { }
00034 
00040     CFactorGraphObservation(SGVector<int32_t> observed_state,
00041         SGVector<float64_t> loss_weights);
00042 
00043     ~CFactorGraphObservation() { }
00044 
00049     static CFactorGraphObservation* obtain_from_generic(CStructuredData* base_data)
00050     {
00051         if ( base_data->get_structured_data_type() == SDT_FACTOR_GRAPH )
00052             return (CFactorGraphObservation*) base_data;
00053         else
00054             SG_SERROR("base_data must be of dynamic type CFactorGraphObservation\n")
00055 
00056         return NULL;
00057     }
00058 
00060     virtual const char* get_name() const { return "FactorGraphObservation"; }
00061 
00063     SGVector<int32_t> get_data() const;
00064 
00066     SGVector<float64_t> get_loss_weights() const;
00067 
00072     void set_loss_weights(SGVector<float64_t> loss_weights);
00073 
00074 protected:
00076     SGVector<float64_t> m_loss_weights;
00077 
00079     SGVector<int32_t> m_observed_state;
00080 };
00081 
00082 
00087 class CFactorGraphLabels : public CStructuredLabels
00088 {
00089     public:
00091         CFactorGraphLabels();
00092 
00097         CFactorGraphLabels(int32_t num_labels);
00098 
00100         virtual ~CFactorGraphLabels();
00101 
00103         virtual const char* get_name() const { return "FactorGraphLabels"; }
00104 
00105     private:
00107         void init();
00108 
00109 }; /* CFactorGraphLabels */
00110 
00111 } /* namespace shogun */
00112 
00113 #endif /* __FACTORGRAPH_LABELS_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation