MINT2
HyperBinningMakerMultiSmart.cpp
Go to the documentation of this file.
2 
3 
4 
5 HyperBinningMakerMultiSmart::HyperBinningMakerMultiSmart(const HyperCuboid& binningRange, const HyperPointSet& data, int startingDim) :
6  HyperBinningMaker(binningRange, data),
7  _startingDim(startingDim)
8 {
9  WELCOME_LOG << "Good day from the HyperBinningMakerMultiSmart() Constructor";
10  //makeBinning(startingDim);
11 }
12 
14 
15  int dimension = _binningDimensions.size();
16 
17  int splitDim = _startingDim;
18  if (splitDim >= dimension) splitDim = 0;
19 
20  int nBins = 0;
21  int unchanged = 0;
22 
23  if (s_printBinning == true) INFO_LOG << "Splitting all bins in dimension " << _binningDimensions.at(splitDim) << std::endl;
24 
25  while (smartMultiSplitAll(_binningDimensions.at(splitDim)) != -1){
27  if (nBins == getNumBins()) unchanged++;
28  else unchanged = 0;
29  if (unchanged > dimension) break;
30  nBins = getNumBins();
31  if (s_printBinning == true) INFO_LOG << "There is now a total of " << nBins << " bins"<< std::endl;
32  splitDim++;
33  if( splitDim == dimension ) splitDim = 0;
34  if (s_printBinning == true) INFO_LOG << "Trying to split all bins in dimension " << _binningDimensions.at(splitDim)<< std::endl;
35  }
36 
37  INFO_LOG << "Gone as far as possible with MultiSplit - now trying SmartSplit " << std::endl;
38  unchanged = 0;
39 
40  while (smartSplitAll(_binningDimensions.at(splitDim), 0.5) != -1){
42  if (nBins == getNumBins()) unchanged++;
43  else unchanged = 0;
44  if (unchanged > dimension) break;
45  nBins = getNumBins();
46  if (s_printBinning == true) INFO_LOG << "There is now a total of " << nBins << " bins"<< std::endl;
47  splitDim++;
48  if( splitDim == dimension ) splitDim = 0;
49  if (s_printBinning == true) INFO_LOG << "Trying to split all bins in dimension " << _binningDimensions.at(splitDim)<< std::endl;
50  }
51 
52 
53  if (s_printBinning == true) INFO_LOG << "Smart binning algorithm complete"<< std::endl;
54 
55 }
56 
58  GOODBYE_LOG << "Goodbye from the HyperBinningMakerMultiSmart() Constructor";
59 }
int smartMultiSplitAll(int dimension)
#define INFO_LOG
static bool s_printBinning
virtual void finishedIteration()
#define GOODBYE_LOG
HyperBinningMakerMultiSmart(const HyperCuboid &binningRange, const HyperPointSet &data, int startingDim=0)
#define WELCOME_LOG
std::vector< int > _binningDimensions
int smartSplitAll(int dimension, double dataFraction)