OnlineLearnable.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef _NICE_ONLINELEARNABLEINCLUDE
  2. #define _NICE_ONLINELEARNABLEINCLUDE
  3. // NICE-core includes
  4. #include <core/vector/SparseVectorT.h>
  5. #include <core/vector/VectorT.h>
  6. namespace NICE {
  7. /**
  8. * @class OnlineLearnable
  9. * @brief Interface specifying learning algorithms implementing methods for online updates
  10. * @author Alexander Freytag
  11. * @date 01-01-2014 (dd-mm-yyyy)
  12. */
  13. class OnlineLearnable {
  14. public:
  15. // Interface specifications
  16. /**
  17. * @brief Interface method to add a single example to the current object
  18. * @author Alexander Freytag
  19. * @param newExample example to be added
  20. * @param newLabel corresponding class labels
  21. * @param performOptimizationAfterIncrement (optional) whether or not to run a hyper parameter optimization after adding new examples
  22. */
  23. virtual void addExample( const NICE::SparseVector * newExample,
  24. const double & newLabel,
  25. const bool & performOptimizationAfterIncrement = true
  26. ) = 0;
  27. /**
  28. * @brief Interface method to add multiple example to the current object
  29. * @author Alexander Freytag
  30. * @param newExamples vector of example to be added
  31. * @param newLabels vector of corresponding class labels
  32. * @param performOptimizationAfterIncrement (optional) whether or not to run a hyper parameter optimization after adding new examples
  33. */
  34. virtual void addMultipleExamples( const std::vector< const NICE::SparseVector * > & newExamples,
  35. const NICE::Vector & newLabels,
  36. const bool & performOptimizationAfterIncrement = true
  37. ) = 0;
  38. /**
  39. * @brief simple destructor
  40. * @author Alexander Freytag
  41. */
  42. virtual ~OnlineLearnable () {};
  43. /**
  44. * @brief simple destructor
  45. * @author Alexander Freytag
  46. */
  47. // just to prevent senseless compiler warnings
  48. OnlineLearnable() {};
  49. };
  50. } // namespace
  51. #endif