Documentation - C API
svmdataset.h File Reference

SVM Dataset. More...

#include "generic.h"

Data Structures

struct  VlSvmDataset
 Svm Dataset. More...

Typedefs

typedef void(* VlSvmDatasetFeatureMap )(const void *map, double *destination, const vl_size stride, const double x)
 Pointer to a function that maps the value in to using the feature map .
typedef double(* VlSvmDatasetInnerProduct )(const void *data, const vl_uindex element, const double *model)
 Pointer to a function that defines the inner product between the data point at position and the SVM model.
typedef void(* VlSvmDatasetAccumulator )(const void *data, const vl_uindex element, double *model, const double multiplier)
 Pointer to a function that adds to the data point at position multiplied by the constant .

Functions

vl_size vl_svmdataset_get_map_order (VlSvmDataset const *self)
 Get Feature Map Order.
Create and destroy
VlSvmDatasetvl_svmdataset_new (void *data, vl_size dimension)
 Create a new SVM dataset structure.
void vl_svmdataset_delete (VlSvmDataset *dataset)
 Delete a SVM dataset structure.
Set map
void vl_svmdataset_set_map (VlSvmDataset *data, void *map, VlSvmDatasetFeatureMap mapFunc, vl_size order)
 Set feature map.
Standard dataset functions
double vl_svmdataset_innerproduct_d (const void *data, const vl_uindex element, const double *model)
void vl_svmdataset_accumulator_d (const void *data, const vl_uindex element, double *model, const double multiplier)
double vl_svmdataset_innerproduct_f (const void *data, const vl_uindex element, const double *model)
void vl_svmdataset_accumulator_f (const void *data, const vl_uindex element, double *model, const double multiplier)
Retrieve data and parameters
void * vl_svmdataset_get_data (VlSvmDataset const *self)
 Get Data.
vl_size vl_svmdataset_get_dimension (VlSvmDataset const *self)
 Get Data Dimension.
void * vl_svmdataset_get_map (VlSvmDataset const *self)
 Get Feature Map Object.
VlSvmDatasetFeatureMap vl_svmdataset_get_map_func (VlSvmDataset const *self)
 Get Feature Map Function.
vl_size vl_svmdataset_get_order (VlSvmDataset const *self)

Detailed Description

Any SVM solver requires a set of training data in order to learn a correspondent classifier.

Regardless the kind of SVM solver, the training data is used and accessed in a similar manner.

In svmdataset.h we define an abstraction that separates the particular SVM algorithm from the representation of the data. Such abstraction is defined via two type of functions:

The above type of functions define the two typical operations performed by SVM solvers on the training data. Any particular application can define its own data representation and implement the above functions.

For double and float arrays we provide the implementation of the aforementioned functions.

We define also an utility struct VlSvmDataset that implements the online expansions of data points. This allows the use of techniques such homogeneous kernel maps [17] inside the SVM solver.

Author:
Daniele Perrone

Function Documentation

void vl_svmdataset_delete ( VlSvmDataset dataset)
Parameters:
datasetSVM dataset to delete.

The function frees the resources allocated by vl_svmdataset_new(). Notice that only the structure will be freed and not the raw data referred by the pointer .

void * vl_svmdataset_get_data ( VlSvmDataset const *  self)
inline
Parameters:
selfSvm Dataset.
Returns:
data pointer.
vl_size vl_svmdataset_get_dimension ( VlSvmDataset const *  self)
inline
Parameters:
selfSvm Dataset.
Returns:
data dimension.
void * vl_svmdataset_get_map ( VlSvmDataset const *  self)
inline
Parameters:
selfSvm Dataset.
Returns:
feature map.
VlSvmDatasetFeatureMap vl_svmdataset_get_map_func ( VlSvmDataset const *  self)
inline
Parameters:
selfSvm Dataset.
Returns:
feature map function.
vl_size vl_svmdataset_get_map_order ( VlSvmDataset const *  self)
inline
Parameters:
selfSvm Dataset.
Returns:
feature map order.
VlSvmDataset* vl_svmdataset_new ( void *  data,
vl_size  dimension 
)
Parameters:
datapointer to data.
dimensiondata point dimension.
Returns:
the new SVM dataset structure.

The function allocates and returns a new SVM dataset structure.

The data pointed by is not replicated, so the caller should keep the data allocated for the full usage of the structure.

See also:
vl_svmdataset_delete().
void vl_svmdataset_set_map ( VlSvmDataset data,
void *  map,
VlSvmDatasetFeatureMap  mapFunc,
vl_size  order 
)
Parameters:
dataSVM dataset Structure
mappointer to Feature Map Object
mapFuncfunction that perform the feature map
orderorder of the map

The function sets a feature map to the SVM dataset . The dimension of the extended data points is /f$2*order + 1/f$.