KSquare Utilities
SVM233::svm_parameter Struct Reference

#include <svm.h>

Public Member Functions

 svm_parameter ()
 
 svm_parameter (const svm_parameter &parameters)
 
 svm_parameter (KKStr &paramStr)
 
void Gamma (double _gamma)
 
double Gamma () const
 
void KernalType (kkint32 _kernalType)
 
kkint32 KernalType () const
 
kkint32 MemoryConsumedEstimated () const
 
svm_parameteroperator= (const svm_parameter &right)
 
void ParseTabDelStr (const KKStr &_str)
 
void ProcessSvmParameter (KKStr cmd, KKStr value, double valueNum, bool &parmUsed)
 
KKStr ToCmdLineStr () const
 
KKStr ToTabDelStr () const
 

Public Attributes

float A
 
kkint32 boosting
 
double C
 
double cache_size
 
float cBoost
 
double coef0
 
double confidence
 
double degree
 
kkint32 dim
 
kkint32 dimSelect
 
double eps
 
double * featureWeight
 
double gamma
 
kkint32 hist
 
kkint32 kernel_type
 
kkint32 nr_class
 
kkint32 nr_weight
 
double nu
 
kkint32 numSVM
 
double p
 
kkint32 probability
 
float sample
 
kkint32 sampleSV
 
kkint32 shrinking
 
kkint32 svm_type
 
float threshold
 
double * weight
 
kkint32weight_label
 

Detailed Description

Definition at line 65 of file svm.h.

Constructor & Destructor Documentation

svm_parameter::svm_parameter ( )

Definition at line 730 of file svm.cpp.

References A, boosting, C, SVM233::C_SVC, cache_size, cBoost, coef0, confidence, degree, dim, dimSelect, eps, featureWeight, gamma, hist, kernel_type, nr_class, nr_weight, nu, numSVM, p, probability, SVM233::RBF, sample, sampleSV, shrinking, svm_type, threshold, weight, and weight_label.

Referenced by KKMLL::SVMparam::SVMparam().

730  :
731  coef0 (0.0),
732  degree (3),
733  gamma (0.0),
734  kernel_type (RBF),
735  svm_type (C_SVC),
736 
737  /* these are for training only */
738  C (1),
739  cache_size (40.0),
740  eps (1e-3),
741  nr_weight (0),
742  nu (0.5),
743  p (0.1),
744  probability (0),
745  shrinking (1),
746  weight (NULL),
747  weight_label (NULL),
748 
749  A (1.0f),
750  boosting (0),
751  cBoost (1.0),
752  confidence (0),
753  dim (0),
754  dimSelect (-1),
755  featureWeight (NULL),
756  hist (0),
757  nr_class (0),
758  numSVM (1),
759  sample (100),
760  sampleSV (0),
761  threshold (0.0f)
762 {
763 }
kkint32 dimSelect
Definition: svm.h:102
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
kkint32 probability
Definition: svm.h:90
double * featureWeight
Definition: svm.h:103
kkint32 sampleSV
Definition: svm.h:108
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 nr_class
Definition: svm.h:105
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
kkint32 nr_weight
Definition: svm.h:87
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77
svm_parameter::svm_parameter ( const svm_parameter parameters)

Definition at line 768 of file svm.cpp.

References A, boosting, C, cache_size, cBoost, coef0, confidence, degree, dim, dimSelect, eps, featureWeight, gamma, hist, kernel_type, nr_class, nr_weight, nu, numSVM, p, probability, sample, sampleSV, shrinking, svm_type, threshold, weight, and weight_label.

Referenced by KKMLL::BinaryClassParms::BinaryClassParms(), and KKMLL::SVMparam::SVMparam().

