46 return feats_dim*num_classes;
55 get_computed_dot_feature_vector(feat_idx);
81 REQUIRE(m_num_classes > 0,
"The model needs to be trained before "
82 "using it for prediction\n");
93 for ( int32_t c = 0 ; c < m_num_classes ; ++c )
99 if ( score > max_score )
114 ret->
score = max_score;
140 REQUIRE(y1_idx >= 0 || y1_idx < m_labels->get_num_labels(),
141 "The label index must be inside [0, num_labels-1]\n");
152 return (y1 == y2) ? 0 : 1;
168 void CMulticlassModel::init()
170 SG_ADD(&m_num_classes,
"m_num_classes",
"The number of classes",
SGVector< float64_t > psi_truth
Base class of the labels used in Structured Output (SO) problems.
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 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)
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()
float64_t delta_loss(int32_t ytrue_idx, CStructuredData *ypred)
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
Compute dot product between v1 and v2 (blas optimized)
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
virtual CStructuredLabels * structured_labels_factory(int32_t num_labels=0)
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
virtual 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...
static SGMatrix< T > create_identity_matrix(index_t size, T scale)
Base class of the components of StructuredLabels.