예제 #1
0
파일: gmm.hpp 프로젝트: buotex/praktikum
 /** For debugging reasons*/
 bool sanityCheck() const {
   bool sane = false;
   if (D_ == 0 || arma::det(sigma_) == 0 || !invSigma_.is_finite()) sane = false;
   if (!sane) {
     std::cout << "coeff: " << coeff_ << std::endl;
     std::cout << "D: " << D_ << std::endl;
     sigma_.print("sigma");
     invSigma_.print("invSigma");
     throw std::logic_error("Something is wrong with the GM");
   }
   return sane;
 }
예제 #2
0
파일: hmm.hpp 프로젝트: buotex/praktikum
/** For debugging reasons*/ 
  void checkAllComponents() {
   
    arma::vec rowSumA = arma::sum(A_, 1);
    rowSumA.print("rowSumA");
    double sumPi = arma::sum(pi_);
    std::cout << "sumPi: " << sumPi << std::endl;
    arma::vec weights = arma::zeros((unsigned int)BModels_.size());
    for (unsigned int i = 0; i < (unsigned int) BModels_.size(); ++i) {
      weights(i) = arma::accu(BModels_[i].getWeights());
    }
    weights.print("bCumWeights");

    arma::rowvec checksum = arma::sum(gamma_);
    checksum.print("checksum");
    arma::uvec checksumIndices = arma::find(checksum < 1.0 - 1E-2);
    if (checksumIndices.n_elem >= 1) {
      arma::rowvec checksumAlpha = arma::sum(alpha_);
      checksumAlpha.print("checkAlpha");
      //alpha_.print("alpha");
      arma::rowvec checksumBeta = arma::sum(beta_);
      checksumBeta.print("checkBeta");
      //beta_.print("beta");
      c_.print("c");
      throw std::runtime_error("data going wonky");
    }


    if (!arma::is_finite(A_)) {
      A_.print("A Fail");
      throw std::runtime_error("A has invalid entries");
    }
    if (!arma::is_finite(pi_)) {
      pi_.print("pi Fail");
      throw std::runtime_error("pi has invalid entries");
    }
    if (!arma::is_finite(alpha_)) {
      alpha_.print("alpha Fail");
      throw std::runtime_error("alpha has invalid entries");
    }
    if (!arma::is_finite(beta_)) {
      beta_.print("beta Fail");
      throw std::runtime_error("beta has invalid entries");
    }
    if (!arma::is_finite(gamma_)) {
      gamma_.print("gamma Fail");
      throw std::runtime_error("gamma has invalid entries");
    }
    if (!arma::is_finite(xi_)) {
      xi_.print("xi Fail");
      throw std::runtime_error("xi has invalid entries");
    }
  }
예제 #3
0
파일: hmm.hpp 프로젝트: buotex/praktikum
  void
    print(std::string header = "") {
      A_.print("A");
      for (size_t i = 0; i < BModels_.size(); ++i) {
        BModels_[i].print("B");
      }
      pi_.print("pi");

    }
예제 #4
0
파일: gmm.hpp 프로젝트: buotex/praktikum
 void print(std::string header = "") const {
   std::cout << header << std::endl;
   mu_.print("Mean vector");
   sigma_.print("Sigma");
 }