769  :
770  coef0 (_param.coef0),
771  degree (_param.degree),
772  gamma (_param.gamma),
773  kernel_type (_param.kernel_type),
774  svm_type (_param.svm_type),
775 
776  /* these are for training only */
777  C (_param.C),
778  cache_size (_param.cache_size),
779  eps (_param.eps),
780  nr_weight (_param.nr_weight),
781  nu (_param.nu),
782  p (_param.p),
783  probability (_param.probability),
784  shrinking (_param.shrinking),
785  weight (NULL),
786  weight_label (NULL),
787 
788  A (_param.A),
789  boosting (_param.boosting),
790  cBoost ( _param.cBoost),
791  confidence (_param.confidence),
792  dim (_param.dim),
793  dimSelect (_param.dimSelect),
794  featureWeight (NULL),
795  hist (_param.hist),
796  nr_class (_param.nr_class),
797  numSVM (_param.numSVM),
798  sample (_param.sample),
799  sampleSV (_param.sampleSV),
800  threshold (_param.threshold)
801  {
802  if (_param.weight_label)
803  {
805  for (kkint32 x = 0; x < nr_weight; x++)
806  weight_label[x] = _param.weight_label[x];
807  }
808 
809  if (_param.weight)
810  {
811  weight = new double[nr_weight];
812  for (kkint32 x = 0; x < nr_weight; x++)
813  weight[x] = _param.weight[x];
814  }
815 
816  if (_param.featureWeight)
817  {
818  featureWeight = new double[dim];
819  for (kkint32 x = 0; x < dim; x++)
820  featureWeight[x] = _param.featureWeight[x];
821  }
822 }
kkint32 dimSelect
Definition: svm.h:102
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
kkint32 probability
Definition: svm.h:90
double * featureWeight
Definition: svm.h:103
kkint32 sampleSV
Definition: svm.h:108
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 nr_class
Definition: svm.h:105
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
kkint32 nr_weight
Definition: svm.h:87
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77
svm_parameter::svm_parameter ( KKStr paramStr)

Definition at line 983 of file svm.cpp.

References A, boosting, C, SVM233::C_SVC, cache_size, cBoost, coef0, KKB::KKStr::Concat(), confidence, degree, dim, dimSelect, KKB::KKStr::Empty(), eps, KKB::KKStr::ExtractToken(), featureWeight, gamma, hist, kernel_type, KKB::KKStr::Len(), nr_class, nr_weight, nu, numSVM, KKB::KKStr::operator=(), KKB::KKStr::operator==(), KKB::KKStr::operator[](), p, probability, ProcessSvmParameter(), sample, sampleSV, shrinking, svm_type, threshold, KKB::KKStr::TrimLeft(), weight, and weight_label.

Referenced by KKMLL::BinaryClassParms::CreateFromTabDelStr().

983  :
984  coef0 (0.0),
985  degree (3),
986  gamma (0.0),
987  kernel_type (0),
988  svm_type (C_SVC),
989 
990  /* these are for training only */
991  C (1),
992  cache_size (40.0),
993  eps (1e-3),
994  nr_weight (0),
995  nu (0.5),
996  p (0.1),
997  probability (0),
998  shrinking (1),
999  weight (NULL),
1000  weight_label (NULL),
1001 
1002  //luo add
1003  A (1.0),
1004  boosting (0),
1005  cBoost (1.0),
1006  confidence (0),
1007  dim (0),
1008  dimSelect (-1),
1009  featureWeight (NULL),
1010  hist (0),
1011  nr_class (0),
1012  numSVM (1),
1013  sample (100),
1014  sampleSV (0),
1015  threshold (0.0f)
1016 
1017 {
1018  KKStr leftOverStr;
1019 
1020  KKStr field (_paramStr.ExtractToken (" \t\n\r"));
1021  KKStr value;
1022 
1023  double valueNum;
1024 
1025  while (!field.Empty ())
1026  {
1027  if (field[0] != '-')
1028  {
1029  leftOverStr << " " << field;
1030  }
1031  else
1032  {
1033  _paramStr.TrimLeft (" \t\n\r");
1034  value == "";
1035  if (_paramStr.Len () > 0)
1036  {
1037  if (_paramStr[0] != '-')
1038  value = _paramStr.ExtractToken (" \t\n\r");
1039  }
1040 
1041  valueNum = atof (value.Str ());
1042 
1043  bool parmUsed = false;
1044 
1045  if (field.Len () > 2)
1046  {
1047  leftOverStr << " " << field << " " << value;
1048  }
1049  else
1050  {
1051  ProcessSvmParameter (field, value, valueNum, parmUsed);
1052  if (!parmUsed)
1053  {
1054  leftOverStr << " " << field << " " << value;
1055  }
1056  }
1057  }
1058 
1059  field = _paramStr.ExtractToken (" \t\n\r");
1060  }
1061 
1062  _paramStr = leftOverStr;
1063 
1064 } /* svm_parameter (KKStr paramStr) */
kkint32 dimSelect
Definition: svm.h:102
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
KKStr ExtractToken(const char *delStr="\n\t\r ")
Definition: KKStr.cpp:2969
kkint32 probability
Definition: svm.h:90
double * featureWeight
Definition: svm.h:103
kkint32 sampleSV
Definition: svm.h:108
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 nr_class
Definition: svm.h:105
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
void TrimLeft(const char *whiteSpaceChars="\n\r\t ")
Definition: KKStr.cpp:1745
kkint32 nr_weight
Definition: svm.h:87
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
void ProcessSvmParameter(KKStr cmd, KKStr value, double valueNum, bool &parmUsed)
Definition: svm.cpp:900
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77

