SHOGUN  v2.0.0
 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 <stdio.h>
15 #include <shogun/lib/common.h>
16 #include <shogun/io/SGIO.h>
19 
20 namespace shogun
21 {
22 class CDistanceMachine;
23 
38 {
39  public:
41  CHierarchical();
42 
48  CHierarchical(int32_t merges, CDistance* d);
49  virtual ~CHierarchical();
50 
53 
59 
65  virtual bool load(FILE* srcfile);
66 
72  virtual bool save(FILE* dstfile);
73 
78  inline void set_merges(int32_t m)
79  {
80  ASSERT(m>0);
81  merges=m;
82  }
83 
88  int32_t get_merges();
89 
94 
99 
104 
106  inline virtual const char* get_name() const { return "Hierarchical"; }
107 
108  protected:
117  virtual bool train_machine(CFeatures* data=NULL);
118 
122  virtual void store_model_features();
123 
124  virtual bool train_require_labels() const { return false; }
125 
126  protected:
128  int32_t merges;
129 
131  int32_t dimensions;
132 
135 
137  int32_t* assignment;
138 
140  int32_t table_size;
141 
143  int32_t* pairs;
144 
147 };
148 }
149 #endif

SHOGUN Machine Learning Toolbox - Documentation