-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,8 +295,9 @@ static std::shared_ptr<Factor> createDiscreteFactor( | |
if (!factor) return 1.0; // TODO(dellaert): not loving this. | ||
|
||
// Logspace version of: | ||
// exp(-factor->error(kEmpty)) / conditional->normalizationConstant(); | ||
return -factor->error(kEmpty) - conditional->logNormalizationConstant(); | ||
// exp(-factor->error(kEmpty)) * conditional->normalizationConstant(); | ||
// We take negative of the logNormalizationConstant (1/k) to get k | ||
return -factor->error(kEmpty) + (-conditional->logNormalizationConstant()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
varunagrawal
Author
Collaborator
|
||
}; | ||
|
||
AlgebraicDecisionTree<Key> logProbabilities( | ||
|
@@ -324,6 +325,7 @@ static std::shared_ptr<Factor> createGaussianMixtureFactor( | |
if (factor) { | ||
auto hf = std::dynamic_pointer_cast<HessianFactor>(factor); | ||
if (!hf) throw std::runtime_error("Expected HessianFactor!"); | ||
// Add 2.0 term since the constant term will be premultiplied by 0.5 | ||
hf->constantTerm() += 2.0 * conditional->logNormalizationConstant(); | ||
} | ||
return factor; | ||
|
I believe there should not be a negative in front of conditional->logNormalizationConstant(), at least if a call is going to GaussianConditional::logNormalizationConstant(). The GaussianConditional call returns the log of 'k'. This leaves two options: