85 SG_ERROR(
"Number of training vectors does not match number of labels\n")
144 SG_PRINT(
"\nQuick sort query %d\n", i)
145 for (int32_t j=0; j<
m_k; j++)
151 for (int32_t j=0; j<
m_k; j++)
152 NN(j,i) = train_idxs[j];
174 ASSERT(m_k<=distance->get_num_vec_lhs())
179 SG_INFO(
"%d test examples\n", num_lab)
205 SG_INFO(
"%d test examples\n", num_lab)
226 if (distances.
vector[j]<min_dist)
228 min_dist = distances.
vector[j];
257 SG_INFO(
"%d test examples\n", num_lab)
277 SG_ERROR(
"No vectors on left hand side\n")
virtual void store_model_features()
virtual bool save(FILE *dstfile)
Class Distance, a base class for all the distances used in the Shogun toolbox.
virtual void reset_precompute()
void init_distance(CFeatures *data)
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
static void qsort_index(T1 *output, T2 *index, uint32_t size)
SGMatrix< int32_t > classify_for_multiple_k()
virtual int32_t get_num_vectors() const =0
virtual CFeatures * duplicate() const =0
int32_t m_min_label
smallest label, i.e. -1
virtual bool train_machine(CFeatures *data=NULL)
SGMatrix< index_t > nearest_neighbors()
A generic DistanceMachine interface.
bool set_label(int32_t idx, float64_t label)
virtual bool load(FILE *srcfile)
int32_t m_num_classes
number of classes (i.e. number of values labels can take)
Multiclass Labels for multi-class classification.
int32_t m_k
the k parameter in KNN
virtual void set_store_model_features(bool store_model)
void distances_lhs(SGVector< float64_t > &result, int32_t idx_a1, int32_t idx_a2, int32_t idx_b)
static void clear_cancel()
virtual int32_t get_num_vec_rhs()
static bool cancel_computations()
float64_t m_q
parameter q of rank weighting
SGVector< int32_t > m_train_labels
all of classes and functions are contained in the shogun namespace
CKNNSolver * solver
Solver for KNN.
The class Features is the base class of all feature objects.
void set_distance(CDistance *d)
virtual void precompute_lhs()
virtual CMulticlassLabels * classify_NN()
virtual CMulticlassLabels * apply_multiclass(CFeatures *data=NULL)
virtual SGVector< int32_t > classify_objects_k(CDistance *d, const int32_t num_lab, SGVector< int32_t > &train_lab, SGVector< int32_t > &classes) const =0
virtual void precompute_rhs()
virtual CMulticlassLabels * classify_objects(CDistance *d, const int32_t num_lab, SGVector< int32_t > &train_lab, SGVector< float64_t > &classes) const =0
virtual bool init(CFeatures *lhs, CFeatures *rhs)
virtual void set_labels(CLabels *lab)
SGVector< T > clone() const