italicized parent values

release/4.3a0
Frank Dellaert 2022-01-02 22:38:39 -05:00
parent c51bba81d8
commit fca23e0559
3 changed files with 5 additions and 4 deletions

View File

@ -317,7 +317,7 @@ std::string DiscreteConditional::markdown(const KeyFormatter& keyFormatter,
ss << "|"; ss << "|";
const_iterator it; const_iterator it;
for(Key parent: parents()) { for(Key parent: parents()) {
ss << keyFormatter(parent) << "|"; ss << "*" << keyFormatter(parent) << "*|";
pairs.emplace_back(parent, cardinalities_.at(parent)); pairs.emplace_back(parent, cardinalities_.at(parent));
} }

View File

@ -187,12 +187,13 @@ TEST(DiscreteBayesNet, markdown) {
"|1|0.01|\n" "|1|0.01|\n"
"\n" "\n"
" *P(Smoking|Asia)*:\n\n" " *P(Smoking|Asia)*:\n\n"
"|Asia|0|1|\n" "|*Asia*|0|1|\n"
"|:-:|:-:|:-:|\n" "|:-:|:-:|:-:|\n"
"|0|0.8|0.2|\n" "|0|0.8|0.2|\n"
"|1|0.7|0.3|\n\n"; "|1|0.7|0.3|\n\n";
auto formatter = [](Key key) { return key == 0 ? "Asia" : "Smoking"; }; auto formatter = [](Key key) { return key == 0 ? "Asia" : "Smoking"; };
string actual = fragment.markdown(formatter); string actual = fragment.markdown(formatter);
cout << actual << endl;
EXPECT(actual == expected); EXPECT(actual == expected);
} }

View File

@ -143,7 +143,7 @@ TEST(DiscreteConditional, markdown_multivalued) {
A | B = "2/88/10 2/20/78 33/33/34 33/33/34 95/2/3"); A | B = "2/88/10 2/20/78 33/33/34 33/33/34 95/2/3");
string expected = string expected =
" *P(a1|b1)*:\n\n" " *P(a1|b1)*:\n\n"
"|b1|0|1|2|\n" "|*b1*|0|1|2|\n"
"|:-:|:-:|:-:|:-:|\n" "|:-:|:-:|:-:|:-:|\n"
"|0|0.02|0.88|0.1|\n" "|0|0.02|0.88|0.1|\n"
"|1|0.02|0.2|0.78|\n" "|1|0.02|0.2|0.78|\n"
@ -161,7 +161,7 @@ TEST(DiscreteConditional, markdown) {
DiscreteConditional conditional(A, {B, C}, "0/1 1/3 1/1 3/1 0/1 1/0"); DiscreteConditional conditional(A, {B, C}, "0/1 1/3 1/1 3/1 0/1 1/0");
string expected = string expected =
" *P(A|B,C)*:\n\n" " *P(A|B,C)*:\n\n"
"|B|C|T|F|\n" "|*B*|*C*|T|F|\n"
"|:-:|:-:|:-:|:-:|\n" "|:-:|:-:|:-:|:-:|\n"
"|-|Zero|0|1|\n" "|-|Zero|0|1|\n"
"|-|One|0.25|0.75|\n" "|-|One|0.25|0.75|\n"