toto.cpp 645 B

12345678910111213141516171819202122232425262728293031
  1. #include <iostream>
  2. #include <armadillo>
  3. using namespace arma;
  4. void toto() {
  5. // read data from csv file
  6. mat data;
  7. data.load("values.csv", csv_ascii);
  8. data = data.t();
  9. cout << data.t() << endl;
  10. cout << "data size : " << data.n_rows << " , " << data.n_cols << endl;
  11. // model the data as a diagonal GMM with 2 Gaussians
  12. gmm_diag model;
  13. bool status = model.learn(data, 3, eucl_dist, static_subset, 10, 10, 1e-0, true);
  14. if(status == false)
  15. {
  16. cout << "learning failed" << endl;
  17. }
  18. model.hefts.print("weights:");
  19. model.means.print("means:");
  20. model.dcovs.print("dcovs:");
  21. }