• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VectorKKStr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VectorKKStr的典型用法代码示例。如果您正苦于以下问题:C++ VectorKKStr类的具体用法?C++ VectorKKStr怎么用?C++ VectorKKStr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VectorKKStr类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: applicationName

CmdLineExpander::CmdLineExpander (const KKStr&  _applicationName,
                                  RunLog&       _log,
                                  const KKStr&  _cmdLine
                                 ):
  applicationName (_applicationName),
  log             (_log)

{
  VectorKKStr  initialParameters;

  KKStr  cmdLine (_cmdLine);

  cmdLine.TrimLeft ();
  while  (!cmdLine.Empty ())
  {
    KKStr  nextField = cmdLine.ExtractQuotedStr ("\n\r\t ", false);  // false = Do not decode escape characters
    nextField.TrimRight ();
    if  (!nextField.Empty ())
      initialParameters.push_back (nextField);
    cmdLine.TrimLeft ();
  }

  BuildCmdLineParameters (initialParameters);
  BuildExpandedParameterPairs ();
}
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:25,代码来源:CmdLineExpander.cpp


示例2: for

void  DataBaseServer::ParseParameterStr (const  KKStr&  parameterStr)
{
  VectorKKStr  parameterPairs = parameterStr.Split ("\t");

  VectorKKStr::iterator  idx;
  for  (idx = parameterPairs.begin ();  idx != parameterPairs.end ();  idx++)
  {
    VectorKKStr  fields = (*idx).Split (":=");   // Split by either ':'  or  '='
    if  (fields.size () < 2)
    {
      // Should be two fields;  line must be malformed.
      continue;
    }

    KKStr  parameterName = fields[0].ToUpper ();

    if      ((parameterName == "EMBEDDED")      ||  (parameterName == "EMB")       ||  (parameterName == "E"))   embedded     = fields[1].ToBool ();
    else if ((parameterName == "MYSQLDATADIR")  ||  (parameterName == "MYSQL")     ||  (parameterName == "MDD")) mySqlDataDir = fields[1];
    else if ((parameterName == "DESCRIPTION")   ||  (parameterName == "DESC")      ||  (parameterName == "D"))   description  = fields[1];
    else if ((parameterName == "HOSTNAME")      ||  (parameterName == "HOST")      ||  (parameterName == "H"))   hostName     = fields[1];
    else if ((parameterName == "USERNAME")      ||  (parameterName == "USER")      ||  (parameterName == "U"))   userName     = fields[1];
    else if ((parameterName == "PASSWORD")      ||  (parameterName == "PW")        ||  (parameterName == "P"))   passWord     = fields[1];
    else if ((parameterName == "PORTNUM")       ||  (parameterName == "PN"))                                     portNum      = fields[1].ToUint32 ();
    else if ((parameterName == "DATABASENAME")  ||  (parameterName == "DATABASE")  ||  (parameterName == "DB"))  dataBaseName = fields[1];
  }

  if  (description.EqualIgnoreCase ("Embedded"))
    embedded = true;
}  /* ParseParameterStr */
开发者ID:KurtKramer,项目名称:Pices,代码行数:29,代码来源:DataBaseServer.cpp


示例3: FileInStack

bool  FileInStack (const KKStr&       cmdFileName, 
                   const VectorKKStr& cmdFileStack
                  )
{
  VectorKKStr::const_iterator  idx;
  for  (idx = cmdFileStack.begin ();  idx != cmdFileStack.end ();  idx++)
  {
    if  (*idx == cmdFileName)
      return true;
  }
  return  false;

}  /* FileInStack */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:13,代码来源:CmdLineExpander.cpp


示例4: ProcessStatusStr

