text: #include "HSTStructBatch.h"
  using namespace std;
  
  double runHSMass(vector <vector<float>> &data, int numTree, int numSub, int numDim, int* sizeLimit, int* depthLimit, int accumulateMasses, int splitPointStrategy, int scoring,
  int subSamplingSize, int randTraining){
  
      
      int numInst = data.size();
      int dimInst = data[0].size() - 1;
      
      //To store training and test times.
      double training_time, testing_time;
  
      time_t rseed=time(0);
      
      //Obtain the training and test indices.
      vector <int> trainingIndices;
      vector <int> testIndices;
  
      //Get the training and test indices.
      if(numSub<numInst){
  
          srand(rseed);
          
          //Randomly selected sub-samples
          vector<pair<int, int> > selectIndex;
          for(int j=0; j<numInst; j++){
              selectIndex.push_back(make_pair(rand(), j));
          }
          sort(selectIndex.begin(), selectIndex.end());
          for(int j=0; j<numInst; j++){
              if(j<numSub){
                  if(randTraining == 0){
                      trainingIndices.push_back(j);
                  }
                  else{
                      trainingIndices.push_back(selectIndex[j].second);
                  }
              }
              else{
                  if(randTraining == 0){
                      testIndices.push_back(j);
                  }
                  else{
                      testIndices.push_back(selectIndex[j].second);
                  }
              }
              if(numSub == 0){
                  if(randTraining == 0){
                      trainingIndices.push_back(j);
                  }
                  else{
                      trainingIndices.push_back(selectIndex[j].second);
                  }
              }
          }
      }
      else{
  
          for(int j=0; j<numInst; j++){
              trainingIndices.push_back(j);
          }
      }
  
      long int numNodes = 0;
  
      cout<<"Before creating forest\n";
      getPeakMemory();
      
      //Vector containing numTree vectors which store splitAttributes and splitPoints varying with depth.
      vector <vector< pair<unsigned int, float> >> splits;
      vector <float*> minAtt;
      vector <float*> maxAtt;
  
      long int sizeForest = 0;
  
      //Training the forest
      struct Forest forest = createForest(&sizeForest, splits, maxAtt, minAtt, &numNodes, data, trainingIndices, numTree, numDim, sizeLimit, depthLimit, rseed, &splitPointStrategy,
      &subSamplingSize);
      training_time = forest.elapsedTime; //Training time.
  
      cout<<"After creating forest\n";
      getPeakMemory();
  
      cout<<numNodes<<" nodes in the forest occupy "<<sizeForest<<" bytes in memory"<<"\n";
      
      vector <float> scores;
  
      //Estimate the mass.
      testing_time = estimate(splits, maxAtt, minAtt, &forest, data, testIndices, scores, &accumulateMasses, &scoring, subSamplingSize);
  
  
      cout<<"After testing forest\n";
      getPeakMemory();
  
      //Fetch the labels for every test instance.
      vector <int> labels;
      for(int i=0; i<testIndices.size(); i++){
          labels.push_back(data[testIndices[i]][dimInst]);
      }
  
      //Measure area under the ROC curve.
      double auc = measureAUC(scores, labels);
  
      float threshold = 0.05;
      vector <float> thresholds;
      for(int i=0; i<19; i++){
          thresholds.push_back(threshold * (i + 1));
      }
  
      measureScores(scores, labels, thresholds, depthLimit, &numSub, &scoring, &accumulateMasses, &subSamplingSize);
  
      //Print results.
      cout<<"Time taken to create the forest: "<<training_time<<"s Testing Time: "<<testing_time<<"s"<<" AUC Score: "<<auc<<"\n";
  
      return auc;
  
  
  
  
      
  }