quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_stat.a #include <SupportVectorModel.h> SupportVectorModel(); SupportVectorModel(const SupportVectorModel& arg); boolean eq(const SupportVectorModel& arg) const; boolean assign(const SupportVectorModel& arg); boolean setNumSupportVectors(long number, ALGORITHM algorithm = DEF_ALGORITHM); VectorFloat& getSupportVector(long index); Kernel& getKernel(long index); Float& getAlpha(long index); float getDistance(); float getLogLikelihood(const VectorFloat& input);
description:VectorFloat support_vector0(L"2.3, 4.5"); VectorFloat support_vector1(L"1.3, -2.4"); VectorFloat alphas(L"0.4, 0.6"); VectorFloat test_vector(L"0.1, 0.3"); SupportVectorModel svm; svm.setNumSupportVectors(2); svm.getSupportVector(0) = support_vector(0); svm.getSupportVector(1) = support_vector(1); svm.getAlphas(0) = alphas(0); svm.getAlphas(1) = alphas(1); svm.getLogLikelihood(test_vector);
where |
static const String CLASS_NAME;
static const NameMap ALGO_MAP = L"SINGLE_KERNEL, MULTIPLE_KERNEL";
static const NameMap IMPL_MAP = L"SIGMOID, LOGISTIC, LOGSYM, TANH, SINUS, GAUSS, RANDOM";
static const String DEF_PARAM;
static const String PARAM_ALGORITHM;
static const String PARAM_IMPLEMENTATION;
static const String PARAM_SUPPORT_VECTORS;
static const String PARAM_KERNELS;
static const String PARAM_ALPHAS;
static const String PARAM_BIAS;
static const String PARAM_SIGMOID;
static const String DEF_COMMENT_TAG;
static const long ERR = 60350;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
Vector<VectorFloat> support_vectors_d;
Vector<Float> alphas_d;
Vector<Kernel> kernels_d;
Sigmoid sigmoid_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
setDebug is inherited from base class
~SupportVectorModel();
SupportVectorModel();
SupportVectorModel(const SupportVectorModel& arg);
boolean assign(const SupportVectorModel& arg);
SupportVectorModel& operator=(const SupportVectorModel& arg);
long sofSize() const;
long sofAccumulatorSize() const;
long sofOccupanciesSize() const;
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean readAccumulator(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean writeAccumulator(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readAccumulatorData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeAccumulatorData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean readOccupancies(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean writeOccupancies(Sof& sof, long tag, const String& cname = CLASS_NAME) const;
boolean readOccupanciesData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeOccupanciesData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean eq(const SupportVectorModel& arg) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);
boolean setAlgorithm(ALGORITHM algo);
ALGORITHM getAlgorithm();
boolean setImplementation(IMPLEMENTATION impl);
IMPLEMENTATION getImplementation();
boolean setNumSupportVectors(long number, ALGORITHM algorithm = DEF_ALGORITHM);
VectorFloat& getSupportVector(long index);
Kernel& getKernel(long index);
Double& getAlpha(long index);
Sigmoid& getSigmoid();
float getDistance();
boolean assign(const StatisticalModelBase& arg);
boolean eq(const StatisticalModelBase& arg);
boolean setMode(MODE mode);
const String& className() const;
boolean init();
float getLikelihood(const VectorFloat& input);
float getLogLikelihood(const VectorFloat& input);
boolean getMean(VectorFloat& mean);
boolean getCovariance(VectorFloat& cov);
boolean resetAccumulators();
boolean getOccupancy(double arg);
boolean setOccupancy(double arg);
long getAccessCount();
boolean setAccessCount(long arg);
boolean initialize(VectorFloat& param);
boolean accumulate(VectorFloat& param);
boolean accumulate(VectorDouble& param, VectorFloat& data, boolean precomp);
boolean update(VectorFloat& varfloor, long min_count);
// declare a SupportVectorModel object // SupportVectorModel svm; // set the mean and covariance matrix // VectorFloat vector0(L"1.0, -1.3, 1.4"); VectorFloat vector1(L"3.0, 1.2, -1.9"); svm.setNumSupportVectors(2); svm.getSupportVector(0) = vector0; svm.getSupportVector(1) = vector1; svm.getKernel(0).setAlgorithm(Kernel::RBF); // declare the input vector // VectorFloat input; input.assign(L"-1.050, -7.709, -2.303"); // get the log likelihood // Float likelihood = svm.getLogLikelihood(input);