Member Function Documentation

void SVM233::svm_parameter::Gamma ( double  _gamma)
inline

Definition at line 114 of file svm.h.

References gamma.

Referenced by KKMLL::SVMparam::Gamma().

114 {gamma = _gamma;}
double gamma
Definition: svm.h:79
double SVM233::svm_parameter::Gamma ( ) const
inline

Definition at line 117 of file svm.h.

References gamma.

Referenced by KKMLL::SVMparam::Gamma().

117 {return gamma;}
double gamma
Definition: svm.h:79
void SVM233::svm_parameter::KernalType ( kkint32  _kernalType)
inline

Definition at line 115 of file svm.h.

References kernel_type.

Referenced by KKMLL::SVMparam::KernalType().

115 {kernel_type = _kernalType;}
kkint32 kernel_type
Definition: svm.h:80
kkint32 SVM233::svm_parameter::KernalType ( ) const
inline

Definition at line 118 of file svm.h.

References kernel_type.

Referenced by KKMLL::SVMparam::KernalType().

118 {return kernel_type;}
kkint32 kernel_type
Definition: svm.h:80
kkint32 svm_parameter::MemoryConsumedEstimated ( ) const

Definition at line 886 of file svm.cpp.

References dim, featureWeight, nr_weight, and weight.

Referenced by KKMLL::BinaryClassParms::MemoryConsumedEstimated().

887 {
888  kkint32 memoryConsumedEstimated = sizeof (svm_parameter);
889  if (weight)
890  memoryConsumedEstimated += ((sizeof (double) + sizeof(kkint32)) * nr_weight);
891 
892  if (featureWeight)
893  memoryConsumedEstimated += (sizeof (double) * dim);
894 
895  return memoryConsumedEstimated;
896 }
__int32 kkint32
Definition: KKBaseTypes.h:88
double * featureWeight
Definition: svm.h:103
double * weight
Definition: svm.h:92
kkint32 nr_weight
Definition: svm.h:87
svm_parameter & svm_parameter::operator= ( const svm_parameter right)

Definition at line 828 of file svm.cpp.

References A, boosting, C, cache_size, cBoost, coef0, confidence, degree, dim, dimSelect, eps, featureWeight, gamma, hist, kernel_type, nr_class, nr_weight, nu, numSVM, p, probability, sample, sampleSV, shrinking, svm_type, threshold, weight, and weight_label.

Referenced by KKMLL::BinaryClassParms::Param(), and KKMLL::SVMparam::SVMparam().

