SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hierarchical.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2007-2009 Soeren Sonnenburg
8  * Copyright (C) 2007-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _HIERARCHICAL_H__
12 #define _HIERARCHICAL_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/lib/common.h>
17 #include <shogun/io/SGIO.h>
20 
21 namespace shogun
22 {
23 class CDistanceMachine;
24 
39 {
40  public:
42  CHierarchical();
43 
49  CHierarchical(int32_t merges, CDistance* d);
50  virtual ~CHierarchical();
51 
54 
60 
66  virtual bool load(FILE* srcfile);
67 
73  virtual bool save(FILE* dstfile);
74 
79  inline void set_merges(int32_t m)
80  {
81  ASSERT(m>0)
82  merges=m;
83  }
84 
89  int32_t get_merges();
90 
95 
100 
105 
107  virtual const char* get_name() const { return "Hierarchical"; }
108 
109  protected:
118  virtual bool train_machine(CFeatures* data=NULL);
119 
123  virtual void store_model_features();
124 
125  virtual bool train_require_labels() const { return false; }
126 
127  protected:
129  int32_t merges;
130 
132  int32_t dimensions;
133 
136 
138  int32_t* assignment;
139 
141  int32_t table_size;
142 
144  int32_t* pairs;
145 
148 };
149 }
150 #endif

SHOGUN Machine Learning Toolbox - Documentation