[mlpack-git] [mlpack/mlpack] unable to compile a sample program of covariance calculation (#781)

Marcus Edel notifications at github.com
Thu Sep 8 10:53:51 EDT 2016

I guess you are using:

#include <mlpack/core.hpp>

// Convenience.
using namespace mlpack;

int main()
  // First, load the data.
  arma::mat data;
  // Use data::Load() which transposes the matrix.
  data::Load("data.csv", data, true);
  // Now compute the covariance. We assume that the data is already centered.
  // Remember, because the matrix is column-major, the covariance operation is
  // transposed.
  arma::mat cov = data * trans(data) / data.n_cols;
  // Save the output.
  data::Save("cov.csv", cov, true);

The output is saved in ``cov.csv``, if you like to print the output you could do:

Log::Info << cov << std::endl;


data::Save("cov.csv", cov, true);

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160908/72e81362/attachment.html>

More information about the mlpack-git mailing list