829 {
830  coef0 = right.coef0;
831  degree = right.degree;
832  gamma = right.gamma;
833  kernel_type = right.kernel_type;
834  svm_type = right.svm_type;
835 
836  cache_size = right.cache_size;
837  eps = right.eps;
838  C = right.C;
839  nr_weight = right.nr_weight;
840  weight_label = NULL;
841  weight = NULL;
842  nu = right.nu;
843  p = right.p;
844  shrinking = right.shrinking;
845  probability = right.probability;
846  numSVM = right.numSVM;
847  sampleSV = right.sampleSV;
848  hist = right.hist;
849  boosting = right.boosting;
850  cBoost = right.cBoost;
851  dimSelect = right.dimSelect;
852  dim = right.dim;
853  featureWeight = NULL;
854  confidence = right.confidence;
855  A = right.A;
856  nr_class = right.nr_class;
857  threshold = right.threshold;
858  sample = right.sample;
859 
860  if (right.weight_label)
861  {
863  for (kkint32 x = 0; x < nr_weight; x++)
864  weight_label[x] = right.weight_label[x];
865  }
866 
867  if (right.weight)
868  {
869  weight = new double[nr_weight];
870  for (kkint32 x = 0; x < nr_weight; x++)
871  weight[x] = right.weight[x];
872  }
873 
874  if (right.featureWeight)
875  {
876  featureWeight = new double[dim];
877  for (kkint32 x = 0; x < dim; x++)
878  featureWeight[x] = right.featureWeight[x];
879  }
880 
881  return *this;
882 } /* svm_parameter::operator= */
kkint32 dimSelect
Definition: svm.h:102
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
kkint32 probability
Definition: svm.h:90
double * featureWeight
Definition: svm.h:103
kkint32 sampleSV
Definition: svm.h:108
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 nr_class
Definition: svm.h:105
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
kkint32 nr_weight
Definition: svm.h:87
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77
void svm_parameter::ParseTabDelStr ( const KKStr _str)

Definition at line 1176 of file svm.cpp.

References A, boosting, C, cache_size, cBoost, coef0, KKB::KKStr::Concat(), confidence, degree, dim, dimSelect, KKB::KKStr::Empty(), eps, KKB::KKStr::ExtractToken2(), KKB::KKStr::ExtractTokenDouble(), KKB::KKStr::ExtractTokenInt(), featureWeight, gamma, hist, kernel_type, nr_class, nr_weight, nu, numSVM, KKB::KKStr::operator==(), p, probability, sample, sampleSV, shrinking, svm_type, threshold, KKB::KKStr::ToDouble(), KKB::KKStr::ToFloat(), KKB::KKStr::ToInt(), weight, and weight_label.

1177 {
1178  KKStr str = _str;
1179 
1180  kkint32 x;
1181 
1182 
1183 /*
1184 
1185 
1186  if (featureWeight)
1187  {
1188  result << "featureWeight" << "\t";
1189  for (kkint32 x = 0; x < dim; x++)
1190  {
1191  if (x > 0)
1192  result << ",";
1193  result << featureWeight[x];
1194  }
1195  result << "\t";
1196  }
1197 */
1198 
1199 
1200 
1201 
1202  while (!str.Empty ())
1203  {
1204  KKStr field = str.ExtractToken2 ("\t");
1205  KKStr value = str.ExtractToken2 ("\t");
1206  kkint32 valueI = value.ToInt ();
1207  double valueD = value.ToDouble ();
1208  float valueF = value.ToFloat ();
1209 
1210  if (field == "svm_type")
1211  svm_type = valueI;
1212 
1213  else if (field == "kernel_type")
1214  kernel_type = valueI;
1215 
1216  else if (field == "degree")
1217  degree = valueD;
1218 
1219  else if (field == "gamma")
1220  gamma = valueD;
1221 
1222  else if (field == "coef0")
1223  coef0 = valueD;
1224 
1225  else if (field == "cache_size")
1226  cache_size = valueD;
1227 
1228  else if (field == "eps")
1229  eps = valueD;
1230 
1231  else if (field == "C")
1232  C = valueD;
1233 
1234  else if (field == "nr_weight")
1235  {
1236  nr_weight = valueI;
1237  if (nr_weight > 0)
1238  {
1239  delete[] weight_label;
1241 
1242  // value = weight label.
1243  for (x = 0; x < nr_weight; x++)
1244  {
1245  weight_label[x] = value.ExtractTokenInt (",");
1246  }
1247 
1248  delete[] weight;
1249  weight = new double [nr_weight];
1250  KKStr weightStr = str.ExtractToken2 ("\t");
1251  for (x = 0; x < nr_weight; x++)
1252  {
1253  weight[x] = weightStr.ExtractTokenDouble (",");
1254  }
1255  }
1256  }
1257 
1258  else if (field == "nu")
1259  nu = valueD;
1260 
1261  else if (field == "p")
1262  p = valueD;
1263 
1264  else if (field == "shrinking")
1265  shrinking = valueI;
1266 
1267  else if (field == "probability")
1268  probability = valueI;
1269 
1270  else if (field == "numSVM")
1271  numSVM = valueI;
1272 
1273  else if (field == "sampleSV")
1274  sampleSV = valueI;
1275 
1276  else if (field == "hist")
1277  hist = valueI;
1278 
1279  else if (field == "boosting")
1280  boosting = valueI;
1281 
1282  else if (field == "cBoost")
1283  cBoost = valueF;
1284 
1285  else if (field == "dimSelect")
1286  dimSelect = valueI;
1287 
1288  else if (field == "dim")
1289  dim = valueI;
1290 
1291  else if (field == "featureWeight")
1292  {
1293  delete[] featureWeight;
1294  featureWeight = new double[dim];
1295  for (x = 0; x < dim; x++)
1296  {
1297  featureWeight[x] = value.ExtractTokenDouble (",");
1298  }
1299  }
1300 
1301  else if (field == "confidence" )
1302  confidence = valueD;
1303 
1304  else if (field == "A")
1305  A = valueF;
1306 
1307  else if (field == "nr_class")
1308  nr_class = valueI;
1309 
1310  else if (field == "threshold")
1311  threshold = valueF;
1312 
1313  else if (field == "sample")
1314  sample = valueF;
1315  }
1316 } /* ParseTabDelStr */
kkint32 dimSelect
Definition: svm.h:102
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 boosting
Definition: svm.h:98
KKStr ExtractToken2(const char *delStr="\n\t\r ")
Extract first Token from the string.
Definition: KKStr.cpp:3026
kkint32 svm_type
Definition: svm.h:81
kkint32 probability
Definition: svm.h:90
double * featureWeight
Definition: svm.h:103
kkint32 ToInt() const
Definition: KKStr.cpp:3565
kkint32 sampleSV
Definition: svm.h:108
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 nr_class
Definition: svm.h:105
double ExtractTokenDouble(const char *delStr)
Definition: KKStr.cpp:3180
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
bool Empty() const
Definition: KKStr.h:241
kkint32 nr_weight
Definition: svm.h:87
kkint32 numSVM
Definition: svm.h:106
double ToDouble() const
Definition: KKStr.cpp:3541
kkint32 ExtractTokenInt(const char *delStr)
Definition: KKStr.cpp:3129
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
float ToFloat() const
Definition: KKStr.cpp:3553
double coef0
Definition: svm.h:77
void svm_parameter::ProcessSvmParameter ( KKStr  cmd,
KKStr  value,
double  valueNum,
bool &  parmUsed 
)

