/**
* @file RTBClusterRandom.h
* @brief random regression tree
* @author Sven Sickert
* @date 07/19/2013

*/
#ifndef RTBCLUSTERRANDOMINCLUDE
#define RTBCLUSTERRANDOMINCLUDE

#include <vector>

#include "core/vector/VectorT.h"
#include "core/vector/VVector.h"

#include "core/basics/Config.h"
#include "RegressionTreeBuilder.h"


namespace OBJREC {

/** random regression tree */
class RTBClusterRandom : public RegressionTreeBuilder
{
  
  protected:
    int max_depth;
    int min_examples;
    
    /** save indices in leaves */
    bool save_indices;

    RegressionNode *buildRecursive ( const NICE::VVector & x,
          const NICE::Vector & y,
          std::vector<int> & selection,
          int depth);

    bool balancingLeftRight ( const std::vector< std::pair< double, int > > values,
          double threshold,
          int & count_left,
          int & count_right );

  public:
    
    /** simple constructor */
    RTBClusterRandom( const NICE::Config *conf, std::string section = "RTBClusterRandom" );
    
    /** simple destructor */
    virtual ~RTBClusterRandom();
    
    RegressionNode *build ( const NICE::VVector & x,
          const NICE::Vector & y );
    
};
  
  
}

#endif