public String toString() { return "Constant Independent(" + pal.misc.Utils.toString(parameterStore_) + " - > " + pal.misc.Utils.toString(getDistribution()) + ")"; }
public String toString() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < numberOfSites_; i++) { double[] sitePosteriors = getSitePosteriors(i); sb.append(pal.misc.Utils.argmax(sitePosteriors)); sb.append(" - "); sb.append("Site "); sb.append((i + 1)); sb.append(":"); sb.append(pal.misc.Utils.toString(sitePosteriors)); sb.append("\n"); } return sb.toString(); }
public SimpleSiteDetails( double[][] categoryPatternConditionalProbabilities, boolean isLoggedConditionals, SubstitutionModel model, int numberOfPatterns, int[] sitePatternMatchup, int numberOfSites, double[] siteLikelihoods) { final int numberOfCategories = model.getNumberOfTransitionCategories(); this.siteLikelihoods_ = pal.misc.Utils.getCopy(siteLikelihoods); this.siteLogLikelihoods_ = new double[numberOfSites]; double llh = 0; for (int i = 0; i < numberOfSites; i++) { this.siteLogLikelihoods_[i] = Math.log(this.siteLikelihoods_[i]); llh += this.siteLogLikelihoods_[i]; } System.out.println("Total:" + llh); if (isLoggedConditionals) { this.categoryPatternConditionalProbabilities_ = convertLogged( categoryPatternConditionalProbabilities, numberOfCategories, numberOfPatterns); } else { this.categoryPatternConditionalProbabilities_ = pal.misc.Utils.getCopy(categoryPatternConditionalProbabilities); } this.numberOfSites_ = numberOfSites; this.sitePatternMatchup_ = pal.misc.Utils.getCopy(sitePatternMatchup); this.patternPosteriors_ = new double[numberOfPatterns][numberOfCategories]; for (int p = 0; p < numberOfPatterns; p++) { double total = 0; for (int c = 0; c < numberOfCategories; c++) { total += categoryPatternConditionalProbabilities[c][p]; } for (int c = 0; c < numberOfCategories; c++) { patternPosteriors_[p][c] = categoryPatternConditionalProbabilities[c][p] / total; } } this.model_ = model; }