00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2011 Heiko Strathmann 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 00011 #ifndef __SPLITTINGSTRATEGY_H_ 00012 #define __SPLITTINGSTRATEGY_H_ 00013 00014 #include <shogun/base/SGObject.h> 00015 #include <shogun/lib/DynamicArray.h> 00016 #include <shogun/lib/DynamicObjectArray.h> 00017 00018 namespace shogun 00019 { 00020 00021 class CLabels; 00022 00034 class CSplittingStrategy: public CSGObject 00035 { 00036 public: 00038 CSplittingStrategy(); 00039 00045 CSplittingStrategy(CLabels* labels, index_t num_subsets); 00046 00048 virtual ~CSplittingStrategy(); 00049 00057 SGVector<index_t> generate_subset_indices(index_t subset_idx); 00058 00066 SGVector<index_t> generate_subset_inverse(index_t subset_idx); 00067 00069 index_t get_num_subsets() const { 00070 return m_subset_indices->get_num_elements(); 00071 } 00072 00074 inline virtual const char* get_name() const { return "SplittingStrategy"; } 00075 00076 protected: 00082 virtual void build_subsets()=0; 00083 00084 private: 00085 void init(); 00086 00087 protected: 00088 00090 CLabels* m_labels; 00092 CDynamicObjectArray<CDynamicArray<index_t> >* m_subset_indices; 00093 }; 00094 } 00095 00096 #endif /* __SPLITTINGSTRATEGY_H_ */