Last update: $Date: 2001/09/04 16:10:56 $
namespace TinySVM { class Param { public: int set (int, char **); int set (const char *); }; };
TinySVM::Param::set (int argc, char **argv)
TinySVM::Param::set (const char *s)
namespace TinySVM { class BaseExample { public: int add (const double, feature_node *); int add (const double, const char *); int add (const char *); int set (int i, const double, feature_node *); int set (int i, const double, const char *); int set (int i, const char *); int remove (int i); int clear (); int size (); virtual int read (const char *, const char *mode = "r", const int offset = 0) = 0; virtual int write (const char *, const char *mode = "w", const int offset = 0) = 0; int readSVindex (const char *, const char *mode = "r", const int offset = 0); int writeSVindex (const char *, const char *mode = "w", const int offset = 0); }; };
TinySVM::BaseExample is a base class for TinySVM::Example and TinySVM::Model. You need not use this class directly.
TinySVM::BaseExample::add (const double y, feature_node *x)
TinySVM::BaseExample::add (const double y, char *x)
TinySVM::BaseExample::add (char *s)
TinySVM::BaseExample::set(int i const double y, feature_node *x)
TinySVM::BaseExample::set (int i const double y, char *x)
TinySVM::BaseExample::set (int i char *s)
TinySVM::BaseExample::remove (int i)
TinySVM::BaseExample::clear ()
TinySVM::BaseExample::size ()
TinySVM::BaseExample::read (const char *file_name, const char *mode ="r", const int offset = 0)
TinySVM::BaseExample::write (const char *file_name, const char *mode ="w", const int offset = 0)
TinySVM::BaseExample::writeSVindex (const char *file_name const char *mode = "w", const int offset = 0)
TinySVM::BaseExample::readSVindex (const char *file_name const char *mode = "w", const int offset = 0)
namespace TinySVM { class Example: public BaseExample { public: Model *learn (const Param &); Model *learn (const char *); int rebuildSVindex (Model *); }; };
TinySVM::Example class inherits it's interface from TinySVM::BaseExample class. You can use all member functions defined in TinySVM::BaseExample class.
TinySVM::Example::learn (const TinySVM::Param &p)
TinySVM::Example::learn (const char *s)
TinySVM::Example::rebuldSVindex (const TinySVM::Model *m)
namespace TinySVM { class Model: public BaseExample { public: Model (); Model (const Param &); double classify (const char *); double classify (const feature_node *); double estimateMargin (); double estimateVC (); double estimateXA (const double rho = 2.0); double estimateSphere (); double getLoss (); int compress (); int getSVnum (); int getBSVnum(); int getTrainingDataSize(); }; };
TinySVM::Model class inherits it's interface from TinySVM::BaseExample class. You can use all member functions defined in TinySVM::BaseExample class.
TinySVM::Model::Model (const TinySVM::Param &p)
TinySVM::Model::classify (const char *s)
TinySVM::Model::classify (const feature_node *f)
TinySVM::Model::estimateMargin ()
TinySVM::Model::estimateVC ()
TinySVM::Model::estimateXA(const double rho = 2.0 )
TinySVM::Model::estimateSphere ()
TinySVM::Model::getSVnum ()
TinySVM::Model::getBSVnum ()
TinySVM::Model::getTrainingDataSize ()
TinySVM::Model::getLoss ()
TinySVM::Model::compress ()
#include <tinysvm.h> TinySVM::Example e; TinySVM::Param p; if (! e.read(file-name)) throw; if (! p.set("-t 1 -d 2 -c 1")) throw; TinySVM::Model *m = e.learn(p); m->write(model-file); delete m;
#include <tinysvm.h> TinySVM::Model m; if (! m.read(model-file)) throw; cout << m.classify("1:1 2:1 3:1 4:1") << endl;
c++ -I/usr/local/include -L/usr/local/lib sample.cc -o sample -ltinysvm
$Id: libtinysvm.html,v 1.11 2001/09/04 16:10:56 taku-ku Exp $;
taku-ku@is.aist-nara.ac.jp