27 using namespace KKMLL;
35 fullHierarchyMustMatch (
false),
45 const KKStr& _configFileName2,
46 bool _fullHierarchyMustMatch
50 configFileName1
(_configFileName1
),
51 configFileName2
(_configFileName2
),
52 fullHierarchyMustMatch (_fullHierarchyMustMatch),
67 configFileName1
(_param.configFileName1
),
68 configFileName2
(_param.configFileName2
),
69 fullHierarchyMustMatch (_param.fullHierarchyMustMatch),
70 otherClass (_param.otherClass),
71 probFusionMethod (_param.probFusionMethod)
138 configFileName1
= value;
139 parameterUsed =
true;
142 log.Level (-1) <<
"ModelParamDual::ParseCmdLineParameter ***ERROR*** Configuration File1[" << configFileName1 <<
"] Does not exist." << endl;
155 configFileName2
= value;
156 parameterUsed =
true;
159 log.Level (-1) <<
"ModelParamDual::ParseCmdLineParameter ***ERROR*** Configuration File2[" << configFileName2 <<
"] Does not exist." << endl;
170 fullHierarchyMustMatch =
true;
172 fullHierarchyMustMatch = value
.ToBool ();
173 parameterUsed =
true;
184 log.Level (-1) <<
"ModelParamDual::ParseCmdLineParameter ***ERROR*** -OtherClass parameter must specify a class." << endl;
191 parameterUsed =
true;
213 log.Level (-1) <<
"ModelParamDual::ParseCmdLinePost ***ERROR*** You need to specify two configuration files -config1 and -config2" << endl;
228 cmdStr <<
" " <<
"-Classifier1" <<
" " << configFileName1;
231 cmdStr <<
" " <<
"-Classifier2" <<
" " << configFileName2;
233 if (fullHierarchyMustMatch)
234 cmdStr <<
" " <<
"-FullHierarchyMustMatch" <<
" " <<
"Yes";
237 cmdStr <<
" " <<
"-OtherClass" <<
" " << otherClass
->Name ();
285 while (t && (!cancelFlag))
293 configFileName1 = *(
dynamic_cast<XmlElementKKStrPtr> (t)->Value ());
296 configFileName2 = *(
dynamic_cast<XmlElementKKStrPtr> (t)->Value ());
304 else if (varName.EqualIgnoreCase (
"ProbFusionMethod"))
305 probFusionMethod = ProbFusionMethodFromStr (*(
dynamic_cast<XmlElementKKStrPtr> (t)->Value ()));
KKStr(kkint32 size)
Creates a KKStr object that pre-allocates space for 'size' characters.
XmlTag(const KKStr &_name, TagTypes _tagType)
virtual KKStr ToCmdLineStr() const
Creates a Command Line String that represents these parameters.
static ProbFusionMethod ProbFusionMethodFromStr(const KKStr &s)
bool EqualIgnoreCase(const char *s2) const
virtual KKStr ToCmdLineStr() const
Creates a a Command Line String that represents these parameters.
void WriteXMLFields(std::ostream &o) const
ModelParamDual(const ModelParamDual &_param)
static KKStr ProbFusionMethodToStr(ProbFusionMethod pfm)
virtual void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
XmlElementBool * XmlElementBoolPtr
Represents a "Class" in the Machine Learning Sense.
static void WriteXML(const bool b, const KKStr &varName, std::ostream &o)
virtual void ValidParam(bool _validParam)
KKStr & operator=(KKStr &&src)
KKStr(const KKStr &str)
Copy Constructor.
void AddAtribute(const KKStr &attributeName, const KKStr &attributeValue)
XmlTokenPtr ReadXMLModelParamToken(XmlTokenPtr t)
Will process any tokens that belong to 'ModelParam' and return NULL ones that are not will be passed ...
static bool ConfigFileExists(const KKStr &_configFileName)
XmlTag const * XmlTagConstPtr
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
static const KKStr & EmptyStr()
Static method that returns an Empty String.
const KKStr & Name() const
void WriteXML(const KKStr &varName, std::ostream &o) const
static MLClassPtr CreateNewMLClass(const KKStr &_name, kkint32 _classId=-1)
Static method used to create a new instance of a MLClass object.
virtual ~ModelParamDual()
ModelParam(const ModelParam &_param)
void WriteXML(std::ostream &o)
KKStr & operator=(const KKStr &src)
Used for logging messages.
void EncodeProblem(const struct svm_paramater ¶m, struct svm_problem &prob_in, struct svm_problem &prob_out)
virtual void WriteXML(const KKStr &varName, ostream &o) const
void WriteXML(const KKStr &varName, std::ostream &o) const
ModelParamDual(const KKStr &_configFileName1, const KKStr &_configFileName2, bool _fullHierarchyMustMatch)
XmlElementMLClass * XmlElementMLClassPtr
virtual XmlTokenPtr GetNextToken(VolConstBool &cancelFlag, RunLog &log)
bool ToBool() const
Returns the bool equivalent of the string, ex 'Yes' = true, 'No' = false, 'True' = true...
Abstract Base class for Machine Learning parameters.
virtual const KKStr & VarName() const
#define XmlFactoryMacro(NameOfClass)
virtual ModelParamDualPtr Duplicate() const
volatile const bool VolConstBool