IKMNoise.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * @file IKMNoise.h
  3. * @author Erik Rodner, Alexander Freytag
  4. * @brief Noise matrix (for model regularization) as an implicit kernel matrix (Interface)
  5. * @date 02/14/2012
  6. */
  7. #ifndef _NICE_IKMNOISEINCLUDE
  8. #define _NICE_IKMNOISEINCLUDE
  9. #include <vector>
  10. #include "ImplicitKernelMatrix.h"
  11. namespace NICE {
  12. /**
  13. * @class IKMNoise
  14. * @brief Noise matrix (for model regularization) as an implicit kernel matrix
  15. * @author Erik Rodner, Alexander Freytag
  16. */
  17. class IKMNoise : public ImplicitKernelMatrix
  18. {
  19. protected:
  20. Vector labels;
  21. uint size;
  22. double noise;
  23. bool optimizeNoise;
  24. uint np;
  25. uint nn;
  26. /** give some debug outputs. There is not set function so far... */
  27. bool verbose;
  28. public:
  29. IKMNoise();
  30. IKMNoise( uint size, double noise, bool optimizeNoise );
  31. IKMNoise( const Vector & labels, double noise, bool optimizeNoise );
  32. virtual ~IKMNoise();
  33. virtual void getDiagonalElements ( Vector & diagonalElements ) const;
  34. virtual void getFirstDiagonalElement ( double & diagonalElement ) const;
  35. virtual uint getNumParameters() const;
  36. virtual void getParameters(Vector & parameters) const;
  37. virtual void setParameters(const Vector & parameters);
  38. virtual bool outOfBounds(const Vector & parameters) const;
  39. virtual Vector getParameterLowerBounds() const;
  40. virtual Vector getParameterUpperBounds() const;
  41. /** multiply with a vector: A*x = y */
  42. virtual void multiply (NICE::Vector & y, const NICE::Vector & x) const;
  43. /** get the number of rows in A */
  44. virtual uint rows () const;
  45. /** get the number of columns in A */
  46. virtual uint cols () const;
  47. virtual double approxFrobNorm() const;
  48. virtual void setApproximationScheme(const int & _approxScheme) {};
  49. /** Persistent interface */
  50. virtual void restore ( std::istream & is, int format = 0 );
  51. virtual void store ( std::ostream & os, int format = 0 ) const;
  52. virtual void clear () {};
  53. void addExample(const NICE::SparseVector & x, const NICE::Vector & binLabels);
  54. };
  55. }
  56. #endif