RANSACReg.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * @file RANSACReg.h
  3. * @brief Implementation of RANSAC (RANdom SAmple Consensus) for regression purposes
  4. * @author Frank Prüfer
  5. * @date 09/10/2013
  6. */
  7. #ifndef RANSACREGINCLUDE
  8. #define RANSACREGINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "core/basics/Config.h"
  12. #include "vislearning/regression/regressionbase/RegressionAlgorithm.h"
  13. namespace OBJREC
  14. {
  15. class RANSACReg : public RegressionAlgorithm
  16. {
  17. protected:
  18. /** threshold value for determining when a datum fits a model */
  19. double threshold;
  20. /** mminimum number of data required to fit the model */
  21. uint n;
  22. /** number of iterations performed by the algorithm */
  23. uint iter;
  24. /** vector of model parameters */
  25. std::vector<double> modelParams;
  26. /** set of data points */
  27. NICE::VVector dataSet;
  28. /** set of responses according to dataset */
  29. std::vector<double> labelSet;
  30. public:
  31. /** simple constructor */
  32. RANSACReg ( const NICE::Config *conf );
  33. /** copy constructor */
  34. RANSACReg ( const RANSACReg & src );
  35. /** simple destructor */
  36. virtual ~RANSACReg();
  37. /** clone function */
  38. RANSACReg* clone (void) const;
  39. /** predict response using simple vector */
  40. double predict ( const NICE::Vector & x );
  41. /** teach whole set at once */
  42. void teach ( const NICE::VVector & dataSet, const NICE::Vector & labelSet );
  43. };
  44. } //namespace
  45. #endif