void  KKJob::ProcessStatusStr (const KKStr&  statusStr)
{
  log.Level (30) << "KKJob::ProcessStatusStr[" << statusStr << "]" << endl;
  KKStr  fieldName;
  KKStr  fieldValue;

  VectorKKStr fields = statusStr.Split ('\t');
  kkuint32  fieldNum = 0;

  while  (fieldNum < fields.size ())
  {
    fieldName = fields[fieldNum];
    fieldNum++;
    if  (fieldNum < fields.size ())
    {
      fieldValue = fields[fieldNum];
      fieldNum++;
    }
    else
    {
      fieldValue = "";
    }

    fieldName.Upper ();
    fieldValue.TrimLeft ("\n\r\t ");
    fieldValue.TrimRight ("\n\r\t ");

    if  (fieldName.CompareIgnoreCase ("JOBID") == 0)
      jobId = atoi (fieldValue.Str ());

    else  if  (fieldName.CompareIgnoreCase ("PARENTID") == 0)
      parentId = atoi (fieldValue.Str ());

    else  if  (fieldName.CompareIgnoreCase ("STATUS") == 0)
      status = JobStatusFromStr (fieldValue);
   
    else  if  (fieldName.CompareIgnoreCase ("NumProcessors") == 0)
      numProcessors = fieldValue.ToInt ();

    else  if  (fieldName.CompareIgnoreCase ("NumPorcessesAllowed") == 0)
      numPorcessesAllowed = fieldValue.ToInt ();

    else  if  (fieldName.CompareIgnoreCase ("Prerequisites") == 0)
      PrerequisitesFromStr (fieldValue);
      
    else
    {
      ProcessStatusField (fieldName, fieldValue);
    }
  }
}  /* ProcessStatusStr */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:51,代码来源:KKJob.cpp


示例5: if

void  KKJob::PrerequisitesFromStr (const KKStr&  s)
{
  prerequisites.clear ();

  if  (s.CompareIgnoreCase ("None") != 0)
  {
    VectorKKStr fields = s.Split (',');
    for  (kkuint32 x = 0;  x < fields.size ();  ++x)
    {
      kkint32 p = fields[x].ToInt ();
      prerequisites.push_back (p);
    }
  }
}  /* PrerequisitesFromStr */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:14,代码来源:KKJob.cpp


示例6: ExtractParametersFromFile

void  CmdLineExpander::ExtractParametersFromFile (const KKStr&  cmdFileName, 
                                                  VectorKKStr&  cmdFileParameters,
                                                  bool&         validFile
                                                 )
{
  FILE*  in = osFOPEN (cmdFileName.Str (), "r");
  if  (!in)
  {
    log.Level (-1) << endl << endl << endl
         << "ExtractParametersFromFile     *** EROR ***" << endl
         << endl
         << "      Invalid CmdFile[" << cmdFileName << "]" << endl
         << endl;
    validFile = false;
    return;
  }

  KKStr  token;
  bool    eof = false;

  token  = osReadNextQuotedStr (in, " \n\r", eof);
  while  (!eof)
  {
    cmdFileParameters.push_back (token);
    token  = osReadNextQuotedStr (in, " \n\r", eof);
  }

  std::fclose (in);
}  /* ExtractParametersFromFile */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:29,代码来源:CmdLineExpander.cpp


示例7: ExpandCmdLine

void  CmdLineExpander::ExpandCmdLine (kkint32 argc, 
                                      char**  argv
                                     )
{
  parmsGood = true;
  
  VectorKKStr  initialParameters;
  {
    kkint32 y;
    for  (y = 1; y < argc;  y++)
      initialParameters.push_back (argv[y]);
  }

  BuildCmdLineParameters (initialParameters);
  BuildExpandedParameterPairs ();

  return;
}  /* ExpandCmdLine */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:18,代码来源:CmdLineExpander.cpp


示例8: ProcessData

void  InstrumentDataPitchAndRoll::ProcessData (const KKStr&  txt)
{
  VectorKKStr  fields = txt.Split (" \t\n\r");
  if  (fields.size () < 4)
     return;

  float  pitch = -999.99f;
  float  roll  = -999.99f;

  KKStr  fieldName  = "";
  KKStr  fieldValue = "";
  kkuint32 fieldNum   = 0;

  while  (fieldNum < fields.size ())
  {
    fieldName  = fields[fieldNum];
    fieldName.Upper ();
    fieldNum++;

    if  (fieldNum < fields.size ())
    {
      fieldValue = fields[fieldNum];  
      fieldNum++;
    }
    else
    {
      fieldValue = "";
    }

    if  (fieldName == "R")
    {
      roll = fieldValue.ToFloat ();
    }
    else if  (fieldName == "P")
    {
      pitch = fieldValue.ToFloat ();
    }
  } 

  manager->PitchAndRollData (curTextLineStartScanLine, pitch, roll);
}  /* ProcessData */
开发者ID:KurtKramer,项目名称:Pices,代码行数:41,代码来源:InstrumentDataPitchAndRoll.cpp


