00001 #ifndef INDII_ML_AUX_PARTITIONER_HPP 00002 #define INDII_ML_AUX_PARTITIONER_HPP 00003 00004 #include "DiracMixturePdf.hpp" 00005 00006 namespace indii { 00007 namespace ml { 00008 namespace aux { 00009 /** 00010 * Partitions a set of weighted points into two sets for constructing a 00011 * partition tree. 00012 * 00013 * @author Lawrence Murray <lawrence@indii.org> 00014 * @version $Rev: 541 $ 00015 * @date $Date: 2008-08-31 14:42:13 +0100 (Sun, 31 Aug 2008) $ 00016 */ 00017 class Partitioner { 00018 public: 00019 /** 00020 * Partitions. 00021 */ 00022 enum Partition { 00023 LEFT, 00024 RIGHT 00025 }; 00026 00027 /** 00028 * Destructor. 00029 */ 00030 virtual ~Partitioner(); 00031 00032 /** 00033 * Initialise the partitioner. 00034 * 00035 * @param p Weighted sample set. 00036 * @param is Indices of components of interest in the weighted sample 00037 * set. 00038 * 00039 * @return True if the partitioner is successful in finding a partition 00040 * point, false otherwise. The partitioner may be unsuccessful if, e.g., 00041 * all points are identical or one point in a pair has negligible small 00042 * or zero weight. 00043 * 00044 * Initialises the partitioner after construction, optionally using 00045 * the given weighted sample set as a basis for the partition (e.g. 00046 * using its bounds or covariance). 00047 */ 00048 virtual bool init(DiracMixturePdf* p, 00049 const std::vector<unsigned int>& is) = 0; 00050 00051 /** 00052 * Assign a sample to a partition. 00053 * 00054 * @param x The sample to assign. 00055 * 00056 * @return The partition to which the sample is assigned. 00057 */ 00058 virtual Partition assign(const vector& x) = 0; 00059 00060 }; 00061 00062 } 00063 } 00064 } 00065 00066 #endif 00067
1.5.3