24 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 #endif // DOXYGEN_SHOULD_SKIP_THIS
36 table_size(0), pairs(NULL), merge_distance(NULL)
42 table_size(0), pairs(NULL), merge_distance(NULL)
72 const int32_t num_pairs=num*(num-1)/2;
83 pairs=SG_MALLOC(int32_t, 2*num);
86 pair* index=SG_MALLOC(pair, num_pairs);
90 for (int32_t i=0; i<num; i++)
92 for (int32_t j=i+1; j<num; j++)
102 CMath::qsort_index<float64_t,pair>(distances, index, (num-1)*num/2);
107 for (; l<num && (num-l)>=
merges && k<num_pairs-1; l++)
109 while (k<num_pairs-1)
113 int32_t i=index[k].idx1;
114 int32_t j=index[k].idx2;
136 for (int32_t m=0; m<num; m++)
141 #ifdef DEBUG_HIERARCHICAL
142 SG_PRINT(
"l=%04i i=%04i j=%04i c1=%+04d c2=%+04d c=%+04d dist=%6.6f\n", l,i,j, c1,c2,c,
merge_distance[l])
virtual bool save(FILE *dstfile)
static void fill_vector(T *vec, int32_t len, T value)
SGVector< float64_t > get_merge_distances()
Class Distance, a base class for all the distances used in the Shogun toolbox.
virtual int32_t get_num_vectors() const =0
int32_t merges
the number of merges in hierarchical clustering
int32_t * assignment
cluster assignment for the num_points
A generic DistanceMachine interface.
virtual bool train_machine(CFeatures *data=NULL)
SGMatrix< int32_t > get_cluster_pairs()
int32_t table_size
size of the below tables
int32_t assignment_size
size of assignment table
static void range_fill_vector(T *vec, int32_t len, T start=0)
virtual float64_t distance(int32_t idx_a, int32_t idx_b)
all of classes and functions are contained in the shogun namespace
SGVector< int32_t > get_assignment()
virtual void store_model_features()
virtual bool load(FILE *srcfile)
The class Features is the base class of all feature objects.
void set_distance(CDistance *d)
float64_t * merge_distance
distance at which pair i/j was added
virtual bool init(CFeatures *lhs, CFeatures *rhs)
virtual EMachineType get_classifier_type()
int32_t * pairs
tuples of i/j