RegressionAlgorithmKernel.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. {
  14. /** interface for a regression algorithm which is based on kernels */
  15. class RegressionAlgorithmKernel : public RegressionAlgorithm
  16. {
  17. protected:
  18. NICE::VVector X;
  19. NICE::Vector y;
  20. NICE::Config conf;
  21. Kernel *kernelFunction;
  22. public:
  23. /** simple constructor */
  24. RegressionAlgorithmKernel ( const NICE::Config *conf, Kernel *kernelFunction = NULL );
  25. /** copy constructor */
  26. RegressionAlgorithmKernel ( const RegressionAlgorithmKernel & src );
  27. /** simple destructor */
  28. virtual ~RegressionAlgorithmKernel();
  29. /** learn parameters/models/whatever with a kernel matrix (contained in a general structure kernel data)
  30. * of a set
  31. * of vectors and the corresponding function values \c y
  32. */
  33. virtual void teach ( KernelData *kernelData, const NICE::Vector & y ) = 0;
  34. /** predict the function value for a vector by using its kernel values with
  35. * the used training set, be careful with the order in \c kernelVector
  36. */
  37. virtual double predictKernel ( const NICE::Vector & kernelVector, double kernelSelf ) = 0;
  38. // functions to build an interface to RegressionAlgorithm
  39. /** learn parameters/models/whatever using a set of vectors and
  40. * their corresponding function values
  41. */
  42. void teach ( const NICE::VVector & X, const NICE::Vector & y );
  43. /** predict the function value for \c x */
  44. double predict ( const NICE::Vector & x );
  45. /** clone function */
  46. virtual RegressionAlgorithmKernel *clone ( void ) const
  47. {
  48. fthrow ( NICE::Exception, "clone() not yet implemented!\n" );
  49. }
  50. };
  51. }
  52. #endif