![]() |
KSquare Utilities
|
Provides an interface to the svm.cpp functions. More...
#include "FirstIncludes.h"#include <algorithm>#include <ctype.h>#include "float.h"#include <fstream>#include <iostream>#include <math.h>#include <map>#include <numeric>#include <ostream>#include <set>#include <sstream>#include <stdio.h>#include <string>#include <time.h>#include <vector>#include "MemoryDebug.h"#include "KKBaseTypes.h"#include "OSservices.h"#include "SvmWrapper.h"#include "KKMLLTypes.h"#include "svm.h"Go to the source code of this file.
Macros | |
| #define | Malloc (type,n) (type *)malloc((n)*sizeof(type)) |
Functions | |
| void | ComputeProb (kkint32 numClasses, const VectorFloat &probClassPairs, vector< double > &dist, double **crossClassProbTable, kkint32 *votes, double *probabilities, kkint32 knownClassNum) |
| void | ComputeProbForVoting (kkint32 numClasses, float A, vector< double > &dist, double **crossClassProbTable, kkint32 *votes, double *probabilities, kkint32 knownClassNum, double confidence, double &compact) |
| template<class T > | |
| kkint32 | GetMaxIndex (vector< T > &vote, kkint32 voteLength, kkint32 &maxIndex2) |
| template<class T > | |
| kkint32 | GetMaxIndex (T *vote, kkint32 voteLength, kkint32 &maxIndex2) |
| bool | GreaterThan (kkint32 leftVotes, double leftProb, kkint32 rightVotes, double rightProb) |
| void | GreaterVotes (bool useProbability, kkint32 numClasses, kkint32 *votes, double *probabilities, kkint32 &pred1Idx, kkint32 &pred2Idx) |
| void | NormalizeProbabilitiesWithAMinumum (kkint32 numClasses, double *probabilities, double minProbability) |
| Will normailize probabilites such that the sum of all equal 1.0 and no one probability will be less than 'minProbability'. More... | |
| void | saveData (svm_problem ds, kkint32 begin, kkint32 end, std::string name) |
| void | saveData (svm_problem ds, kkint32 begin, kkint32 end, string name) |
Provides an interface to the svm.cpp functions.
Definition in file SvmWrapper.cpp.
| #define Malloc (type,n) (type *)malloc((n)*sizeof(type)) |
Definition at line 53 of file SvmWrapper.cpp.
| void ComputeProb | ( | kkint32 | numClasses, |
| const VectorFloat & | probClassPairs, | ||
| vector< double > & | dist, | ||
| double ** | crossClassProbTable, | ||
| kkint32 * | votes, | ||
| double * | probabilities, | ||
| kkint32 | knownClassNum | ||
| ) |
Definition at line 472 of file SvmWrapper.cpp.
| void ComputeProbForVoting | ( | kkint32 | numClasses, |
| float | A, | ||
| vector< double > & | dist, | ||
| double ** | crossClassProbTable, | ||
| kkint32 * | votes, | ||
| double * | probabilities, | ||
| kkint32 | knownClassNum, | ||
| double | confidence, | ||
| double & | compact | ||
| ) |
| numClasses | Number of Classes. |
| A | probability parameter |
| dist | Distances for each binary classifier from decision boundary. |
| crossClassProbTable | Two dimensional array that is 'numClass' by 'numClass'; will receive the probabilities between classes. |
| votes | Array 'numClasses' in length that will receive the number of Votes each class won. |
| probabilities | Array 'numClasses' in length that will receive the computed Probability for Each Class |
| knownClassNum | The Class that we know the example to be. |
| confidence | Used for calculating 'compact' probability must exceed this. |
| compact | 'knownClassNum' and 'confidence' need to be provided. |
Definition at line 287 of file SvmWrapper.cpp.
| kkint32 GetMaxIndex | ( | vector< T > & | vote, |
| kkint32 | voteLength, | ||
| kkint32 & | maxIndex2 | ||
| ) |
Definition at line 67 of file SvmWrapper.cpp.
Definition at line 108 of file SvmWrapper.cpp.
Definition at line 151 of file SvmWrapper.cpp.
Referenced by GreaterVotes().
| void GreaterVotes | ( | bool | useProbability, |
| kkint32 | numClasses, | ||
| kkint32 * | votes, | ||
| double * | probabilities, | ||
| kkint32 & | pred1Idx, | ||
| kkint32 & | pred2Idx | ||
| ) |
Definition at line 175 of file SvmWrapper.cpp.
References GreaterThan().
Referenced by KKMLL::SvmPredictClass().
| void NormalizeProbabilitiesWithAMinumum | ( | kkint32 | numClasses, |
| double * | probabilities, | ||
| double | minProbability | ||
| ) |
Will normailize probabilites such that the sum of all equal 1.0 and no one probability will be less than 'minProbability'.
| [in] | numClasses | Number of classes represented in array 'probabilities'. |
| [in,out] | probabilities | Probabilites that are to be adjusted. |
| [in] | minProbability | Smallest probablity that any one class can have assigned to it. |
Definition at line 255 of file SvmWrapper.cpp.
| void saveData | ( | svm_problem | ds, |
| kkint32 | begin, | ||
| kkint32 | end, | ||
| std::string | name | ||
| ) |
| void saveData | ( | svm_problem | ds, |
| kkint32 | begin, | ||
| kkint32 | end, | ||
| string | name | ||
| ) |
Definition at line 223 of file SvmWrapper.cpp.
References SVM233::svm_node::index, and SVM233::svm_problem::x.