std::vector<std::string> GreedyStepwiseSearch::findSubset(const DataFrame& df, 
    TgsProgress* p)
  {
    TgsProgress* dataFrameProgress = NULL;
    TgsProgress* evaluateProgress = NULL;
    if (p)
    {
      dataFrameProgress = p->createTgsChild("Data Frame Processing", .5);
      evaluateProgress = p->createTgsChild("Evaluate Subsets", .5);
    }
    std::vector<std::string> result;

    _fse->setDataFrame(df, dataFrameProgress);

    assert(_direction == Backward);

    _progress = evaluateProgress;
    _iteration = 0;
    _totalIterations = (df.getNumFactors() * (df.getNumFactors() + 1)) / 2;

    double bestScore = -1e300;
    vector<int> bestSolution;
    if (_direction == Backward)
    {
      vector<int> columns;

      for (unsigned int i = 0; i < df.getNumFactors(); i++)
      {
        columns.push_back(i);
      }

      double score = _fse->evaluateSubset(columns);
      bestScore = score;
      bestSolution = columns;
//       printf("score: %.3f size: %d\n", score, columns.size());
      do
      {
        score = _removeWorst(columns);

//         printf("score: %.3f size: %d\n", score, columns.size());
        for (unsigned int i = 0; i < columns.size(); i++)
        {
          string s = df.getFactorLabelFromIndex(columns[i]);
          char* s2 = (char*)s.c_str();
          s2[4] = 0;
//           printf("%s\t", s2);
        }
//         printf("\n");
        if (score >= bestScore)
        {
          bestScore = score;
          bestSolution = columns;
        }
      } while (columns.size() > 1);
    }

    result.clear();
    for (unsigned int i = 0; i < bestSolution.size(); i++)
    {
      result.push_back(df.getFactorLabelFromIndex(bestSolution[i]));
    }

    if (p)
    {
      p->setProgress(1.0);
    }

    return result;
  }