plugin.h File Reference

#include <stdio.h>

Go to the source code of this file.

Functions

void plugin_init (char *plugin_file)
void plugin_exit ()
void * plugin_null (void)
void * plugin_copy_constructor (void *words)
void * plugin_parse_document (char *line, double *alphay, long *queryid, long *slackid, double *costfactor, long *highest_feature, long max_words, char **comment)
double plugin_kernel (void *a, void *b)
void plugin_write (FILE *, void *)
void plugin_destructor (void *)
void plugin_clip (void *, int)
void plugin_kernel_setparm (char *kernel_parm)


Function Documentation

void plugin_clip ( void *  words,
int  maxwords 
)

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.

References plugin_clip_fcn.

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.

References plugin_copy_constructor_fcn, and datum::x.

void plugin_destructor ( void *  words  ) 

Free memory associated with your object.

Definition at line 165 of file helloworld.c.

References plugin_destructor_fcn.

void plugin_exit (  ) 

Definition at line 117 of file plugin.c.

References dl_library, plugin_clip_fcn, plugin_copy_constructor_fcn, plugin_destructor_fcn, plugin_kernel_fcn, plugin_null_fcn, plugin_parse_document_fcn, and plugin_write_fcn.

Referenced by plugin_init().

void plugin_init ( char *  plugin_file  ) 

Definition at line 35 of file plugin.c.

References dl_library, empty_function(), plugin_clip_fcn, plugin_copy_constructor_fcn, plugin_destructor_fcn, plugin_exit(), plugin_kernel_fcn, plugin_kernel_setparm_fcn, plugin_null_fcn, plugin_parse_document_fcn, and plugin_write_fcn.

Referenced by main().

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.

References min_or_mult, MULTK, plugin_kernel_fcn, and svector::words.

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.

References min_or_mult, MINK, MULTK, and plugin_kernel_setparm_fcn.

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.

References plugin_null_fcn, and datum::x.

void* plugin_parse_document ( char *  line,
double *  alphay,
long *  queryid,
long *  slackid,
double *  costfactor,
long *  highest_feature,
long  max_words,
char **  comment 
)

void plugin_write ( FILE *  fl,
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.

References plugin_write_fcn.


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