Created
April 25, 2012 13:51
-
-
Save pluskid/2489859 to your computer and use it in GitHub Desktop.
experimental shogun labels design
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename LabelType, LabelStoreType> | |
class CLabels: public CSGObject | |
{ | |
public: | |
virtual int32_t get_num_classes() const = 0; | |
virtual const LabelType& get_label(int32_t index) const | |
{ | |
check_out_of_range(index); | |
return cast_label(m_labels[index]); | |
} | |
protected: | |
virtual const LabelType& cast_label(const LabelStoreType& label)=0; | |
SGVector<LabelStoreType> m_labels; | |
}; | |
class CBinaryLabels: public CLabels<bool, float64_t> | |
{ | |
public: | |
virtual int32_t get_num_classes() const { return 2; } | |
protected: | |
virtual const bool& cast_label(const float64_t& label) { return label > 0; } | |
}; | |
class CRealLabels: public CLabels<float64_t, float64_t> | |
{ | |
public: | |
virtual int32_t get_num_classes() const { return inf; } | |
protected: | |
virtual const float64_t& cast_label(const float64_t label) { return label; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment