16 using namespace shogun;
40 return feats_dim*num_classes;
49 get_computed_dot_feature_vector(feat_idx);
75 REQUIRE(m_num_classes > 0,
"The model needs to be trained before "
76 "using it for prediction\n");
87 for ( int32_t c = 0 ; c < m_num_classes ; ++c )
93 if ( score > max_score )
107 ret->
score = max_score;
133 REQUIRE(y1_idx >= 0 || y1_idx < m_labels->get_num_labels(),
134 "The label index must be inside [0, num_labels-1]\n");
145 return (y1 == y2) ? 0 : 1;
161 void CMulticlassModel::init()
163 SG_ADD(&m_num_classes,
"m_num_classes",
"The number of classes",
SGVector< float64_t > psi_truth
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
compute dot product between v1 and v2 (blas optimized)
Base class of the labels used in Structured Output (SO) problems.
virtual void init_primal_opt(float64_t regularization, SGMatrix< float64_t > &A, SGVector< float64_t > a, SGMatrix< float64_t > B, SGVector< float64_t > &b, SGVector< float64_t > lb, SGVector< float64_t > ub, SGMatrix< float64_t > &C)
static const float64_t INFTY
infinity
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)=0
virtual float64_t delta_loss(CStructuredData *y1, CStructuredData *y2)
virtual CResultSet * argmax(SGVector< float64_t > w, int32_t feat_idx, bool const training=true)
SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, int32_t lab_idx)
Features that support dot products among other operations.
static CRealNumber * obtain_from_generic(CStructuredData *base_data)
virtual SGVector< float64_t > get_joint_feature_vector(int32_t feat_idx, CStructuredData *y)
virtual int32_t get_dim_feature_space() const =0
int32_t get_num_classes()
static SGMatrix< T > create_identity_matrix(index_t size, T scale)
float64_t delta_loss(int32_t ytrue_idx, CStructuredData *ypred)
virtual ~CMulticlassModel()
virtual int32_t get_dim() const
Class CStructuredModel that represents the application specific model and contains most of the applic...
CStructuredLabels * m_labels
The class Features is the base class of all feature objects.
CStructuredData * get_label(int32_t idx)
SGVector< float64_t > psi_pred
Class CRealNumber to be used in the application of Structured Output (SO) learning to multiclass clas...
Class CMulticlassSOLabels to be used in the application of Structured Output (SO) learning to multicl...
Base class of the components of StructuredLabels.