MINT2
HyperBinningMakerSmart.cpp
Go to the documentation of this file.
2 
3 
4 HyperBinningMakerSmart::HyperBinningMakerSmart(const HyperCuboid& binningRange, const HyperPointSet& data, int startingDim) :
5  HyperBinningMaker(binningRange, data),
6  _startingDim(startingDim)
7 {
8  WELCOME_LOG << "Good day from the HyperBinningMakerSmart() Constructor";
9 }
10 
12 
13  int dimension = _binningDimensions.size();
14 
15  int splitDim = _startingDim;
16  if (splitDim >= dimension) splitDim = 0;
17 
18  int nBins = 0;
19  int unchanged = 0;
20 
21  if (s_printBinning == true) INFO_LOG << "Splitting all bins in dimension " << _binningDimensions.at(splitDim) << std::endl;
22 
23  while (smartSplitAll(_binningDimensions.at(splitDim), 0.5) != 0){
24  if (nBins == getNumBins()) unchanged++;
25  else unchanged = 0;
26  if (unchanged > dimension) break;
27  nBins = getNumBins();
28  if (s_printBinning == true) INFO_LOG << "There is now a total of " << nBins << " bins"<< std::endl;
29  splitDim++;
30  if( splitDim == dimension ) splitDim = 0;
31  if (s_printBinning == true) INFO_LOG << "Trying to split all bins in dimension " << _binningDimensions.at(splitDim)<< std::endl;
32  }
33 
34  if (s_printBinning == true) INFO_LOG << "Smart binning algorithm complete"<< std::endl;
35 
36 }
37 
39  GOODBYE_LOG << "Goodbye from the HyperBinningMakerSmart() Constructor";
40 }
41 
42 
#define INFO_LOG
static bool s_printBinning
HyperBinningMakerSmart(const HyperCuboid &binningRange, const HyperPointSet &data, int startingDim=0)
#define GOODBYE_LOG
#define WELCOME_LOG
std::vector< int > _binningDimensions
int smartSplitAll(int dimension, double dataFraction)