KSquare Utilities
SVMModel.cpp File Reference
#include "FirstIncludes.h"
#include <stdio.h>
#include <string>
#include <iostream>
#include <fstream>
#include <math.h>
#include <vector>
#include <sstream>
#include <iomanip>
#include <set>
#include "MemoryDebug.h"
#include "GlobalGoalKeeper.h"
#include "KKBaseTypes.h"
#include "KKException.h"
#include "KKStr.h"
#include "OSservices.h"
#include "RunLog.h"
#include "XmlStream.h"
#include "SVMModel.h"
#include "KKMLLTypes.h"
#include "BinaryClassParms.h"
#include "FeatureEncoder.h"
#include "FeatureNumList.h"
#include "FeatureVector.h"
#include "SvmWrapper.h"

Go to the source code of this file.

Namespaces

 KKMLL
 Namespace for all K^2 Machine Learning code.
 

Functions

double AdjProb (double prob)
 
template<class T >
void GetMaxIndex (T *vote, kkint32 voteLength, kkint32 &maxIndex1, kkint32 &maxIndex2)
 
bool KKMLL::PairCompareOperator (ProbNamePair l, ProbNamePair r)
 

Function Documentation

double AdjProb ( double  prob)

Definition at line 105 of file SVMModel.cpp.

Referenced by KKMLL::SVMModel::FindWorstSupportVectors(), and KKMLL::SVMModel::FindWorstSupportVectors2().

106 {
107  if (prob < 0.001)
108  prob = 0.001;
109  else if (prob > 0.999)
110  prob = 0.999;
111  return prob;
112 }
template<class T >
void GetMaxIndex ( T *  vote,
kkint32  voteLength,
kkint32 maxIndex1,
kkint32 maxIndex2 
)

Definition at line 39 of file SVMModel.cpp.

44 {
45  T max1 = vote[0];
46  maxIndex1 = 0;
47 
48  T max2 = 0;
49  maxIndex2 = -1;
50 
51  for (kkint32 i = 1; i < voteLength; i++)
52  {
53  if (vote[i] > max1)
54  {
55  max2 = max1;
56  maxIndex2 = maxIndex1;
57  max1 = vote[i];
58  maxIndex1 = i;
59  }
60 
61  else if (maxIndex2 < 0)
62  {
63  max2 = vote[i];
64  maxIndex2 = i;
65  }
66 
67  else if (vote[i] > max2)
68  {
69  max2 = vote[i];
70  maxIndex2 = i;
71  }
72  }
73 
74  return;
75 } /* GetMaxIndex */
__int32 kkint32
Definition: KKBaseTypes.h:88