示例9: ProcessBatteryData

void  InstrumentDataBatteryMeter::ProcessBatteryData (const KKStr&  txt)
{
  // We will be expecting 5 fields;  
  // <Current battery> <\t> <Bat 0 Voltage>  <\t> .... <\t> <Bat-3 Voltage>
    
  VectorKKStr  fields = txt.Split (',');
  if  (fields.size () < (1 + numOfBatteries))
    return;
      
  // activeBattery is '1' based  that is batteries '1' - '4';  so 
  // batteryLevels[0] = battery level for battery 1.
  kkint32  activeBattery = fields[0].ToInt ();
  if  ((activeBattery < 1)  ||  ((kkuint32)activeBattery > numOfBatteries))
    return;

  kkuint32  x;
  for  (x = 0;  x < numOfBatteries;  x++)
    batteryLevels[x] = fields[x + 1].ToFloat ();

  manager->BatteryData (curTextLineStartScanLine, activeBattery, batteryLevels);
}  /* ProcessBatteryData */
开发者ID:KurtKramer,项目名称:Pices,代码行数:21,代码来源:InstrumentDataBatteryMeter.cpp


示例10: RegisteredDrivers

VectorKKStr  FeatureFileIO::RegisteredDriverNames (bool  canRead,
                                                   bool  canWrite
                                                  )
{
  vector<FeatureFileIOPtr>*  drivers = RegisteredDrivers ();
  VectorKKStr  names;
  vector<FeatureFileIOPtr>::iterator  idx;

  for  (idx = drivers->begin ();  idx != drivers->end ();  idx++)
  {
    FeatureFileIOPtr  driver = *idx;
    if  (canRead  &&  (!driver->CanRead ()))
      continue;

    if  (canWrite  &&  (!driver->CanWrite ()))
      continue;

    names.push_back (driver->DriverName ());
  }

  return  names;
}  /* RegisteredDriverNames */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:22,代码来源:FeatureFileIO.cpp


示例11: if

