RegressionAlgorithmKernel.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * @file RegressionAlgorithmKernel.h
  3. * @brief interface for a regression algorithm which is based on kernels
  4. * @author Erik Rodner
  5. * @date 12/09/2009
  6. */
  7. #ifndef REGRESSIONALGORITHMKERNELINCLUDE
  8. #define REGRESSIONALGORITHMKERNELINCLUDE
  9. #include "vislearning/math/kernels/Kernel.h"
  10. #include "vislearning/math/kernels/KernelData.h"
  11. #include "RegressionAlgorithm.h"
  12. namespace OBJREC {
  13. /** interface for a regression algorithm which is based on kernels */
  14. class RegressionAlgorithmKernel : public RegressionAlgorithm
  15. {
  16. protected:
  17. NICE::VVector X;
  18. NICE::Vector y;
  19. NICE::Config conf;
  20. Kernel *kernelFunction;
  21. public:
  22. /** simple constructor */
  23. RegressionAlgorithmKernel( const NICE::Config *conf, Kernel *kernelFunction = NULL );
  24. /** copy constructor */
  25. RegressionAlgorithmKernel( const RegressionAlgorithmKernel & src );
  26. /** simple destructor */
  27. virtual ~RegressionAlgorithmKernel();
  28. /** learn parameters/models/whatever with a kernel matrix (contained in a general structure kernel data)
  29. * of a set
  30. * of vectors and the corresponding function values \c y
  31. */
  32. virtual void teach ( KernelData *kernelData, const NICE::Vector & y ) = 0;
  33. /** predict the function value for a vector by using its kernel values with
  34. * the used training set, be careful with the order in \c kernelVector
  35. */
  36. virtual double predictKernel ( const NICE::Vector & kernelVector, double kernelSelf ) = 0;
  37. // functions to build an interface to RegressionAlgorithm
  38. /** learn parameters/models/whatever using a set of vectors and
  39. * their corresponding function values
  40. */
  41. void teach ( const NICE::VVector & X, const NICE::Vector & y );
  42. /** predict the function value for \c x */
  43. double predict ( const NICE::Vector & x );
  44. /** clone function */
  45. virtual RegressionAlgorithmKernel *clone(void) const {
  46. fthrow(Exception, "clone() not yet implemented!\n");
  47. }
  48. };
  49. }
  50. #endif