KSquare Utilities
TrainingConfiguration2.h
Go to the documentation of this file.
1 #if !defined(_TRAININGCONFIGURATION2_)
2 #define _TRAININGCONFIGURATION2_
3 
4 #include "Configuration.h"
5 #include "DateTime.h"
6 #include "GoalKeeper.h"
7 #include "KKStr.h"
8 #include "XmlStream.h"
9 
10 #include "FileDesc.h"
11 #include "FactoryFVProducer.h"
13 #include "FeatureVector.h"
14 #include "Model.h"
15 #include "ModelParam.h"
16 #include "ModelParamOldSVM.h"
17 #include "SVMparam.h"
18 #include "TrainingClass.h"
19 
20 
21 
22 namespace KKMLL
23 {
24  #if !defined(_FEATUREVECTOR_)
25  class FeatureVector;
27  class FeatureVectorList;
29  #endif
30 
31 
32  #if !defined(_FileDesc_Defined_)
33  class FileDesc;
34  typedef FileDesc* FileDescPtr;
35  #endif
36 
37 
38  #if !defined(_NormalizationParms_Defined_)
39  class NormalizationParms;
41  #endif
42 
43 
44  #if !defined(_FactoryFVProducer_Defined_)
45  class FactoryFVProducer;
47  #endif
48 
49 
52 
53 
55  {
56  public:
57  typedef Model::ModelTypes ModelTypes;
58 
59 
63 
65 
66 
68 
69 
70  /**
71  *@brief Use this one if you want to create a default Configuration object.
72  *@param[in] _mlClasses Will make copy of list of MLClasses and NOT take ownership.
73  *@param[in] _fvFactoryProducer If NULL will default to "GrayScaleImagesFVProducerFactory".
74  *@param[in] _parameterStr Sting with Machine Learning Parameters.
75  *@param[in] _log Where to send logging messages to.
76  */
77  TrainingConfiguration2 (MLClassListPtr _mlClasses,
78  FactoryFVProducerPtr _fvFactoryProducer,
79  const KKStr& _parameterStr,
80  RunLog& _log
81  );
82 
83 
84  /**
85  *@brief Use this one if you want to create a default Configuration object.
86  *@details We know what the underlying feature data is from _fileDesc but we do not know how they
87  * are computed; that is why we do not provide a "FactoryFVProducer" instance.
88  *@param[in] _mlClasses Will make copy of list of MLClasses and NOT take ownership.
89  *@param[in] _fileDesc Description of the Feature-Vector fields.
90  *@param[in] _parameterStr Sting with Machine Learning Parameters.
91  *@param[in] _log Where to send logging messages to.
92  */
93  TrainingConfiguration2 (MLClassListPtr _mlClasses,
94  FileDescPtr _fileDesc,
95  const KKStr& _parameterStr,
96  RunLog& _log
97  );
98 
99 
100  /**
101  *@brief Creates a configuration file using the parameters specified in '_modelParameters'; does not read
102  * from a configuration file.
103  *@details For each class specified in '_mlClasses' a 'TrainingClass' instance will be created.
104  * All feature-numbers will be assumed to be selected and unlimited examples per class will be allowed.
105  *@param[in] _mlClasses
106  *@param[in] _fileDesc Description of the Feature-Vector fields.
107  *@param[in] _modelParameters Will take ownership of this instance.
108  *@param[in] _log
109  */
110  TrainingConfiguration2 (MLClassListPtr _mlClasses,
111  FileDescPtr _fileDesc,
112  ModelParamPtr _modelParameters,
113  RunLog& _log
114  );
115 
116 
117 
118  virtual
119  void Load (const KKStr& _configFileName,
120  bool _validateDirectories,
121  RunLog& log
122  );
123 
124 
125  virtual
127 
128 
129 
130  virtual
132 
133 
134  virtual
136 
137 
138  /**
139  *@brief Will create a instance using a sub-directory tree to drive the TraningClassList.
140  *@details for each unique sub-directory entry below it that contains 'bmp' files a TrainingClass'
141  * instance will be created using the root-name as the class name. If an existing Config file already
142  * exists then parameters will be taken from it otherwise a default configuration will be created.
143  *@param[in] _existingConfigFileName Caller can specify an existing Configuration file to extract configuration
144  * parameters from; if left blank then a configuration file with the same name
145  * of the last name in the directory path specified by _subDir will be assumed
146  * in the default TraningModel directory. If still no configuration file
147  * found then one will be created using default parameters.
148  *
149  *@param[in] _subDir The root directory entry to the Sub-Directory structure that is to be used to construct
150  * training class list from.
151  *
152  *@param[in] _fvFactoryProducer The FeatureVector computation routines you want to use; if NULL will default.
153  *@param[in] _log
154  *@param[out] _successful
155  *@param[out] _errorMessage Will contain description of errors encountered.
156  */
157  static
159  (const KKStr& _existingConfigFileName,
160  const KKStr& _subDir,
161  FactoryFVProducerPtr _fvFactoryProducer,
162  RunLog& _log,
163  bool& _successful,
164  KKStr& _errorMessage
165  );
166 
167 
168  static
170  (FeatureVectorList& _examples,
171  FileDescPtr _fileDesc,
172  const KKStr& _parameterStr,
173  RunLog& _log
174  );
175 
176 
177  static KKStr ModelTypeToStr (ModelTypes _modelType) {return Model::ModelTypeToStr (_modelType);}
178  static ModelTypes ModelTypeFromStr (const KKStr& _modelTypeStr) {return Model::ModelTypeFromStr (_modelTypeStr);}
179 
180 
181  // Access Methods.
182 
183  float A_Param () const;
184  float AvgNumOfFeatures () const;
185  double C_Param () const;
186  const KKStr& ConfigFileNameSpecified () const {return configFileNameSpecified;}
187  const KKStr& ConfigRootName () const {return configRootName;}
189  kkint32 ExamplesPerClass () const;
190  FileDescPtr FileDesc () const {return fileDesc;}
192  bool FvFactoryProducerSpecified () const {return fvFactoryProducerSpecified;}
193  double Gamma () const;
195  SVM_KernalType KernalType () const;
196  SVM_MachineType MachineType () const;
197  MLClassListPtr MlClasses () const {return mlClasses;}
198  Model::ModelTypes ModelingMethod () const {return modelingMethod;}
199  Model::ModelTypes ModelType () const {return modelingMethod;}
200  KKStr ModelTypeStr () const {return Model::ModelTypeToStr (modelingMethod);}
201  MLClassPtr NoiseMLClass () const {return noiseMLClass;}
202  const TrainingClassPtr NoiseTrainingClass () const {return noiseTrainingClass;}
203 
205  kkint32 Number_of_rounds () const;
206  MLClassPtr OtherClass () const {return otherClass;}
207  const KKStr& RootDir () const {return rootDir;} /**< @brief The root directory where Training library images are stored. */
208  KKStr RootDirExpanded () const;
209 
210  TrainingConfiguration2ListPtr SubClassifiers () const {return subClassifiers;}
211  const TrainingClassList& TrainingClasses () const {return trainingClasses;}
212  ModelParamPtr ModelParameters () const {return modelParameters;}
213  KKStr ModelParameterCmdLine () const;
214  kkuint32 NumHierarchialLevels () const; /**< returns back the number of hierarchical levels thereare in the trainingClass that has the most. */
216  const SVMparam& SVMparamREF (RunLog& log) const;
217 
218 
219 
220  const
221  BinaryClassParmsPtr GetParamtersToUseFor2ClassCombo (MLClassPtr class1,
222  MLClassPtr class2
223  ) const;
224 
225 
226  /** if BinaryClass parms exist for the two specified classes will return otherwise NULL. */
227  BinaryClassParmsPtr GetBinaryClassParms (MLClassPtr class1,
228  MLClassPtr class2
229  );
230 
231  double C_Param (MLClassPtr class1,
232  MLClassPtr class2
233  ) const;
234 
235 
236  void A_Param (float _aParam);
237 
238  void C_Param (double _CCC);
239 
240  void C_Param (MLClassPtr class1,
241  MLClassPtr class2,
242  double cParam
243  );
244 
245  void EncodingMethod (SVM_EncodingMethod _encodingMethod);
246  void ExamplesPerClass (kkint32 _examplesPerClass);
247  void Gamma (double _gamma);
248  void ImagesPerClass (kkint32 _imagesPerClass) {ExamplesPerClass (_imagesPerClass);}
249  void KernalType (SVM_KernalType _kernalType);
250  void MachineType (SVM_MachineType _machineType);
251  void ModelParameters (ModelParamPtr _modelParameters);
252  void Number_of_rounds (kkint32 _number_of_rounds);
253  void NumOfRounds (kkint32 _numOfRounds) {Number_of_rounds (_numOfRounds);}
254  void RootDir (const KKStr& _rootDir);
255  void SelectionMethod (SVM_SelectionMethod _selectionMethod);
256 
257  /**
258  *@brief Adds specified Training Class to list taking ownership of it.
259  */
260  void AddATrainingClass (TrainingClassPtr _trainClass);
261 
262  void AddATrainingClass (MLClassPtr _newClass); /**< Will assume that images for this class will
263  * be saved off the RootDirectory using its own
264  * name for the subdirectory name.
265  */
266 
267  float AvgNumOfFeatures (FeatureVectorListPtr trainExamples) const;
268 
269 
270  /// <summary> Fully expanded directory path for specified class.</summary>
271  /// <param name="mlClass">Class that we want to get directory path for training images.</param>
272  /// <returns> Returns full patch where images for mlClass are stored; directory path is fully expended. </returns>
273  KKStr DirectoryPathForClass (MLClassPtr mlClass) const;
274 
275  /**
276  *@brief Removes all training classes from the configuration; example use would be to remove all classes and then add
277  * the two needed by a Binary-Class-Pair classifier.
278  */
279  void EmptyTrainingClasses ();
280 
281  MLClassListPtr ExtractClassList () const; /**< Constructs new list of classes that caller will own. */
282 
283  MLClassListPtr ExtractFullHierachyOfClasses () const; /**< Extracts the list of classes including ones from Sub-Classifiers */
284 
285  MLClassListPtr ExtractListOfClassesForAGivenHierarchialLevel (kkuint32 level) const;
286 
288  RunLog& log
289  ) const;
290 
292 
293  /**@brief Returns features selected for the specified class-pairIf none were specified for that pair will return global feature nums. */
294  FeatureNumList GetFeatureNums (MLClassPtr class1,
295  MLClassPtr class2
296  );
297 
298 
300 
302  bool& changesMadeToTrainingLibraries,
303  VolConstBool& cancelFlag,
304  RunLog& log
305  );
306 
307  TrainingClassPtr LocateByMLClassName (const KKStr& className);
308 
309  bool NormalizeNominalFeatures ();
310 
312 
313  virtual void ReadXML (XmlStream& s,
314  XmlTagConstPtr tag,
315  VolConstBool& cancelFlag,
316  RunLog& log
317  );
318 
319  virtual void Save (const KKStr& fileName) const;
320 
321  virtual void Save (std::ostream& o) const;
322 
323  void SetFeatureNums (const FeatureNumList& features);
324 
325  void SetFeatureNums (MLClassPtr class1,
326  MLClassPtr class2,
327  const FeatureNumList& _features,
328  float _weight = -1 // -1 Indicates - use existing value
329  );
330 
331  void SetModelParameters (ModelParamPtr _svmParanters,
332  kkint32 _examplesPerClass
333  );
334 
335 
336  void SetBinaryClassFields (MLClassPtr class1,
337  MLClassPtr class2,
338  const SVM233::svm_parameter& _param,
339  const FeatureNumList& _features,
340  float _weight
341  );
342 
343  void SetTrainingClasses (TrainingClassListPtr _trainingClasses);
344 
345 
346  static bool ConfigFileExists (const KKStr& _configFileName);
347 
348  static KKStr GetEffectiveConfigFileName (const KKStr& configFileName);
349 
350  void WriteXML (const KKStr& varName,
351  std::ostream& o
352  ) const;
353 
354 
355  protected:
357  bool& _successful,
358  KKStr& _errorMessage,
359  RunLog& _log
360  );
361 
363  VolConstBool& cancelFlag,
364  RunLog& log
365  );
366 
367  void ReadXMLPost (VolConstBool& cancelFlag,
368  RunLog& log
369  );
370 
371  /**
372  *@brief To be used by both Base Class and Derived classes to write fields that are
373  specific to 'TrainingConfiguration2'.
374  */
375  void WriteXMLFields (std::ostream& o) const;
376 
377 
378  private:
379  void BuildTrainingClassListFromDirectoryEntry (const KKStr& rootDir,
380  const KKStr& subDir,
381  bool& successful,
382  KKStr& errorMessage,
383  RunLog& log
384  );
385 
386 
387  void CreateModelParameters (const KKStr& _parameterStr,
388  const FeatureNumList& _selFeatures,
389  kkint32 _sectionLineNum,
390  kkint32 _parametersLineNum,
391  kkint32 _featuresIncludedLineNum,
392  RunLog& _log
393  );
394 
395 
396  FeatureNumListPtr DeriveFeaturesSelected (kkint32 sectionNum);
397 
398  void DetermineWhatTheRootDirectoryIs ();
399 
400  virtual
401  FeatureVectorListPtr ExtractFeatures (const TrainingClassPtr trainingClass,
402  KKB::DateTime& latestTimeStamp,
403  bool& changesMade,
404  VolConstBool& cancelFlag,
405  RunLog& log
406  );
407 
408  SVMparamPtr SVMparamToUse () const;
409 
410  void SyncronizeMLClassListWithTrainingClassList ();
411 
412  TrainingClassPtr ValidateClassConfig (kkint32 sectionNum,
413  RunLog& log
414  );
415 
416  void ValidateConfiguration (RunLog& log);
417 
418  void ValidateGlobalSection (kkint32 sectionNum,
419  RunLog& log
420  );
421 
422  void ValidateOtherClass (MLClassPtr otherClass,
423  kkint32 otherClassLineNum,
424  RunLog& log
425  );
426 
428  ValidateSubClassifier (const KKStr& subClassifierName,
429  bool& errorsFound,
430  RunLog& log
431  );
432 
433  void ValidateTrainingClassConfig (kkint32 sectionNum,
434  RunLog& log
435  );
436 
437  void ValidateTwoClassParameters (kkint32 sectionNum,
438  RunLog& log
439  );
440 
441  ModelParamOldSVMPtr OldSvmParameters () const;
442 
443 
444  KKStr configFileNameSpecified; /**< Config file name that was specified by caller before
445  * directory path was added by 'GetEffectiveConfigFileName'.
446  */
447 
448  KKStr configRootName;
449 
450  kkint32 examplesPerClass;
451  FactoryFVProducerPtr fvFactoryProducer;
452  bool fvFactoryProducerSpecified; /**< Indicates that a valid 'fvFactoryProducer' was specified in the configuration file. */
453  FileDescPtr fileDesc;
454  MLClassListPtr mlClasses;
455  bool mlClassesWeOwnIt; /**< If we own it we will delete it in the destructor. */
456  ModelTypes modelingMethod;
457  ModelParamPtr modelParameters;
458 
459  MLClassPtr noiseMLClass;
460 
461  TrainingClassPtr noiseTrainingClass; /**< The specific Training Class that is to be used for noise images. */
462 
463  MLClassPtr otherClass; /**< class that is to be used for "Other" examples when performing
464  * adjustment calculations. This was done as part of the Dual Class
465  * classification program. When specified the actual training of
466  * the classifier will not include this class. It will be used when
467  * a class can not be determined.
468  */
469 
470  kkint32 otherClassLineNum; /**< Line where OtherClass in configuration was defined. */
471 
472  KKStr rootDir; /**< Common directory that all images for this training
473  * library come from. This is determined by iterating
474  * through all the 'trainingClasses' entries and
475  * looking for the common string that they all start by.
476  */
477 
478  KKStr rootDirExpanded; /**< Same as 'rootDir' except environment variables will be expanded. */
479 
481  subClassifiers; /**< Used when implementing a hierarchical classifier. This list is
482  * a consolidated list from the 'TrainingClass' objects that are
483  * specified in the configuration file. Each 'TrainingClass' section
484  * can specify a Sub-Classifier that is used to further break down that
485  * class. Multiple 'TrainingClass' sections can specify the same
486  * subClasifer; in that case we will want top only maintain one
487  * instance of that classifier.
488  */
489 
490  VectorKKStr* subClassifierNameList; /**< Used to communicate between by ReadXML, ReadXMLBaseToken, and ReadXMLPost */
491 
492  TrainingClassList trainingClasses; /**< List of 'Training_Class' objects; one for each 'Training_Classe'
493  * section defined in configuration file. Plus one for the 'Noise_Images'
494  * section.
495  */
496 
497  bool validateDirectories;
498 
499  public:
500  virtual KKStr FactoryName () const {return "TrainingConfiguration2::Factory";} /**< The name of the Factory class that produces an instance of this class. */
501 
503  (const KKStr& _className,
504  const KKStr& _configFileName,
505  bool _validateDirectories,
506  RunLog& _log
507  );
508 
509  /**
510  * Will be one TrainingConfiguration2::Factory derived class for each derived class of "TrainingConfiguration2"; they will be responsible for
511  * creating an instance of the correct "TrainingConfiguration2" derived instance. The static member "TrainingConfiguration2::registeredFactories"
512  * will keep track of all instances of the Factory derived class.
513  */
514  class Factory
515  {
516  public:
517  Factory (): className ("TrainingConfiguration2::Factory") {}
518  Factory (const KKStr& _className): className (_className) {}
519 
520  virtual
521  const KKStr& ClassName () {return className;}
522 
523  virtual
524  TrainingConfiguration2Ptr Manufacture (const KKStr& _configFileName,
525  bool _validateDirectories,
526  RunLog& _log
527  );
528  private:
529  KKStr className;
530  }; /* Factory */
531 
533 
534  static Factory* FactoryInstace ();
535 
536 
537  static void RegisterFatory (const KKStr& className,
538  Factory* factory
539  );
540 
541  private:
542  static std::map<KKStr,Factory*>* registeredFactories;
543 
544  static void FinalCleanUp ();
545 
546 
547  }; /* TrainingConfiguration2 */
548 
549  #define _TrainingConfiguration2_Defined_
550 
552  typedef TrainingConfiguration2::TrainingConfiguration2Const TrainingConfiguration2Const;
553  typedef TrainingConfiguration2::TrainingConfiguration2ConstPtr TrainingConfiguration2ConstPtr;
554 
555 
556  KKStr& operator<< (KKStr& left,
557  TrainingConfiguration2::ModelTypes modelingMethod
558  );
559 
560 
561  std::ostream& operator<< (std::ostream& os,
562  TrainingConfiguration2::ModelTypes modelingMethod
563  );
564 
565 
566 
567 
569  {
570  public:
573  {}
574 
576  {}
577 
578  /** @brief Returns the instance that has the same root name as 'rootName' if none found returns NULL. */
579  TrainingConfiguration2Ptr LookUp (const KKStr& rootName) const;
580  };
581 
583 
584  #define _TrainingConfiguration2List_Defined_
585 
586 
589 } /* namespace KKMLL */
590 
591 
592 
593 
594 #endif
#define _FactoryFVProducer_Defined_
virtual void Load(const KKStr &_configFileName, bool _validateDirectories, RunLog &log)
Base class to all Learning Algorithms.
Definition: Model.h:82
static TrainingConfiguration2 * CreateFromDirectoryStructure(const KKStr &_existingConfigFileName, const KKStr &_subDir, FactoryFVProducerPtr _fvFactoryProducer, RunLog &_log, bool &_successful, KKStr &_errorMessage)
Will create a instance using a sub-directory tree to drive the TraningClassList.
Model::ModelTypes ModelType() const
SVM_SelectionMethod
Definition: SVMparam.h:34
__int32 kkint32
Definition: KKBaseTypes.h:88
SVM_KernalType
Definition: SVMparam.h:54
void SetBinaryClassFields(MLClassPtr class1, MLClassPtr class2, const SVM233::svm_parameter &_param, const FeatureNumList &_features, float _weight)
static KKStr ModelTypeToStr(ModelTypes _modelType)
const KKStr & ConfigRootName() const
const BinaryClassParmsPtr GetParamtersToUseFor2ClassCombo(MLClassPtr class1, MLClassPtr class2) const
static KKStr ModelTypeToStr(ModelTypes _modelingType)
Definition: Model.cpp:256
TrainingClassPtr LocateByMLClassName(const KKStr &className)
decision_function svm_train_one(const svm_problem *prob, const svm_parameter *param, double Cp, double Cn, std::set< kkint32 > &BSVIndex)
Definition: svm.cpp:3154
void AddATrainingClass(TrainingClassPtr _trainClass)
Adds specified Training Class to list taking ownership of it.
Keeps track of selected features.
TrainingConfiguration2Ptr GenerateAConfiguraionForAHierarchialLevel(kkuint32 level, RunLog &log) const
SVM_MachineType
Definition: SVMparam.h:26
void BuildTrainingClassListFromDirectoryStructure(const KKStr &_subDir, bool &_successful, KKStr &_errorMessage, RunLog &_log)
SVM_EncodingMethod EncodingMethod() const
Model::ModelTypes ModelingMethod() const
void ReadXMLPost(VolConstBool &cancelFlag, RunLog &log)
void SetModelParameters(ModelParamPtr _svmParanters, kkint32 _examplesPerClass)
void WriteXMLFields(std::ostream &o) const
To be used by both Base Class and Derived classes to write fields that are specific to &#39;TrainingConfi...
void SetFeatureNums(const FeatureNumList &features)
TrainingConfiguration2 * TrainingConfiguration2Ptr
void SetTrainingClasses(TrainingClassListPtr _trainingClasses)
SVMparam * SVMparamPtr
Definition: SVMparam.h:286
SVM_EncodingMethod
Definition: SVMparam.h:46
TrainingConfiguration2Ptr LookUp(const KKStr &rootName) const
Returns the instance that has the same root name as &#39;rootName&#39; if none found returns NULL...
static ModelTypes ModelTypeFromStr(const KKStr &_modelingTypeStr)
Definition: Model.cpp:271
virtual void Save(std::ostream &o) const
FeatureVectorListPtr LoadFeatureDataFromTrainingLibraries(KKB::DateTime &latestImageTimeStamp, bool &changesMadeToTrainingLibraries, VolConstBool &cancelFlag, RunLog &log)
Load training data from the training library directories.
XmlToken * XmlTokenPtr
Definition: XmlStream.h:18
void MachineType(SVM_MachineType _machineType)
#define _FileDesc_Defined_
Definition: FileDesc.h:309
unsigned __int32 kkuint32
Definition: KKBaseTypes.h:89
const SVMparam & SVMparamREF(RunLog &log) const
BinaryClassParmsPtr GetBinaryClassParms(MLClassPtr class1, MLClassPtr class2)
virtual FactoryFVProducerPtr DefaultFeatureVectorProducer(RunLog &runLog) const
Container class for FeatureVector derived objects.
void SelectionMethod(SVM_SelectionMethod _selectionMethod)
KKTHread * KKTHreadPtr
static TrainingConfiguration2 * CreateFromFeatureVectorList(FeatureVectorList &_examples, FileDescPtr _fileDesc, const KKStr &_parameterStr, RunLog &_log)
float AvgNumOfFeatures(FeatureVectorListPtr trainExamples) const
void ModelParameters(ModelParamPtr _modelParameters)
void ImagesPerClass(kkint32 _imagesPerClass)
FeatureNumList * FeatureNumListPtr
TrainingConfiguration2Const * TrainingConfiguration2ConstPtr
KKStr(const KKStr &str)
Copy Constructor.
Definition: KKStr.cpp:561
void AddATrainingClass(MLClassPtr _newClass)
Will assume that images for this class will be saved off the RootDirectory using its own name for the...
void SetFeatureNums(MLClassPtr class1, MLClassPtr class2, const FeatureNumList &_features, float _weight=-1)
static bool ConfigFileExists(const KKStr &_configFileName)
XmlTag const * XmlTagConstPtr
Definition: KKStr.h:45
void WriteXML(const KKStr &varName, std::ostream &o) const
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
Definition: XmlStream.h:46
virtual void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
TrainingConfiguration2ListPtr SubClassifiers() const
TrainingConfiguration2 const TrainingConfiguration2Const
static KKStr GetEffectiveConfigFileName(const KKStr &configFileName)
Determine the correct configuration file name.
TrainingConfiguration2(MLClassListPtr _mlClasses, FactoryFVProducerPtr _fvFactoryProducer, const KKStr &_parameterStr, RunLog &_log)
Use this one if you want to create a default Configuration object.
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
void ExamplesPerClass(kkint32 _examplesPerClass)
void Number_of_rounds(kkint32 _number_of_rounds)
FeatureNumList GetFeatureNums(MLClassPtr class1, MLClassPtr class2)
Returns features selected for the specified class-pairIf none were specified for that pair will retur...
double C_Param(MLClassPtr class1, MLClassPtr class2) const
General purpose Configuration File manager class.
Definition: Configuration.h:45
KKStr DirectoryPathForClass(MLClassPtr mlClass) const
Fully expanded directory path for specified class.
This class encapsulates are the information necessary to build a SVMModel class.
Definition: SVMparam.h:74
static void RegisterFatory(const KKStr &className, Factory *factory)
void RootDir(const KKStr &_rootDir)
const TrainingClassList & TrainingClasses() const
MLClassListPtr ExtractClassList() const
FileDesc * FileDescPtr
ModelParamOldSVM * ModelParamOldSVMPtr
Definition: ModelOldSVM.h:24
KKStr(const char *str)
Definition: KKStr.cpp:537
XmlElementTrainingConfiguration2 * XmlElementTrainingConfiguration2Ptr
#define _NormalizationParms_Defined_
FeatureVectorListPtr LoadOtherClasssExamples(RunLog &runLog)
ModelParamPtr ModelParameters() const
TrainingClassList * TrainingClassListPtr
TrainingConfiguration2List * TrainingConfiguration2ListPtr
void EncodingMethod(SVM_EncodingMethod _encodingMethod)
virtual TrainingConfiguration2Ptr Duplicate() const
SVM_SelectionMethod SelectionMethod() const
virtual TrainingConfiguration2Ptr Manufacture(const KKStr &_configFileName, bool _validateDirectories, RunLog &_log)
TrainingConfiguration2(const TrainingConfiguration2 &tc)
const KKStr & RootDir() const
The root directory where Training library images are stored.
TrainingConfiguration2(MLClassListPtr _mlClasses, FileDescPtr _fileDesc, const KKStr &_parameterStr, RunLog &_log)
Use this one if you want to create a default Configuration object.
Used for logging messages.
Definition: RunLog.h:49
void EncodeProblem(const struct svm_paramater &param, struct svm_problem &prob_in, struct svm_problem &prob_out)
const TrainingClassPtr NoiseTrainingClass() const
MLClassListPtr ExtractFullHierachyOfClasses() const
static TrainingConfiguration2Ptr Manufacture(const KKStr &_className, const KKStr &_configFileName, bool _validateDirectories, RunLog &_log)
TrainingConfiguration2(MLClassListPtr _mlClasses, FileDescPtr _fileDesc, ModelParamPtr _modelParameters, RunLog &_log)
Creates a configuration file using the parameters specified in &#39;_modelParameters&#39;; does not read from...
TrainingConfiguration2 * TrainingConfiguration2Ptr
Definition: Classifier2.h:56
static ModelTypes ModelTypeFromStr(const KKStr &_modelTypeStr)
MLClassListPtr ExtractListOfClassesForAGivenHierarchialLevel(kkuint32 level) const
FeatureVectorList * FeatureVectorListPtr
Definition: Model.h:46
XmlTokenPtr ReadXMLBaseToken(XmlTokenPtr t, VolConstBool &cancelFlag, RunLog &log)
void KernalType(SVM_KernalType _kernalType)
TrainingClass * TrainingClassPtr
void NumOfRounds(kkint32 _numOfRounds)
XmlElementTemplate< TrainingConfiguration2 > XmlElementTrainingConfiguration2
void C_Param(MLClassPtr class1, MLClassPtr class2, double cParam)
void EmptyTrainingClasses()
Removes all training classes from the configuration; example use would be to remove all classes and t...
FactoryFVProducer * FactoryFVProducerPtr
Definition: Model.h:75
kkint32 NumOfFeaturesAfterEncoding(RunLog &log) const
const KKStr & ConfigFileNameSpecified() const
FactoryFVProducerPtr FvFactoryProducer(RunLog &log) const
virtual void Save(const KKStr &fileName) const
volatile const bool VolConstBool
Definition: KKBaseTypes.h:163