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