コード例 #1
0
ファイル: gmm_generate_main.cpp プロジェクト: AmesianX/mlpack
int main(int argc, char** argv)
{
  CLI::ParseCommandLine(argc, argv);

  if (CLI::HasParam("output_file"))
    Log::Warn << "--output_file (-o) is not specified;"
        << "no results will be saved!" << endl;

  if (CLI::GetParam<int>("seed") == 0)
    mlpack::math::RandomSeed(time(NULL));
  else
    mlpack::math::RandomSeed((size_t) CLI::GetParam<int>("seed"));

  if (CLI::GetParam<int>("samples") < 0)
    Log::Fatal << "Parameter to --samples must be greater than 0!" << endl;

  GMM gmm;
  data::Load(CLI::GetParam<string>("input_model_file"), "gmm", gmm, true);

  size_t length = (size_t) CLI::GetParam<int>("samples");
  Log::Info << "Generating " << length << " samples..." << endl;
  arma::mat samples(gmm.Dimensionality(), length);
  for (size_t i = 0; i < length; ++i)
    samples.col(i) = gmm.Random();

  if (CLI::HasParam("output_file"))
    data::Save(CLI::GetParam<string>("output_file"), samples);
}
コード例 #2
0
ファイル: gmm_impl.hpp プロジェクト: grandtiger/RcppMLPACK
GMM<FittingType>::GMM(const GMM<OtherFittingType>& other) :
    gaussians(other.Gaussians()),
    dimensionality(other.Dimensionality()),
    means(other.Means()),
    covariances(other.Covariances()),
    weights(other.Weights()),
    localFitter(FittingType()),
    fitter(localFitter) { /* Nothing to do. */ }