MINT2
HyperBinningMakerMintSmart.cpp
Go to the documentation of this file.
2 
3 
4 
5 HyperBinningMakerMintSmart::HyperBinningMakerMintSmart(const HyperCuboid& binningRange,const HyperPointSet& data, int startingDim) :
6  HyperBinningMaker(binningRange, data),
7  _startingDim(startingDim)
8 {
9  WELCOME_LOG << "Good day from the HyperBinningMakerMintSmart() Constructor"<<std::endl;
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 ( splitAll(_binningDimensions.at(splitDim), 0.5) != 0){
26  if (nBins == getNumBins()) unchanged++;
27  else unchanged = 0;
28  if (unchanged >= dimension) break;
29  nBins = getNumBins();
30  if (s_printBinning == true) INFO_LOG << "There is now a total of " << nBins << " bins"<<std::endl;
31  splitDim++;
32  if( splitDim == dimension ) splitDim = 0;
33  if (s_printBinning == true) INFO_LOG << "Trying to split all bins in dimension " << _binningDimensions.at(splitDim)<<std::endl;
34  }
35 
36  nBins = 0;
37  unchanged = 0;
38 
39  while (smartSplitAll(_binningDimensions.at(splitDim), 0.5) != 0){
40  if (nBins == getNumBins()) unchanged++;
41  else unchanged = 0;
42  if (unchanged > dimension) break;
43  nBins = getNumBins();
44  if (s_printBinning == true) INFO_LOG << "There is now a total of " << nBins << " bins"<<std::endl;
45  splitDim++;
46  if( splitDim == dimension ) splitDim = 0;
47  if (s_printBinning == true) INFO_LOG << "Trying to split all bins in dimension " << _binningDimensions.at(splitDim)<<std::endl;
48  }
49 
50  if (s_printBinning == true) INFO_LOG << "Mint binning algorithm complete "<<std::endl;
51 
52 }
53 
55  GOODBYE_LOG << "Goodbye from the HyperBinningMakerMintSmart() Constructor"<<std::endl;
56 }
#define INFO_LOG
static bool s_printBinning
int splitAll(int dimension, double splitPoint)
#define GOODBYE_LOG
#define WELCOME_LOG
std::vector< int > _binningDimensions
HyperBinningMakerMintSmart(const HyperCuboid &binningRange, const HyperPointSet &data, int startingDim=0)
int smartSplitAll(int dimension, double dataFraction)