Definition at line 900 of file svm.cpp.

References A, boosting, C, cache_size, cBoost, coef0, confidence, degree, dimSelect, eps, gamma, hist, kernel_type, nr_weight, nu, numSVM, KKB::KKStr::operator==(), p, shrinking, KKB::KKStr::SubStrPart(), svm_type, threshold, KKB::KKStr::ToInt32(), KKB::KKStr::Upper(), weight, and weight_label.

Referenced by KKMLL::SVMparam::ParseCmdLineParameter(), and svm_parameter().

905 {
906  parmUsed = true;
907 
908  cmd.Upper ();
909 
910  if (cmd == "-A")
911  numSVM = (kkint32)valueNum;
912 
913  else if (cmd == "-C")
914  C = valueNum;
915 
916  else if (cmd == "-D")
917  degree = valueNum;
918 
919  else if (cmd == "-E")
920  eps = valueNum;
921 
922  else if ((cmd == "-G") || (cmd == "-GAMMA"))
923  gamma = valueNum;
924 
925  else if (cmd == "-H")
926  shrinking = (kkint32)valueNum;
927 
928  else if (cmd == "-I")
929  threshold = (float)valueNum;
930 
931  else if (cmd == "-J")
932  hist = (kkint32)valueNum;
933 
934  else if (cmd == "-K")
935  boosting = (kkint32)valueNum;
936 
937  else if (cmd == "-L")
938  cBoost = (float)valueNum;
939 
940  else if (cmd == "-M")
941  cache_size = valueNum;
942 
943  else if (cmd == "-N")
944  nu = valueNum;
945 
946  else if (cmd == "-O")
947  dimSelect = (kkint32)valueNum;
948 
949  else if (cmd == "-P")
950  p = valueNum;
951 
952  else if (cmd == "-Q")
953  confidence = valueNum;
954 
955  else if (cmd == "-R")
956  coef0 = valueNum;
957 
958  else if (cmd == "-S")
959  svm_type = (kkint32)valueNum;
960 
961  else if (cmd == "-T")
962  kernel_type = (kkint32)valueNum;
963 
964  else if (cmd == "-U")
965  A = (float)valueNum;
966 
967  else if (cmd == "-W")
968  {
969  ++nr_weight;
972  weight_label [nr_weight - 1] = cmd.SubStrPart (2).ToInt32 ();
973  weight [nr_weight - 1] = valueNum;
974  }
975 
976  else
977  parmUsed = false;
978 
979 } /* ProcessSvmParameter */
kkint32 dimSelect
Definition: svm.h:102
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
T * kkReallocateArray(T *oldA, kkint32 oldSize, kkint32 newSize)
Definition: KKBaseTypes.h:306
kkint32 ToInt32() const
Definition: KKStr.cpp:3587
kkint32 nr_weight
Definition: svm.h:87
void Upper()
Converts all characters in string to their Upper case equivalents via &#39;toupper&#39;.
Definition: KKStr.cpp:2461
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77
KKStr SubStrPart(kkint32 firstChar) const
returns a SubString consisting of all characters starting at index &#39;firstChar&#39; until the end of the s...
Definition: KKStr.cpp:2780
KKStr svm_parameter::ToCmdLineStr ( ) const

