remove unused methods
parent
9cacb9876e
commit
c6e9bfc824
|
@ -141,18 +141,6 @@ bool DiscreteTableConditional::equals(const DiscreteFactor& other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
|
||||||
TableFactor::shared_ptr DiscreteTableConditional::likelihood(
|
|
||||||
const DiscreteValues& frontalValues) const {
|
|
||||||
throw std::runtime_error("Likelihood not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ****************************************************************************/
|
|
||||||
TableFactor::shared_ptr DiscreteTableConditional::likelihood(
|
|
||||||
size_t frontal) const {
|
|
||||||
throw std::runtime_error("Likelihood not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ****************************************************************************/
|
/* ****************************************************************************/
|
||||||
DiscreteConditional::shared_ptr DiscreteTableConditional::max(
|
DiscreteConditional::shared_ptr DiscreteTableConditional::max(
|
||||||
const Ordering& keys) const {
|
const Ordering& keys) const {
|
||||||
|
@ -180,26 +168,4 @@ DiscreteConditional::shared_ptr DiscreteTableConditional::prune(
|
||||||
this->nrFrontals(), this->discreteKeys(), pruned.sparseTable());
|
this->nrFrontals(), this->discreteKeys(), pruned.sparseTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
|
||||||
size_t DiscreteTableConditional::argmax(
|
|
||||||
const DiscreteValues& parentsValues) const {
|
|
||||||
// Initialize
|
|
||||||
size_t maxValue = 0;
|
|
||||||
double maxP = 0;
|
|
||||||
DiscreteValues values = parentsValues;
|
|
||||||
|
|
||||||
assert(nrFrontals() == 1);
|
|
||||||
Key j = firstFrontalKey();
|
|
||||||
for (size_t value = 0; value < cardinality(j); value++) {
|
|
||||||
values[j] = value;
|
|
||||||
double pValueS = (*this)(values);
|
|
||||||
// Update MPE solution if better
|
|
||||||
if (pValueS > maxP) {
|
|
||||||
maxP = pValueS;
|
|
||||||
maxValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return maxValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gtsam
|
} // namespace gtsam
|
||||||
|
|
|
@ -158,28 +158,8 @@ class GTSAM_EXPORT DiscreteTableConditional : public DiscreteConditional {
|
||||||
/// @name Standard Interface
|
/// @name Standard Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// Log-probability is just -error(x).
|
/// Return the underlying TableFactor
|
||||||
double logProbability(const DiscreteValues& x) const { return -error(x); }
|
TableFactor table() const { return table_; }
|
||||||
|
|
||||||
/// print index signature only
|
|
||||||
void printSignature(
|
|
||||||
const std::string& s = "Discrete Conditional: ",
|
|
||||||
const KeyFormatter& formatter = DefaultKeyFormatter) const {
|
|
||||||
static_cast<const BaseConditional*>(this)->print(s, formatter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convert to a likelihood factor by providing value before bar. */
|
|
||||||
TableFactor::shared_ptr likelihood(const DiscreteValues& frontalValues) const;
|
|
||||||
|
|
||||||
/** Single variable version of likelihood. */
|
|
||||||
TableFactor::shared_ptr likelihood(size_t frontal) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return assignment for single frontal variable that maximizes value.
|
|
||||||
* @param parentsValues Known assignments for the parents.
|
|
||||||
* @return maximizing assignment for the frontal variable.
|
|
||||||
*/
|
|
||||||
size_t argmax(const DiscreteValues& parentsValues = DiscreteValues()) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create new conditional by maximizing over all
|
* @brief Create new conditional by maximizing over all
|
||||||
|
@ -195,29 +175,6 @@ class GTSAM_EXPORT DiscreteTableConditional : public DiscreteConditional {
|
||||||
/// @name Advanced Interface
|
/// @name Advanced Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// Return all assignments for frontal variables.
|
|
||||||
std::vector<DiscreteValues> frontalAssignments() const;
|
|
||||||
|
|
||||||
/// Return all assignments for frontal *and* parent variables.
|
|
||||||
std::vector<DiscreteValues> allAssignments() const;
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
/// @name HybridValues methods.
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
using BaseConditional::operator(); ///< HybridValues version
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate log-probability log(evaluate(x)) for HybridValues `x`.
|
|
||||||
* This is actually just -error(x).
|
|
||||||
*/
|
|
||||||
double logProbability(const HybridValues& x) const override {
|
|
||||||
return -error(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return the underlying TableFactor
|
|
||||||
TableFactor table() const { return table_; }
|
|
||||||
|
|
||||||
/// Evaluate the conditional given the values.
|
/// Evaluate the conditional given the values.
|
||||||
virtual double evaluate(const Assignment<Key>& values) const override {
|
virtual double evaluate(const Assignment<Key>& values) const override {
|
||||||
return table_.evaluate(values);
|
return table_.evaluate(values);
|
||||||
|
|
Loading…
Reference in New Issue