/**
* @file RegKNN.h
* @brief Implementation of k-Nearest-Neighbor algorithm for regression purposes
* @author Frank Prüfer
* @date 08/29/2013

*/ 
#ifndef REGKNNINCLUDE
#define REGKNNINCLUDE

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

#include "core/basics/Config.h"

#include <core/vector/Distance.h>

#include "vislearning/regression/regressionbase/RegressionAlgorithm.h"

namespace OBJREC
{ 
class RegKNN : public RegressionAlgorithm
{
  protected:
    int K;
    
    /** set of data points */
    NICE::VVector dataSet;
    
    /** set of responses according to dataset */
    std::vector<double> labelSet;
    
    /** used distance function */
    NICE::VectorDistance<double> *distancefunc;
  
  public:
    /** simple constructor */
    RegKNN ( const NICE::Config *conf, NICE::VectorDistance<double> *distancefunc = NULL );
    
    /** copy constructor */
    RegKNN ( const RegKNN & src );
    
    /** simple destructor */
    virtual ~RegKNN();
    
    /** clone function */
    RegKNN* clone (void) const;
    
    /** predict response using simple vector */
    double predict ( const NICE::Vector & x );
    
    /** teach whole set at once */
    void teach ( const NICE::VVector & dataSet, const NICE::Vector & labelSet );

    /** teach one data point at a time */
    void teach ( const NICE::Vector & x, const double & y );
};

}	//namespace

#endif