Ejemplo n.º 1
0
void  FeatureEncoder::WriteXML (const KKStr&  varName,
                                ostream&      o
                               )  const
{
  XmlTag  tagStart ("TrainingClassList", XmlTag::TagTypes::tagStart);
  if  (!varName.Empty ())
    tagStart.AddAtribute ("VarName", varName);

  tagStart.WriteXML (o);
  o << endl;

  XmlElementInt32::WriteXML  (codedNumOfFeatures,     "CodedNumOfFeatures",     o);
  XmlElementDouble::WriteXML (c_Param,                "c_Param",                o);
  XmlElementInt32::WriteXML  (numEncodedFeatures,     "NumEncodedFeatures",     o);
  XmlElementInt32::WriteXML  (numOfFeatures,          "NumOfFeatures",          o);
  XmlElementInt32::WriteXML  (xSpaceNeededPerExample, "xSpaceNeededPerExample", o);

  if  (cardinalityDest)
    XmlElementArrayInt32::WriteXML (numOfFeatures, cardinalityDest, "CardinalityDest", o);

  if  (class1)  class1->Name ().WriteXML ("Class1", o);
  if  (class2)  class2->Name ().WriteXML ("Class2", o);
  if  (destFeatureNums)
    XmlElementArrayInt32::WriteXML (numOfFeatures, destFeatureNums, "DestFeatureNums", o);

  if  (fileDesc)      fileDesc->WriteXML     ("FileDesc",     o);
  if  (destFileDesc)  destFileDesc->WriteXML ("DestFileDesc", o);

  if  (destWhatToDo)
  {
    VectorInt32  v;
    for  (kkint32 x = 0;  x < numOfFeatures;  ++x)
      v.push_back ((kkint32)(destWhatToDo[x]));
    XmlElementVectorInt32::WriteXML (v, "DestWhatToDo", o);
  }

  EncodingMethodToStr (encodingMethod).WriteXML ("EncodingMethod", o);

  selectedFeatures.WriteXML ("selectedFeatures", o);

  if  (srcFeatureNums)
    XmlElementArrayInt32::WriteXML (numOfFeatures, srcFeatureNums, "SrcFeatureNums", o);
 
  XmlTag  tagEnd ("TrainingClassList", XmlTag::TagTypes::tagEnd);
  tagEnd.WriteXML (o);
  o << endl;
}
Ejemplo n.º 2
0
void  FeatureNumList::WriteXML (const KKStr&  varName,
                                ostream&      o
                               )  const
{
  XmlTag  startTag ("FeatureNumList", XmlTag::TagTypes::tagStart);
  if  (!varName.Empty ())
    startTag.AddAtribute ("VarName", varName);
  startTag.AddAtribute ("MaxFeatureNum", maxFeatureNum);
  startTag.AddAtribute ("NumOfFeatures", numOfFeatures);
  startTag.WriteXML (o);

  o << ToString ();

  XmlTag  endTag ("FeatureNumList", XmlTag::TagTypes::tagEnd);
  endTag.WriteXML (o);
  o << endl;
}
Ejemplo n.º 3
0
void  ModelUsfCasCor::WriteXML (const KKStr&  varName,
                                ostream&      o
                               )  const
{
  XmlTag  startTag ("ModelUsfCasCor",  XmlTag::TagTypes::tagStart);
  if  (!varName.Empty ())
    startTag.AddAtribute ("VarName", varName);
  startTag.WriteXML (o);
  o << endl;

  WriteModelXMLFields (o);  // Write the base class data fields 1st.

  usfCasCorClassifier->WriteXML ("UsfCasCorClassifier", o);

  XmlTag  endTag ("ModelUsfCasCor", XmlTag::TagTypes::tagEnd);
  endTag.WriteXML (o);
  o << endl;
}  /* WriteXML */
Ejemplo n.º 4
0
void  ModelParamUsfCasCor::WriteXML (const KKStr&  varName,
                                     ostream&      o
                                    )  const
{
  XmlTag  startTag ("ModelParamUsfCasCor",  XmlTag::TagTypes::tagStart);
  if  (!varName.Empty ())
    startTag.AddAtribute ("VarName", varName);
  startTag.WriteXML (o);
  o << endl;

  WriteXMLFields (o);

  XmlElementInt32::WriteXML (in_limit,          "in_limit",         o);
  XmlElementInt32::WriteXML (number_of_rounds,  "number_of_rounds", o);
  XmlElementInt32::WriteXML (number_of_trials,  "number_of_trials", o);
  XmlElementInt64::WriteXML (random_seed,       "random_seed",      o);
  XmlElementBool::WriteXML  (useCache,          "useCache",         o);
  
  XmlTag  endTag ("ModelParamUsfCasCor", XmlTag::TagTypes::tagEnd);
  endTag.WriteXML (o);
  o << endl;
}  /* WriteXML */