28 #ifndef _FEATURENUMLIST_ 36 #ifndef _FEATUREENCODER_ 180 MLClassPtr knownClass,
181 MLClassPtr& predClass1,
182 MLClassPtr& predClass2,
185 double& probOfKnownClass,
186 double& predClass1Prob,
187 double& predClass2Prob,
189 bool& knownClassOneOfTheWinners,
198 MLClassPtr & predClass,
217 double* _probabilities,
276 double** crossProbTable,
299 void DeleteModels ();
300 void DeleteXSpaces ();
302 void AllocateModels ();
303 void AllocateXSpaces ();
305 void BuildClassIdxTable ();
308 void BuildCrossClassProbTable ();
360 BinaryClassParmsPtr& _twoClassParms,
373 double* _probabilities,
383 void CalculatePredictXSpaceNeeded (
RunLog& log);
430 bool GreaterThan (
kkint32 leftVotes,
438 void GreaterVotes (
bool useProbability,
442 double* probabilities,
448 void InializeProbClassPairs ();
461 MLClassPtr knownClass,
462 MLClassPtr &predClass1,
463 MLClassPtr& predClass2,
464 double& probOfKnownClass,
465 double& predClass1Prob,
466 double& predClass2Prob,
468 bool& knownClassOneOfTheWinners,
475 MLClassPtr knownClass,
476 MLClassPtr &predClass1,
477 MLClassPtr& predClass2,
480 double& probOfKnownClass,
481 double& predClass1Prob,
482 double& predClass2Prob,
485 bool& knownClassOneOfTheWinners
493 BinaryClassParmsPtr* binaryParameters;
496 volatile bool cancelFlag;
500 MLClassPtr* classIdxTable;
504 double** crossClassProbTable;
506 kkint32 crossClassProbTableSize;
526 double* probabilities;
kkint32 MemoryConsumedEstimated() const
ClassAssignments * ClassAssignmentsPtr
FeatureVector * FeatureVectorPtr
void SupportVectorStatistics(kkint32 &numSVs, kkint32 &totalNumSVs)
Keeps track of selected features.
virtual void CancelFlag(bool _cancelFlag)
FeatureNumListConstPtr GetFeatureNums() const
std::vector< ProbNamePair > FindWorstSupportVectors2(FeatureVectorPtr example, kkint32 numToFind, MLClassPtr c1, MLClassPtr c2)
For a given two class pair return the names of the 'numToFind' worst S/V's.
ProbNamePair(KKStr _name, double _probability)
SVM_SelectionMethod SelectionMethod() const
FeatureNumList const FeatureNumListConst
MLClassPtr Predict(FeatureVectorPtr example)
const ClassAssignments & Assignments() const
SVMModel()
Default constructor used by XmlElementSVMModel to create and load a new instance from a XML Stream...
FeatureNumListConstPtr GetFeatureNums(FileDescPtr fileDesc) const
unsigned __int32 kkuint32
Container class for FeatureVector derived objects.
kkint32 NumOfClasses() const
struct svm_node * XSpacePtr
FeatureNumList * FeatureNumListPtr
KKStr(const KKStr &str)
Copy Constructor.
virtual ~SVMModel()
Frees any memory allocated by, and owned by the SVMModel.
const KKStr & RootFileName() const
XmlTag const * XmlTagConstPtr
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
XmlElementTemplate< SVMModel > XmlElementSVMModel
std::vector< KKStr > SupportVectorNames() const
double DistanceFromDecisionBoundary(FeatureVectorPtr example, MLClassPtr class1, MLClassPtr class2)
Binds MLClass objects to the appropriate number that the Learning Algorithm expects.
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
std::vector< kkint32 > VectorInt32
Vector of signed 32 bit integers.
This class encapsulates are the information necessary to build a SVMModel class.
void RetrieveCrossProbTable(MLClassList &classes, double **crossProbTable, RunLog &log)
Will return the probabilities for all pairs of the classes listed in 'classes'.
virtual void WriteXML(const KKStr &varName, std::ostream &o) const
void ProbabilitiesByClass(FeatureVectorPtr example, const MLClassList &_mlClasses, kkint32 *_votes, double *_probabilities, RunLog &_log)
Will get the probabilities assigned to each class.
void Predict(FeatureVectorPtr example, MLClassPtr knownClass, MLClassPtr &predClass1, MLClassPtr &predClass2, kkint32 &predClass1Votes, kkint32 &predClass2Votes, double &probOfKnownClass, double &predClass1Prob, double &predClass2Prob, kkint32 &numOfWinners, bool &knownClassOneOfTheWinners, double &breakTie)
Will predict the two most likely classes of 'example'.
SVM_SelectionMethod SelectionMethod() const
FeatureEncoder * FeatureEncoderPtr
XmlElementSVMModel * XmlElementSVMModelPtr
FeatureNumListConst * FeatureNumListConstPtr
double TrainingTime() const
Used for logging messages.
void EncodeProblem(const struct svm_paramater ¶m, struct svm_problem &prob_in, struct svm_problem &prob_out)
SVMModel(const SVMparam &_svmParam, FeatureVectorList &_examples, ClassAssignments &_assignments, FileDescPtr _fileDesc, RunLog &_log)
Constructor that will create a svmlib training model using the features and classes for training purp...
void PredictRaw(FeatureVectorPtr example, MLClassPtr &predClass, double &dist)
Returns the distance from the decision border of the SVM.
std::vector< short > VectorShort
virtual void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
FeatureNumListConstPtr GetFeatureNums(FileDescPtr fileDesc, MLClassPtr class1, MLClassPtr class2) const
Maintains a list of MLClass instances.
std::vector< ProbNamePair > FindWorstSupportVectors(FeatureVectorPtr example, kkint32 numToFind, MLClassPtr c1, MLClassPtr c2)
For a given two class pair return the names of the 'numToFind' worst S/V's.
FeatureVectorList * FeatureVectorListPtr
virtual bool NormalizeNominalAttributes()
kkint32 NumOfSupportVectors() const
SVMparam const * SVMParameters() const
std::vector< KKStr > SupportVectorNames(MLClassPtr c1, MLClassPtr c2) const
volatile const bool VolConstBool