コード例 #1
0
void   FeatureFileConverter::NormalizeExamples (ModelParam&         param,
                                                FeatureVectorList&  examples
                                               )
{
  KKStr  parameterStr = param.ToCmdLineStr ();
  NormalizationParmsPtr  normParms = NULL;

  if  (osFileExists (nornParmsFileName))
  {
    bool  successful = false;

    normParms = new NormalizationParms (examples.FileDesc (), nornParmsFileName, successful, log);
    if  (!successful)
    {
      KKStr  errMsg = "Could not load normalization parameters file[" + nornParmsFileName + "]";
      log.Level (-1) << endl << "NormalizeExamples    *** ERROR ***    " << errMsg << endl << endl;
      throw KKStrException (errMsg);
    }
  }
  else
  {
    bool  successful = false;
    normParms = new NormalizationParms (param, examples, log);
    normParms->Save (nornParmsFileName, successful);
    if  (!successful)
    {
      KKStr  errMsg = "Could not save normalization parameters file[" + nornParmsFileName + "]";
      log.Level (-1) << endl << "NormalizeExamples    *** ERROR ***      " << errMsg << endl << endl;
      throw  KKStrException (errMsg);
    }
  }

  normParms->NormalizeImages (&examples);

  delete  normParms;
  normParms = NULL;
}  /* NormalizeExamples */
コード例 #2
0
/**
 *@details   
 *  Determines if the other FeatreVectorList has the same underlining layout;  that is each
 *  field is of the same type and meaning. This way we can determine if one list contains
 *  Apples while the other contains Oranges.
 */
bool  FeatureVectorList::SameExceptForSymbolicData (const FeatureVectorList&  otherData,
                                                    RunLog&                   log
                                                   )  const
{
  return  fileDesc->SameExceptForSymbolicData (*(otherData.FileDesc ()), log);
}