Definition at line 1069 of file svm.cpp.

References A, boosting, C, cache_size, cBoost, coef0, KKB::KKStr::Concat(), confidence, degree, dimSelect, eps, gamma, hist, kernel_type, KKB::KKStr::KKStr(), nu, numSVM, p, shrinking, svm_type, and threshold.

Referenced by KKMLL::ModelParamOldSVM::SvmParamToString(), KKMLL::SVMparam::SvmParamToString(), and KKMLL::BinaryClassParms::ToTabDelString().

1070 {
1071  KKStr cmdStr (200); // Initialized char* allocation to 200
1072 
1073  cmdStr << "-a " << numSVM << " "
1074  //<< "-b " << sample << " "
1075  << "-c " << C << " "
1076  << "-d " << degree << " "
1077  << "-e " << eps << " "
1078  << "-g " << gamma << " "
1079  << "-h " << shrinking << " "
1080  << "-i " << threshold << " "
1081  << "-j " << hist << " "
1082  << "-k " << boosting << " "
1083  << "-l " << cBoost << " "
1084  << "-m " << cache_size << " "
1085  << "-n " << nu << " ";
1086 
1087  if (dimSelect >= 0)
1088  cmdStr << "-o " << dimSelect << " ";
1089 
1090  cmdStr << "-p " << p << " "
1091  << "-q " << confidence << " "
1092  << "-r " << coef0 << " "
1093  << "-s " << svm_type << " "
1094  << "-t " << kernel_type << " "
1095  << "-u " << A << " ";
1096 
1097  return cmdStr;
1098 } /* ToCmdLineStr */
kkint32 dimSelect
Definition: svm.h:102
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
double cache_size
Definition: svm.h:85
double degree
Definition: svm.h:78
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77
KKStr svm_parameter::ToTabDelStr ( ) const

Definition at line 1104 of file svm.cpp.

References A, boosting, C, cache_size, cBoost, coef0, KKB::KKStr::Concat(), confidence, degree, dim, dimSelect, eps, featureWeight, gamma, hist, kernel_type, KKB::KKStr::KKStr(), nr_class, nr_weight, nu, numSVM, p, probability, sample, sampleSV, shrinking, svm_type, threshold, weight, and weight_label.

Referenced by SVM233::SvmModel233::WriteXML(), and KKMLL::SVMparam::WriteXML().

