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 <stdio.h>
17 #include <shogun/lib/common.h>
18 #include <shogun/io/SGIO.h>
21 
22 namespace shogun
23 {
24 class CDistanceMachine;
25 
40 {
41  public:
43  CHierarchical();
44 
50  CHierarchical(int32_t merges, CDistance* d);
51  virtual ~CHierarchical();
52 
55 
61 
67  virtual bool load(FILE* srcfile);
68 
74  virtual bool save(FILE* dstfile);
75 
80  inline void set_merges(int32_t m)
81  {
82  ASSERT(m>0)
83  merges=m;
84  }
85 
90  int32_t get_merges();
91 
96 
101 
106 
108  virtual const char* get_name() const { return "Hierarchical"; }
109 
110  protected:
119  virtual bool train_machine(CFeatures* data=NULL);
120 
124  virtual void store_model_features();
125 
126  virtual bool train_require_labels() const { return false; }
127 
128  protected:
130  int32_t merges;
131 
133  int32_t dimensions;
134 
137 
139  int32_t* assignment;
140 
142  int32_t table_size;
143 
145  int32_t* pairs;
146 
149 };
150 }
151 #endif

SHOGUN Machine Learning Toolbox - Documentation