21 CLatentSVM::CLatentSVM()
31 CLatentSVM::~CLatentSVM()
38 SG_ERROR(
"LatentModel is not set!\n")
40 if (m_model->get_num_vectors() < 1)
43 index_t num_examples = m_model->get_num_vectors();
47 m_model->set_labels(hs);
49 for (
index_t i = 0; i < num_examples; ++i)
52 CData* h = m_model->infer_latent_variable(w, i);
53 hs->add_latent_label(h);
58 x->
dense_dot_range(ys->get_labels().vector, 0, num_examples, NULL, w.vector, w.vlen, 0.0);
65 CLabels* ys = m_model->get_labels()->get_labels();
67 m_model->get_cached_psi_features() :
68 m_model->get_psi_feature_vectors());
69 CSVMOcas svm(m_C, feats, ys);
70 svm.set_epsilon(cooling_eps);
79 return svm.compute_primal_objective();
82 #endif //USE_GPL_SHOGUN
Abstract class CLatentModel It represents the application specific model and contains most of the app...
virtual void dense_dot_range(float64_t *output, int32_t start, int32_t stop, float64_t *alphas, float64_t *vec, int32_t dim, float64_t b)
The class Labels models labels, i.e. class assignments of objects.
Features that support dot products among other operations.
all of classes and functions are contained in the shogun namespace
abstract implementaion of Linear Machine with latent variable This is the base implementation of all ...
Binary Labels for binary classification.
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.