You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.7 KiB

8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /** @file svmdataset.h
  2. ** @brief SVM Dataset
  3. ** @author Daniele Perrone
  4. ** @author Andrea Vedaldi
  5. **/
  6. /*
  7. Copyright (C) 2012 Daniele Perrone.
  8. Copyright (C) 2013 Andrea Vedaldi.
  9. All rights reserved.
  10. This file is part of the VLFeat library and is made available under
  11. the terms of the BSD license (see the COPYING file).
  12. */
  13. #ifndef VL_SVMDATASET_H
  14. #define VL_SVMDATASET_H
  15. #include "generic.h"
  16. #include "homkermap.h"
  17. struct VlSvm_ ;
  18. /** @typedef VlSvmDataset
  19. ** @brief SVM dataset object
  20. **
  21. ** This objects contain a training set to be used in combination with
  22. ** the SVM solver object ::VlSvm. Its main purpose is to implement
  23. ** the two basic operations inner product (::VlSvmInnerProductFunction)
  24. ** and accumulation (::VlSvmAccumulateFunction).
  25. **
  26. ** See @ref svm and @ref svm-advanced for further information.
  27. **/
  28. #ifndef __DOXYGEN__
  29. struct VlSvmDataset_ ;
  30. typedef struct VlSvmDataset_ VlSvmDataset ;
  31. #else
  32. typedef OPAQUE VlSvmDataset ;
  33. #endif
  34. /** @name SVM callbacks
  35. ** @{ */
  36. typedef void (*VlSvmDiagnosticFunction) (struct VlSvm_ *svm, void *data) ;
  37. typedef double (*VlSvmLossFunction) (double inner, double label) ;
  38. typedef double (*VlSvmDcaUpdateFunction) (double alpha, double inner, double norm2, double label) ;
  39. typedef double (*VlSvmInnerProductFunction)(const void *data, vl_uindex element, double *model) ;
  40. typedef void (*VlSvmAccumulateFunction) (const void *data, vl_uindex element, double *model, double multiplier) ;
  41. /* typedef double (*VlSvmSquareNormFunction) (const void *data, vl_uindex element) ; */
  42. /** @} */
  43. /** @name Create and destroy
  44. ** @{
  45. **/
  46. VL_EXPORT VlSvmDataset* vl_svmdataset_new (vl_type dataType, void *data, vl_size dimension, vl_size numData) ;
  47. VL_EXPORT void vl_svmdataset_delete (VlSvmDataset * dataset) ;
  48. /** @} */
  49. /** @name Set parameters
  50. ** @{
  51. **/
  52. VL_EXPORT void vl_svmdataset_set_homogeneous_kernel_map (VlSvmDataset * self,
  53. VlHomogeneousKernelMap * hom) ;
  54. /** @} */
  55. /** @name Get data and parameters
  56. ** @{
  57. **/
  58. VL_EXPORT void* vl_svmdataset_get_data (VlSvmDataset const *self) ;
  59. VL_EXPORT vl_size vl_svmdataset_get_num_data (VlSvmDataset const *self) ;
  60. VL_EXPORT vl_size vl_svmdataset_get_dimension (VlSvmDataset const *self) ;
  61. VL_EXPORT void* vl_svmdataset_get_map (VlSvmDataset const *self) ;
  62. VL_EXPORT vl_size vl_svmdataset_get_mapDim (VlSvmDataset const *self) ;
  63. VL_EXPORT VlSvmAccumulateFunction vl_svmdataset_get_accumulate_function (VlSvmDataset const *self) ;
  64. VL_EXPORT VlSvmInnerProductFunction vl_svmdataset_get_inner_product_function (VlSvmDataset const * self) ;
  65. VL_EXPORT VlHomogeneousKernelMap * vl_svmdataset_get_homogeneous_kernel_map (VlSvmDataset const * self) ;
  66. /** @} */
  67. /* VL_SVMDATASET_H */
  68. #endif