コード例 #1
0
static void mlpackMain()
{
  RequireAtLeastOnePassed({ "output" }, false, "no results will be saved");

  // Get the GMM and the points.
  GMM* gmm = CLI::GetParam<GMM*>("input_model");

  arma::mat dataset = std::move(CLI::GetParam<arma::mat>("input"));

  // Now calculate the probabilities.
  arma::rowvec probabilities(dataset.n_cols);
  for (size_t i = 0; i < dataset.n_cols; ++i)
    probabilities[i] = gmm->Probability(dataset.unsafe_col(i));

  // And save the result.
  CLI::GetParam<arma::mat>("output") = std::move(probabilities);
}
コード例 #2
0
int main(int argc, char** argv)
{
  CLI::ParseCommandLine(argc, argv);

  // Get the GMM and the points.
  GMM gmm;
  data::Load(CLI::GetParam<string>("input_model_file"), "gmm", gmm);

  arma::mat dataset;
  data::Load(CLI::GetParam<string>("input_file"), dataset);

  // Now calculate the probabilities.
  arma::rowvec probabilities(dataset.n_cols);
  for (size_t i = 0; i < dataset.n_cols; ++i)
    probabilities[i] = gmm.Probability(dataset.unsafe_col(i));

  // And save the result.
  data::Save(CLI::GetParam<string>("output_file"), probabilities);
}