当前位置: 首页>>代码示例>>C++>>正文


C++ VectorFloat::push_back方法代码示例

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


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

示例1: main

int main(int argc, const char *argv[]) {
  static bool is_running = true;
  string input_file = "-";
  cmdline::parser c;

  c.add<int>   ("verbose",    'v', "verbosity level: 0-4", false, 0);
  c.add        ("help",       'h', "print this message");
  c.add<string>("type",       't', "force classification, regression or timeseries input", false, "", cmdline::oneof<string>("classification", "regression", "timeseries", "auto"));
  c.footer     ("<pre-processor> [<filename>] ");

  /* parse common options */
  bool parse_ok = c.parse(argc,argv,false) && !c.exist("help");
  set_verbosity(c.get<int>("verbose"));

  /* do we have a predictor? */
  string preproc_name = c.rest().size() > 0 ? c.rest()[0] : "list";
  if (preproc_name == "list") {
    cout << c.usage() << endl;
    cout << list_preprocessors();
    exit(0);
  }

  PreProcessing *pp = apply_cmdline_args(preproc_name,c,1,input_file);

  if (pp==NULL)
    exit(-1);

  if (!parse_ok) {
    cerr << c.usage() << endl << c.error() << endl;
    exit(-1);
  }

  /* do we read from a file or from stdin-? */
  ifstream fin; fin.open(input_file);
  istream &in = input_file=="-" ? cin : fin;

  string line; int linenum=0;
  while(getline(in,line)) {
    stringstream ss(line);

    if (line[0] == '#') {
      cout << line << endl;
      continue;
    }

    if (line.size() == 0) {
      cout << endl;
      continue;
    }

    try { string label; ss >> label; cout << label << "\t"; }
    catch (exception &e) { /* unlabeled data */ }

    VectorFloat vals; double value;
    while (ss >> value)
      vals.push_back(value);

    if (linenum == 0) {
      // weird stuff, pp resets only when initialized, it only initialized once
      // data has been seen, and only set num outputdimenstion when reset so:
      pp->setNumInputDimensions(vals.size());
      pp->process(VectorFloat(vals.size(), 1.));
      pp->reset();
    }

    bool ok = pp->process(vals);
    if (!ok) {
      cerr << "unable to process line " << linenum << endl;
      exit(-1);
    }

    for(auto value : pp->getProcessedData())
      cout << value << "\t";

    cout << endl;
    linenum++;
  }
}
开发者ID:HassanAmr,项目名称:grtool,代码行数:78,代码来源:preprocess.cpp


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