1105 {
1106  kkint32 x;
1107 
1108  KKStr result (300);
1109 
1110  result << "svm_type" << "\t" << svm_type << "\t"
1111  << "kernel_type" << "\t" << kernel_type << "\t"
1112  << "degree" << "\t" << degree << "\t"
1113  << "gamma" << "\t" << gamma << "\t"
1114  << "coef0" << "\t" << coef0 << "\t"
1115  << "cache_size" << "\t" << cache_size << "\t"
1116  << "eps" << "\t" << eps << "\t"
1117  << "C" << "\t" << C << "\t";
1118 
1119  result << "nr_weight" << "\t" << nr_weight << "\t";
1120  if (nr_weight > 0)
1121  {
1122  for (x = 0; x < nr_weight; x++)
1123  {
1124  if (x > 0) result << ",";
1125  result << weight_label[x];
1126  }
1127  result << "\t";
1128 
1129  for (x = 0; x < nr_weight; x++)
1130  {
1131  if (x > 0) result << ",";
1132  result << weight[x];
1133  }
1134  result << "\t";
1135  }
1136 
1137  result << "nu" << "\t" << nu << "\t"
1138  << "p" << "\t" << p << "\t"
1139  << "shrinking" << "\t" << shrinking << "\t"
1140  << "probability" << "\t" << probability << "\t"
1141  << "numSVM" << "\t" << numSVM << "\t"
1142  << "sampleSV" << "\t" << sampleSV << "\t"
1143  << "hist" << "\t" << hist << "\t"
1144  << "boosting" << "\t" << boosting << "\t"
1145  << "cBoost" << "\t" << cBoost << "\t"
1146  << "dimSelect" << "\t" << dimSelect << "\t"
1147  << "dim" << "\t" << dim << "\t";
1148 
1149  if (featureWeight)
1150  {
1151  result << "featureWeight" << "\t";
1152  for (kkint32 x = 0; x < dim; x++)
1153  {
1154  if (x > 0)
1155  result << ",";
1156  result << featureWeight[x];
1157  }
1158  result << "\t";
1159  }
1160 
1161  result << "confidence" << "\t" << confidence << "\t"
1162  << "A" << "\t" << A << "\t"
1163  << "nr_class" << "\t" << nr_class << "\t"
1164  << "threshold" << "\t" << threshold << "\t"
1165  << "sample" << "\t" << sample << "\t";
1166 
1167  return result;
1168 } /* ToTabDelStr */
kkint32 dimSelect
Definition: svm.h:102
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 boosting
Definition: svm.h:98
kkint32 svm_type
Definition: svm.h:81
kkint32 probability
Definition: svm.h:90
double * featureWeight
Definition: svm.h:103
kkint32 sampleSV
Definition: svm.h:108
double cache_size
Definition: svm.h:85
double * weight
Definition: svm.h:92
double degree
Definition: svm.h:78
kkint32 * weight_label
Definition: svm.h:93
kkint32 nr_class
Definition: svm.h:105
kkint32 hist
Definition: svm.h:104
kkint32 shrinking
Definition: svm.h:91
kkint32 nr_weight
Definition: svm.h:87
kkint32 numSVM
Definition: svm.h:106
double confidence
Definition: svm.h:100
kkint32 kernel_type
Definition: svm.h:80
double gamma
Definition: svm.h:79
double coef0
Definition: svm.h:77

Member Data Documentation

kkint32 SVM233::svm_parameter::boosting
float SVM233::svm_parameter::cBoost
double SVM233::svm_parameter::confidence
kkint32 SVM233::svm_parameter::dim
double* SVM233::svm_parameter::featureWeight
kkint32 SVM233::svm_parameter::hist
kkint32 SVM233::svm_parameter::nr_class
kkint32 SVM233::svm_parameter::nr_weight
kkint32 SVM233::svm_parameter::numSVM
double SVM233::svm_parameter::p
kkint32 SVM233::svm_parameter::probability

Definition at line 90 of file svm.h.

Referenced by operator=(), ParseTabDelStr(), svm_parameter(), and ToTabDelStr().

float SVM233::svm_parameter::sample

Definition at line 107 of file svm.h.

Referenced by operator=(), ParseTabDelStr(), svm_parameter(), KKMLL::SvmTrainModel(), and ToTabDelStr().

kkint32 SVM233::svm_parameter::sampleSV

Definition at line 108 of file svm.h.

Referenced by operator=(), ParseTabDelStr(), svm_parameter(), KKMLL::SvmTrainModel(), and ToTabDelStr().

float SVM233::svm_parameter::threshold
double* SVM233::svm_parameter::weight
kkint32* SVM233::svm_parameter::weight_label

Definition at line 93 of file svm.h.

Referenced by operator=(), ParseTabDelStr(), ProcessSvmParameter(), svm_parameter(), and ToTabDelStr().


The documentation for this struct was generated from the following files: