12 CKNNSolver(k, q, num_classes, min_label, train_labels) { }
21 SG_INFO(
"q != 1.0 not supported with cover tree, using q = 1\n")
46 for ( int32_t i = 0 ; i < res.
index ; ++i )
48 for ( int32_t j = 0 ; j < res[i].
index ; ++j )
108 dists[j] = knn_distance->
distance(res[i][j+1].m_index,
111 res[i][j+1].m_index ];
118 train_lab.
vector, num_lab);
int32_t m_k
the k parameter in KNN
Class Distance, a base class for all the distances used in the Shogun toolbox.
SGVector< int32_t > m_train_labels
static void qsort_index(T1 *output, T2 *index, uint32_t size)
node< P > batch_create(v_array< P > points)
int32_t choose_class(float64_t *classes, const int32_t *train_lab) const
virtual CFeatures * replace_lhs(CFeatures *lhs)
virtual SGVector< int32_t > classify_objects_k(CDistance *d, const int32_t num_lab, SGVector< int32_t > &train_lab, SGVector< int32_t > &classes) const
Class v_array taken directly from JL's implementation.
bool set_label(int32_t idx, float64_t label)
v_array< CJLCoverTreePoint > parse_points(CDistance *distance, EFeaturesContainer fc)
Multiclass Labels for multi-class classification.
EMessageType get_loglevel() const
void choose_class_for_multiple_k(int32_t *output, int32_t *classes, const int32_t *train_lab, const int32_t step) const
virtual CFeatures * replace_rhs(CFeatures *rhs)
int32_t m_min_label
smallest label, i.e. -1
virtual float64_t distance(int32_t idx_a, int32_t idx_b)
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
void k_nearest_neighbor(const node< P > &top_node, const node< P > &query, v_array< v_array< P > > &results, int k)
virtual CMulticlassLabels * classify_objects(CDistance *d, const int32_t num_lab, SGVector< int32_t > &train_lab, SGVector< float64_t > &classes) const
float64_t m_q
parameter q of rank weighting