helloworld.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "helloworld.h"
#include "svector.h"

Go to the source code of this file.

Defines

#define MULTK   0
#define MINK   1

Functions

int space_or_null (int c)
void * plugin_null (void)
void * plugin_copy_constructor (void *_words)
double plugin_kernel (void *_a, void *_b)
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)
void plugin_write (FILE *os, void *_words)
void plugin_destructor (void *_words)
void plugin_clip (void *_words, int totwords)
void plugin_kernel_setparm (char *kernel_parm)

Variables

int min_or_mult = 0


Define Documentation

#define MINK   1

Definition at line 20 of file helloworld.c.

Referenced by plugin_kernel_setparm().

#define MULTK   0

Definition at line 19 of file helloworld.c.

Referenced by plugin_kernel(), and plugin_kernel_setparm().


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.

Referenced by main().

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.

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.

int space_or_null ( int  c  ) 

Definition at line 24 of file helloworld.c.

Referenced by plugin_parse_document().


Variable Documentation

int min_or_mult = 0

Definition at line 22 of file helloworld.c.

Referenced by plugin_kernel(), and plugin_kernel_setparm().


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