void   AbundanceCorrectionStatsBuilder::Main ()
{
  if  (Abort ())
    return;

  if  (reportFileName.Empty ())
  {
    DateTime  d = osGetLocalDateTime ();
    KKStr  reportDir = osAddSlash (SipperVariables::PicesReportDir ()) + "AbundanceAdjustments";
    osCreateDirectoryPath (reportDir);
    if  (configFileName.Empty ())
      reportFileName = osAddSlash (reportDir) + "NoConfigFile" + "_" + d.YYYYMMDDHHMMSS () + ".txt";
    else
      reportFileName = osAddSlash (reportDir) + osGetRootName (configFileName) + "_" + d.YYYYMMDDHHMMSS () + ".txt";
  }
 
  report = new ofstream (reportFileName.Str ());
  PrintComandLineParameters ();

  if  (configFileName.Empty ())
  {
    log.Level (-1) << endl << endl 
      << "AbundanceCorrectionStatsBuilder::Main   ***ERROR***    Configuration File was not specified." << endl
      << endl;
    Abort (true);
    *report << endl << "*** NO CONFIGURATION FILE SPECIFIED ***" << endl << endl;
    return;
  }

  delete  config;
  config = new TrainingConfiguration2 (fileDesc, 
                                       configFileFullPath, 
                                       log,
                                       true    /**<  'true' = validateDirectories. */
                                      );

  if  (!config->FormatGood ())
  {
    log.Level (-1) << endl
      << "AbundanceCorrectionStatsBuilder::Main   Config[" << configFileName << "] has invalid format." << endl
      << endl;

    VectorKKStr  errors = config->FormatErrorsWithLineNumbers ();
    VectorKKStr::const_iterator  idx;
    log.Level (-1) << endl;
    for  (idx = errors.begin ();  idx != errors.end ();  ++idx)
      log.Level (-1) << (*idx) << endl;
    log.Level (-1) << endl << endl;

    *report << endl << endl << "***   Configuratiuon file[" << configFileName << " contains formatting errors." << endl << endl;

    config->PrintFormatErrors (*report);

    return;
  }

  bool      changesMadeToTrainingLibraries = false;
  bool      cancelFlag = false;
  DateTime  latestImageTimeStamp;

  delete  trainLibData;
  trainLibData = config->LoadFeatureDataFromTrainingLibraries (latestImageTimeStamp, changesMadeToTrainingLibraries, cancelFlag);
  if  (!trainLibData)
  {
    log.Level (-1) << endl
      << "AbundanceCorrectionStatsBuilder::Main   ***ERROR***    No training data was loaded." << endl
      << endl;

    *report << endl << "*** Failed to load training data ***" << endl;
    return;
  }

  otherClass = config->OtherClass ();
  if  (!otherClass)
    otherClass = MLClass::CreateNewMLClass ("Other", -1);

  configClasses = config->ExtractClassList ();
  configClasses->SortByName ();
  if  (configClasses->PtrToIdx (otherClass) >= 0)
  {
    log.Level (-1) << endl
      << "AbundanceCorrectionStatsBuilder::Main   ***ERROR***   OtherClass[" << otherClass->Name () << "] is specified as a Training Class; it must be swepcified separatly." << endl
      << endl;
    *report << endl << "*** Failed to load other class data ***" << endl;
    return;
  }

  trainLibDataClasses = trainLibData->ExtractMLClassConstList ();
  trainLibDataClasses->SortByName ();

  if  ((*configClasses) != (*trainLibDataClasses))
  {
    Abort (true);
    log.Level (-1) << endl 
      << "AbundanceCorrectionStatsBuilder::Main   ***ERROR***   Class make up of training data does not correspond to configuration file." << endl
      << endl;

    *report << endl << "*** Training data contains different classes that Confg File  ***" << endl;
    return;
  }
//.........这里部分代码省略.........
开发者ID:jizhihang,项目名称:Pices-XXX-,代码行数:101,代码来源:AbundanceCorrectionStatsBuilder.cpp


示例12: ImportGPSDataGPGGA

void  ImportGPSDataGPGGA (const KKStr&  fileName)
{
  RunLog  log;

  DataBasePtr  dbConn = new DataBase (log);

  ifstream  i (fileName.Str ());
  if  (!i.is_open ())
  {
    log.Level (-1) << endl << endl 
       << "ImpotrtGPSData  Could not open file[" << fileName << "]" << endl
       << endl;
    return;
  }
  log.Level (10) << endl << endl << endl << endl << endl
    << "ImpotrtGPSData   FileName[" << fileName << "]" << endl << endl
    << endl;

  char  buff[20480];
  bool  firstPass = true;

  int  lastMinute = 0;
  int  linesRead = 0;

  KKStr  ln (256);

  DateTime  lastDateTime;
  while  (i.getline (buff, sizeof (buff)))
  {
    linesRead++;
    ln = buff;
    ln.TrimLeft ();
     
    if  (!ln.LocateStr ("GPGGA"))
      continue;

    VectorKKStr  fields = ln.Parse (",");
    if  (fields.size () < 8)
      continue;

    if  (!fields[2].EqualIgnoreCase ("$GPGGA"))
      continue;


    /*
    0           1             2        3         4      5       6       7   8  
06/01/2010, 23:59:59.818,  $GPGGA,  235958,  2840.927,  N,  08828.458,  W,  2,  09,22.10,0,M,,,14,0000*12
06/02/2010, 00:00:10.818,  $GPGGA,  000009,  2840.931,  N,  08828.482,  W,  1,  09,0.89,0,M,,,,*2D
06/02/2010, 00:00:21.802,  $GPGGA,  000020,  2840.929,  N,  08828.505,  W,  1,  09,0.89,0,M,,,,*21
06/02/2010, 00:00:31.818,  $GPGGA,  000030,  2840.924,  N,  08828.526,  W,  1,  09,0.89,0,M,,,,*2C
06/02/2010, 00:00:42.818,  $GPGGA,  000041,  2840.917,  N,  08828.547,  W,  1,  09,0.89,0,M,,,,*2D
06/02/2010, 00:00:53.802,  $GPGGA,  000052,  2840.906,  N,  08828.568,  W,  1,  09,1.00,0,M,,,,*22
06/02/2010, 00:01:03.802,  $GPGGA,  000102,  2840.895,  N,  08828.585,  W,  1,  09,0.89,0,M,,,,*2E
06/02/2010, 00:01:13.818,  $GPGGA,  000112,  2840.883,  N,  08828.600,  W,  1,  09,0.89,0,M,,,,*26
   */


    KKStr  dateStr = fields[0];
    KKStr  timeStr = fields[1];

    KKStr  latStr = fields[4];
    KKStr  logStr = fields[6];

    auto  x = latStr.LocateCharacter ('.');
    if  (!x) 
      continue;

    KKStr latMinStr = latStr.SubStrPart (x - 2);
    KKStr latDegStr = latStr.SubStrSeg (0, x - 2);

    double latitude = latDegStr.ToDouble () + latMinStr.ToDouble () / 60.0;
    if  (fields[5].EqualIgnoreCase ("S"))
      latitude = 0.0 - latitude;

    x = logStr.LocateCharacter ('.');
    if  (!x) 
      continue;

    KKStr logMinStr = logStr.SubStrPart (x - 2);
    KKStr logDegStr = logStr.SubStrSeg (0, x - 2);

    double longitude = logDegStr.ToDouble () + logMinStr.ToDouble () / 60.0;
    if  (fields[7].EqualIgnoreCase ("W"))
      longitude = 0.0 - longitude;

    DateType  gmtDate (dateStr);
    TimeType  gmtTime (timeStr);

    DateTime  gmtDateTime (gmtDate, gmtTime);
    DateTime  localTime = gmtDateTime;
    localTime.HoursAdd (-4);

    DateTime  startDT = localTime;
    DateTime  endDT   = localTime;

    if  (firstPass)
    {
      firstPass = false;
      startDT.SecondsAdd (-180);
    }
//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:Pices,代码行数:101,代码来源:MergeFeatureFiles.cpp


示例13: Test

void  Test ()
{
  RunLog  log;
  DataBasePtr  dbConn = new DataBase (log);

  //  InstrumentDataPtr  id = dbConn->InstrumentDataGetByScanLine ("TestCruise_01", 4022);

  //{
  //  ImageFeaturesPtr  fv  = NULL;
  //  KKStr imageFileName = "TestCruise_01_00006156_3701";
  //  DataBaseImagePtr dbi = dbConn->ImageLoad (imageFileName);
  //  if  (dbi)
  //    fv  = dbConn->FeatureDataRecLoad (dbi);
  //  delete  fv;
  //  delete  dbi;
  //}

  {
    SipperCruiseListPtr  cruises = dbConn->SipperCruiseLoadAllCruises ();
    delete  cruises;
  }



  bool  cancelFlag = false;

  {
    DataBaseImageGroupPtr  existingGroup = dbConn->ImageGroupLoad ("TestGroup2");

    if  (existingGroup)
    {

      VectorUint*  depthStats = dbConn->ImageGetDepthStatistics 
             (existingGroup, 
              "",         // sipperFileName
              10.0f,      // depthIncrements,
              NULL,       // mlClass,
              'P',        // 'p' = Use Predicted Class
              0.0f, 1.0f, // minProb, maxProb,
              0, 0        // minSize, maxSize
             );

      delete  depthStats;
      depthStats = NULL;



      ClassStatisticListPtr  stats = dbConn->ImageGetClassStatistics 
           (existingGroup,
            "ETP2008_8A_06",
            NULL,
            'P',         // 'P' = Use Predicted Class
            0.0f, 1.0f,  // MinProb,  MaxProb
            0, 0,        // MinSize,  MaxSize
            0.0f, 0.0f   // MinDepth, MaxDepth
           );



      delete  stats;
      stats = NULL;
    }

    DataBaseImageListPtr  images = dbConn->ImagesQuery (existingGroup, true, cancelFlag);
  }

  DataBaseImageGroupPtr g = new  DataBaseImageGroup (-1, "TestGroup2", "Description of group", 0);
  dbConn->ImageGroupInsert (*g);
  if  (dbConn->DuplicateKey ())
  {
    DataBaseImageGroupPtr  existingGroup = dbConn->ImageGroupLoad (g->Name ());
    if  (existingGroup)
    {
      g->ImageGroupId (existingGroup->ImageGroupId ());
      dbConn->ImageGroupDelete (existingGroup->ImageGroupId ());
      dbConn->ImageGroupInsert (*g);
      delete  existingGroup;
      existingGroup = NULL;
    }
  }


  DataBaseImageListPtr  images = dbConn->ImagesQuery (NULL,
                                                      "ETP2008", "8", "A", NULL,
                                                      'P',             // 'P' = Use Predicted Class
                                                      0.0f, 1.0f,      // MinProb,  MaxProb
                                                      0, 0,            // MinSize,  MaxSize
                                                      290.0f, 293.0f,  // MinDepth, MaxDepth
                                                      0,               // Restart Image
                                                      -1,              // unlimited Limit
                                                      true,            // true=Include ThumbNail
                                                      cancelFlag
                                                     );


  VectorKKStr fileNames;
  {
    DataBaseImageList::iterator  idx;
    for  (idx = images->begin ();  idx != images->end ();  idx++)
      fileNames.push_back ((*idx)->ImageFileName ());
//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:Pices,代码行数:101,代码来源:MergeFeatureFiles.cpp


示例14: classSummaries

void	OurNeighbors::RandomReport (ImageFeaturesList&  images)
{
   double   allClassesMeanNNDAnyClass    = 0.0f;
   double   allClassesMeanStdDevAnyClass = 0.0f;

  ClassSummaryList  classSummaries (log);

  MLClassList::iterator  classIdx;

  VectorKKStr  zScoreSummaryLines;

  for  (classIdx = mlClasses->begin ();  classIdx != mlClasses->end ();  classIdx++)
  {
    MLClassPtr  mlClass = *classIdx;

    if  (fromPlankton  &&  (fromPlankton != mlClass))
      continue;

    double  randomMeanNND   = 0.0f;
    double  randomStdDevNND = 0.0f;
    double  realDataU2Stat  = 0.0f;
    double  sampleMeanNND   = 0.0f;
    double  sampleStdDevNND = 0.0f;
    double  sampleMaxDist   = 0.0f;
    double  sampleMinDist   = 0.0f;

    ImageFeaturesListPtr  imagesInClass = images.ExtractExamplesForAGivenClass (mlClass);
    if  (imagesInClass->QueueSize () > 0)
    {
      // We are going to make a list of images that has duplicate instances of 'ImageFeatures' objects 
      // This way when we Randomize the locations of each 'sfCentroidRow' and 'sfCentroidCol' we do not 
      // imapct on the original data.
      ImageFeaturesListPtr  imagesToRandomize = new ImageFeaturesList (*imagesInClass,
                                                                       true  // 'true means we want to own the data so new instances will be created.
                                                                      );

      LLoydsEntryListPtr  lloydsEntries =  DeriveAllLLoydsBins (*imagesToRandomize);
      {
        // We will now get mean and stdDev of nnd for this class
        NeighborList  neighbors (*imagesToRandomize, log);
        neighbors.FindNearestNeighbors (neighborType, mlClass);
        neighbors.CalcStatistics (sampleMeanNND, sampleStdDevNND, sampleMaxDist, sampleMinDist);
      }


      KKStr  randomReportFileName;

      if  (reportFileName.Empty ())
        randomReportFileName = "RandomDistanceReport";
      else
        randomReportFileName = osRemoveExtension  (reportFileName) + "_Random";

      randomReportFileName << "_" << mlClass->Name () << ".txt";

      ofstream  randomReport (randomReportFileName.Str ());

      randomReport << "Random Distribution Report" << endl 
                   << endl;

      randomReport << "Source Directory  [" << sourceRootDirPath   << "]" << endl;
      randomReport << "Class             [" << mlClass->Name () << "]" << endl;

      RandomNND  randomizeLocations (lastScanLine, 
                                     *imagesToRandomize, 
                                     numOfIterations, 
                                     numOfBuckets, 
                                     bucketSize, 
                                     randomReport, 
                                     log
                                    );  

      randomizeLocations.GenerateReport ();

      randomMeanNND   = randomizeLocations.NND_Mean ();
      randomStdDevNND = randomizeLocations.NND_StdDev ();
      realDataU2Stat  = randomizeLocations.RealDataU2Stat ();

      //double  sampleMeanNND   = 0.0f;
      //double  sampleStdDevNND = 0.0f;

      double  z_Score = Z_Score (sampleMeanNND, randomMeanNND, randomStdDevNND, imagesToRandomize->QueueSize ());

      randomReport << endl << endl << endl
                   << "Z-Score" << endl
                   << "=======" << endl
                   << endl    
                   << "SampleMeanNND   " << "\t" << sampleMeanNND    << endl
                   << "SampleStdDevNND " << "\t" << sampleStdDevNND  << endl
                   << "RandomMeanNND   " << "\t" << randomMeanNND    << endl
                   << "RandomStdDevNND " << "\t" << randomStdDevNND  << endl
                   << "------- Z-Score " << "\t" << z_Score          << endl
                   << endl;

      KKStr  zScoreSummaryLine = mlClass->Name () + "\t" +
                                  StrFormatDouble (sampleMeanNND,   "###,##0.00")  + "\t" +
                                  StrFormatDouble (sampleStdDevNND, "###,##0.00")  + "\t" +
                                  StrFormatDouble (randomMeanNND,   "###,##0.00")  + "\t" +
                                  StrFormatDouble (randomStdDevNND, "###,##0.00")  + "\t" +
                                  StrFormatDouble (z_Score,         "###,##0.000");

//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:Pices,代码行数:101,代码来源:OurNeighbors.cpp


示例15: while

void  CmdLineExpander::BuildCmdLineParameters (const VectorKKStr&  argv)
{
  kkuint32  x = 0;

  while  (x < argv.size ())
  {
    KKStr  s = argv[x];
    x++;

    KKStr  sUpper = s.ToUpper();
    if  ((sUpper == "-L")  ||  (sUpper == "-LOGFILE"))
    {
      if  (x < argv.size ())
      {
        if  (argv[x][(kkint16)0] != '-')
        {
          logFileName = argv[x];
          if  (!logFileName.Empty ())
            log.AttachFile (logFileName);
          x++;
        }
      }

      if  (logFileName.Empty ())
      {
        log.Level (-1) << std::endl << std::endl;
        log.Level (-1) << applicationName   << " - Invalid Log File Parameter (-L)." << endl;
        log.Level (-1) << "                 Name of log file required."              << endl;
        log.Level (-1) << endl;
        parmsGood = false;
      }

    }

    else if  (sUpper == "-CMDFILE")
    {
      KKStr  cmdFileName = "";

      if  (x < argv.size ())
      {
        if  (argv[x][(kkint16)0] != '-')
        {
          cmdFileName = argv[x];
          x++;
        }
      }

      if  (cmdFileName.Empty ())
      {
        log.Level (-1) << endl << endl << endl
             << applicationName  << "  "  << "BuildCmdLineParameters             *** ERROR ***"  << endl << endl
             << "-CMDFILE option did not define a file name." << endl
             << endl;

        parmsGood = false;
      }

      else
      {
        if  (FileInStack (cmdFileName, cmdFileStack))
        {
          log.Level (-1) << endl << endl << endl
               << applicationName  << "  BuildCmdLineParameters             *** ERROR ***"  << endl 
               << endl
               << "-CMDFILE [" << cmdFileName << "]  is being called recursively."  << endl
               << endl;
 
          parmsGood = false;
        }
        else
        {
          bool  validFile = true;
          cmdFileStack.push_back (cmdFileName);
          VectorKKStr  cmdFileParameters;
          ExtractParametersFromFile (cmdFileName, cmdFileParameters, validFile);
          BuildCmdLineParameters (cmdFileParameters);
          cmdFileStack.pop_back ();
          if  (!validFile)
            parmsGood = false;
        }
      }
    }

    else
    {
      expandedParameters.push_back (s);
    }
  }
}  /* BuildCmdLineParameters */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:89,代码来源:CmdLineExpander.cpp


示例16: osGetRootName

void  RandomSplitJobManager::GenerateFinalResultsReport ()
{
  KKStr reportFileName = osGetRootName (ManagerName ()) + "_Results.html;";

  ofstream f (reportFileName.Str ());

  f << "Run Time Parameters" << endl
    << "Run Time"          << "\t" << osGetLocalDateTime ()  << endl
    << "configFileName"    << "\t" << configFileName         << endl
    << "DataFileName"      << "\t" << dataFileName           << endl
    << "Format"            << "\t" << format->DriverName ()  << endl
    << "DataIndexFileName" << "\t" << dataIndexFileName      << endl
    << "NumFolds"          << "\t" << numFolds               << endl
    << "NumSplits"         << "\t" << numSplits              << endl
    << "splitFraction"     << "\t" << splitFraction          << endl
    << endl;


  KKJobList::const_iterator  idx;

  ConfusionMatrix2  avgResults (*(this->MLClasses ()));
  KKB::uint  x = 0;

  for  (idx = Jobs ()->begin ();  idx != Jobs ()->end ();  idx++)
  {
    RandomSplitJobPtr j = dynamic_cast<RandomSplitJobPtr> (*idx);
    if  (j->RandomSplitsResults () != NULL)
    {
      f << endl
        << "Random Split[" << j->SplitNum () << "]" << endl;
      j->RandomSplitsResults ()->PrintConfusionMatrixTabDelimited (f);
      f << endl << endl;

      j->PrintClassCounts (f);
      f << endl << endl;

      avgResults.AddIn (*(j->RandomSplitsResults ()), log);
      x++;
    }
  }

  f << endl << "Mean Average of all random Splits." << endl;
  avgResults.FactorCounts (1.0 / (double)x);
  avgResults.PrintConfusionMatrixTabDelimited (f);
  f << endl 
    << endl
    << endl
    << endl
    << "Class Counts" << endl
    << endl;

  kkuint32  numClasses = (kkuint32)mlClasses->size ();

  VectorFloat   classAccs;
  VectorDouble  knownCounts;
  VectorDouble  predCounts;
  VectorDouble  adjCounts;
  VectorDouble  adjCountsStdError;
  VectorDouble  predDelta;       
  VectorDouble  adjDelta;
  
  KKStr l1, l2, l3;
  mlClasses->ExtractThreeTitleLines (l1, l2, l3);

  VectorKKStr  knownCountLines;
  VectorKKStr  predCountLines;
  VectorKKStr  adjCountLines;
  VectorKKStr  deltaPredCountLines;
  VectorKKStr  deltaAdjCountLines;
  VectorKKStr  accLines;


  ConfusionMatrix2  totalCM (*MLClasses ());
  int  totalCmCount = 0;


  // Known Counts
  for  (idx = Jobs ()->begin ();  idx != Jobs ()->end ();  idx++)
  {
    RandomSplitJobPtr j = dynamic_cast<RandomSplitJobPtr> (*idx);
    if  (j->RandomSplitsResults () != NULL)
    {
      KKStr splitNumStr = StrFormatInt (j->SplitNum (), "ZZZ0");
      j->GetClassCounts (classAccs, knownCounts, predCounts, adjCounts, adjCountsStdError, predDelta, adjDelta);

      totalCM.AddIn (*(j->RandomSplitsResults ()), log);
      totalCmCount++;
      KKStr accLine        = "Acc By Class\t" + splitNumStr;
      KKStr knownLine      = "Known\t"        + splitNumStr;
      KKStr predLine       = "Predicted\t"    + splitNumStr;
      KKStr adjLine        = "Adjusted\t"     + splitNumStr;
      KKStr deltaPredLine  = "Delta Pred\t"   + splitNumStr;
      KKStr deltaAdjLine   = "Delta Adj\t"    + splitNumStr;


      double  totalAcc       = 0.0;
      double  totalDeltaPred = 0.0;
      double  totalDeltaAdj  = 0.0;

      for  (x = 0;  x < numClasses;  x++)
//.........这里部分代码省略.........
开发者ID:KurtKramer,项目名称:Pices,代码行数:101,代码来源:RandomSplitJobManager.cpp



注:本文中的VectorKKStr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VectorList类代码示例发布时间:2022-05-31
下一篇:
C++ VectorImage类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap