Skip to content

Commit

Permalink
svi
Browse files Browse the repository at this point in the history
  • Loading branch information
mamikonyana committed Jul 1, 2016
1 parent d38f2bb commit 4e324d1
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ public static void trainTestStochastic(VarGMM model, List<Datum> trainData, List
}

double oldLogLikelihood = logLikelihood;
logLikelihood = model.calculateLogLikelihood(testData, mixingComponents, clusters);
logLikelihood = model.calculateLogLikelihood(trainData, mixingComponents, clusters);
double testLogLikelihood = model.calculateLogLikelihood(testData, mixingComponents, clusters);
log.debug("test loglike = {}", testLogLikelihood);
if (model.checkTermination(logLikelihood, oldLogLikelihood, iter)) {
log.debug("centers = {}", clusters.getMAPLocations());
log.debug("covariances = {}", clusters.getMAPCovariances());
log.debug("weights = {}", mixingComponents.getNormalizedClusterProportions());
return;
}
if (Math.abs(oldLogLikelihood - logLikelihood) < 1e-8) {
log.debug("centers = {}", clusters.getMAPLocations());
log.debug("covariances = {}", clusters.getMAPCovariances());
log.debug("weights = {}", mixingComponents.getNormalizedClusterProportions());
return;
}
}
}

Expand Down

0 comments on commit 4e324d1

Please sign in to comment.