KSquare Utilities
ModelParamDual.h
Go to the documentation of this file.
1 #if !defined(_MODELPARAMDUAL_)
2 #define _MODELPARAMDUAL_
3 
4 
5 #include "ModelParam.h"
6 
7 
8 namespace KKMLL
9 {
10  /**
11  *@class KKMLL::ModelParamDual
12  ************************************************************************************************
13  * Parameters used for the Dual Classifier. *
14  ************************************************************************************************
15  *@see Model
16  */
17  class ModelParamDual: public ModelParam
18  {
19  public:
21 
22  enum class ProbFusionMethod
23  {
24  Null,
25  Or,
26  And
27  };
28 
29 
30  ModelParamDual ();
31 
32  ModelParamDual (const KKStr& _configFileName1,
33  const KKStr& _configFileName2,
34  bool _fullHierarchyMustMatch
35  );
36 
37  ModelParamDual (const ModelParamDual& _param);
38 
39  virtual
40  ~ModelParamDual ();
41 
42  static
44 
45  static
47 
48 
49  const KKStr& ConfigFileName1 () const {return configFileName1;}
50  const KKStr& ConfigFileName2 () const {return configFileName2;}
51  bool FullHierarchyMustMatch () const {return fullHierarchyMustMatch;}
52  MLClassPtr OtherClass () const {return otherClass;}
53 
55 
56  void OtherClass (MLClassPtr _otherClass) {otherClass = _otherClass;}
57 
58  virtual
60 
61 
62  /**
63  *@brief Creates a Command Line String that represents these parameters.
64  *@details All derived classes should implement this method. They should first call this method and
65  * then append there own parameters that are specific to their implementation.
66  */
67  virtual
68  KKStr ToCmdLineStr () const;
69 
70 
71  virtual void ReadXML (XmlStream& s,
72  XmlTagConstPtr tag,
73  VolConstBool& cancelFlag,
74  RunLog& log
75  );
76 
77 
78  virtual void WriteXML (const KKStr& varName,
79  ostream& o
80  ) const;
81 
82 
83  private:
84  virtual
85  void ParseCmdLinePost (RunLog& log); // Will get called after the entire parameter string has been processed.
86 
87  virtual
88  void ParseCmdLineParameter (const KKStr& parameter,
89  const KKStr& value,
90  bool& parameterUsed,
91  RunLog& log
92  );
93 
94  KKStr configFileName1;
95  KKStr configFileName2;
96  bool fullHierarchyMustMatch;
97  MLClassPtr otherClass;
98  ProbFusionMethod probFusionMethod;
99  }; /* ModelParamDual */
100 
101 
103 
106 
107 } /* namespace KKMLL */
108 
109 
110 
111 #endif
virtual KKStr ToCmdLineStr() const
Creates a Command Line String that represents these parameters.
static ProbFusionMethod ProbFusionMethodFromStr(const KKStr &s)
ModelParamDual(const ModelParamDual &_param)
ModelParam derived classes will implement their "XmlElement" helper class via this template...
Definition: ModelParam.h:260
static KKStr ProbFusionMethodToStr(ProbFusionMethod pfm)
virtual void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
const KKStr & ConfigFileName2() const
XmlElementModelParamDual * XmlElementModelParamDualPtr
ModelParamDual * ModelParamDualPtr
XmlTag const * XmlTagConstPtr
Definition: KKStr.h:45
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
Definition: XmlStream.h:46
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
ModelParamDual * ModelParamDualPtr
Definition: ModelDual.h:56
virtual ModelParamTypes ModelParamType() const
void OtherClass(MLClassPtr _otherClass)
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)
virtual void WriteXML(const KKStr &varName, ostream &o) const
const KKStr & ConfigFileName1() const
XmlElementModelParamTemplate< ModelParamDual > XmlElementModelParamDual
ModelParamDual(const KKStr &_configFileName1, const KKStr &_configFileName2, bool _fullHierarchyMustMatch)
bool FullHierarchyMustMatch() const
Abstract Base class for Machine Learning parameters.
Definition: ModelParam.h:35
virtual ModelParamDualPtr Duplicate() const
MLClassPtr OtherClass() const
volatile const bool VolConstBool
Definition: KKBaseTypes.h:163