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 00040 class CSplittingStrategy: public CSGObject 00041 { 00042 public: 00044 CSplittingStrategy(); 00045 00051 CSplittingStrategy(CLabels* labels, index_t num_subsets); 00052 00054 virtual ~CSplittingStrategy(); 00055 00065 SGVector<index_t> generate_subset_indices(index_t subset_idx); 00066 00076 SGVector<index_t> generate_subset_inverse(index_t subset_idx); 00077 00079 index_t get_num_subsets() const; 00080 00086 virtual void build_subsets()=0; 00087 00088 protected: 00091 void reset_subsets(); 00092 00093 private: 00094 void init(); 00095 00096 00097 protected: 00098 00100 CLabels* m_labels; 00101 00103 CDynamicObjectArray* m_subset_indices; 00104 00106 index_t m_num_subsets; 00107 00110 bool m_is_filled; 00111 }; 00112 } 00113 00114 #endif /* __SPLITTINGSTRATEGY_H_ */