helloworld.h File Reference

Go to the source code of this file.

Data Structures

struct  datum

Typedefs

typedef datum DATUM

Functions

void * plugin_null (void)
void * plugin_copy_constructor (void *words)
void * plugin_parse_document (char *line, double *label, long *queryid, long *slackid, double *costfactor, long int *highest_feature, long int max_words_doc, char **comment)
double plugin_kernel (void *, void *)
void plugin_write (FILE *, void *)
void plugin_destructor (void *)
void plugin_clip (void *, int)
void plugin_kernel_setparm (char *)


Typedef Documentation

typedef struct datum DATUM


Function Documentation

void plugin_clip ( void *  _words,
int  totwords 
)

This is not likely to be useful. Some kernels have an associated explicit feature space, allowing to calculate W from the support vectors, a trick that can speed up significantly the calculation of f(x). During test your object could have some feature index that goes bejond those observed during training so here you are supposed to clip extra features that do not have an associated component of W. In the default sparsevector module, this function just removes any word having index above totwords, the size of the training dictionary.

Definition at line 183 of file helloworld.c.

void* plugin_copy_constructor ( void *  _words  ) 

This function should make a copy of an instance and return the pointer It receives the memory address where the source object lives

Definition at line 49 of file helloworld.c.

void plugin_destructor ( void *  _words  ) 

Free memory associated with your object.

Definition at line 165 of file helloworld.c.

double plugin_kernel ( void *  _a,
void *  _b 
)

This function receives two pointers to SVECTOR data structures. In SVECTOR there may be some additional info besides the object itself (e.g. a weight). To access the object cast the pointers to SVECTOR* and access the void pointer words inside the struct. Then calculate whatever defines a kernel on your data type.

Definition at line 66 of file helloworld.c.

void plugin_kernel_setparm ( char *  kernel_parm  ) 

Use this function to pass extra parameters to the kernel plugin

Definition at line 193 of file helloworld.c.

void* plugin_null ( void   ) 

This function should return a pointer to an object that is mapped into the null vector in feature space. For example it might be an empty graph or an object with no features. It is used to calculate the smallest enclosing hypersphere in svm_learn.c

Definition at line 37 of file helloworld.c.

void* plugin_parse_document ( char *  line,
double *  label,
long *  queryid,
long *  slackid,
double *  costfactor,
long int *  highest_feature,
long int  max_words_doc,
char **  comment 
)

This function takes several arguments and is used to read examples (train) as well as support vectors (classification). Compared to the original SVMLight function, the second argument is now the returned object (NULL if fails) and the third-to-last argument *numwords is replaced here by the highest feature index found in this "document" (used for linear kernel optimization in svm_common)

Definition at line 91 of file helloworld.c.

References space_or_null(), and datum::x.

void plugin_write ( FILE *  os,
void *  _words 
)

Write an instance in a format that is compatible with the above reading function. Thus function is used to save support vectors in the model file.

Definition at line 155 of file helloworld.c.


Generated on Wed Sep 5 17:26:48 2007 for SVM-Dlight by  doxygen 1.5.1