Main Page
Namespaces
Classes
Files
File List
File Members
src
inference
model
foreground
ocm
shape
ConditionalProbability.cpp
Go to the documentation of this file.
1
18
#include "
inference/model/foreground/ocm/shape/ConditionalProbability.h
"
19
20
namespace
ProbabilisticSceneRecognition
{
21
22
ConditionalProbability::ConditionalProbability
(): mWasRead(false)
23
{ }
24
25
ConditionalProbability::~ConditionalProbability
()
26
{ }
27
28
void
ConditionalProbability::setProbability
(std::string pParentId,
double
pProbability)
29
{
30
if
(
mWasRead
)
throw
std::runtime_error(
"In ConditionalProbability::setProbability("
+ pParentId +
", "
31
+ std::to_string(pProbability) +
"): trying to add to a probability that has already been read."
);
32
mParentProbabilities
[pParentId] = pProbability;
// overwrites older probabilities.
33
}
34
35
double
ConditionalProbability::getProbability
()
36
{
37
mWasRead
=
true
;
38
39
// to increase speed: if there is only one parent anyways, return its probability immediately.
40
if
(
mParentProbabilities
.size() == 1)
41
return
mParentProbabilities
.begin()->second;
42
43
if
(
mParentProbabilities
.empty())
44
throw
std::runtime_error(
"In MinimumConditionalProbability::getProbability(): trying to access probability that has not been set."
);
45
46
return
calculateProbability
();
47
}
48
49
std::string
ConditionalProbability::printParentProbabilities
()
50
{
51
std::string result;
52
for
(std::pair<std::string, double> parentProbability:
mParentProbabilities
)
53
result +=
"("
+ parentProbability.first +
", "
+ std::to_string(parentProbability.second) +
")"
;
54
return
result;
55
}
56
57
}
58
ProbabilisticSceneRecognition::ConditionalProbability::getProbability
double getProbability()
Definition:
ConditionalProbability.cpp:35
ProbabilisticSceneRecognition::ConditionalProbability::mWasRead
bool mWasRead
Definition:
ConditionalProbability.h:77
ProbabilisticSceneRecognition::ConditionalProbability::mParentProbabilities
std::map< std::string, double > mParentProbabilities
Definition:
ConditionalProbability.h:70
ProbabilisticSceneRecognition::ConditionalProbability::setProbability
void setProbability(std::string pParentId, double pProbability)
Definition:
ConditionalProbability.cpp:28
ProbabilisticSceneRecognition::ConditionalProbability::printParentProbabilities
std::string printParentProbabilities()
Definition:
ConditionalProbability.cpp:49
ConditionalProbability.h
ProbabilisticSceneRecognition
Definition:
MappedProbabilityTable.h:33
ProbabilisticSceneRecognition::ConditionalProbability::calculateProbability
virtual double calculateProbability()=0
ProbabilisticSceneRecognition::ConditionalProbability::~ConditionalProbability
~ConditionalProbability()
Definition:
ConditionalProbability.cpp:25
ProbabilisticSceneRecognition::ConditionalProbability::ConditionalProbability
ConditionalProbability()
Definition:
ConditionalProbability.cpp:22
asr_psm
Author(s): Braun Kai, Gehrung Joachim, Heizmann Heinrich, Meißner Pascal
autogenerated on Fri Nov 15 2019 03:57:54