-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature edge_info=none #147
base: main
Are you sure you want to change the base?
Changes from all commits
f4c870e
bb62f9d
eb531db
c6a9bcf
2f439b4
7ace5af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -190,11 +190,9 @@ def _merge_nodes(self, nodes_to_merge: List[Tuple[str]]): | |||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
def dot_graph(self, edge_info: str = "probability") -> pdp.Dot: | ||||||||||||||||||||||||||||||||
"""Returns Dot graph representation of the CEG. | ||||||||||||||||||||||||||||||||
:param edge_info: Optional - Chooses which summary measure to be displayed | ||||||||||||||||||||||||||||||||
on edges. Defaults to "count". | ||||||||||||||||||||||||||||||||
Options: ["count", "prior", "posterior", "probability"] | ||||||||||||||||||||||||||||||||
:param edge_info: Optional - Chooses which summary measure to be displayed on edges. Defaults to "count". Options: ["count", "prior", "posterior", "probability", "none"] | ||||||||||||||||||||||||||||||||
:type edge_info: str | ||||||||||||||||||||||||||||||||
:return: A graphviz Dot representation of the graph. | ||||||||||||||||||||||||||||||||
:rtype: pydotplus.Dot""" | ||||||||||||||||||||||||||||||||
return self._generate_dot_graph(edge_info=edge_info) | ||||||||||||||||||||||||||||||||
|
@@ -209,6 +207,8 @@ def _generate_dot_graph(self, edge_info="probability"): | |||||||||||||||||||||||||||||||
for (src, dst, label), attribute in edge_info_dict.items(): | ||||||||||||||||||||||||||||||||
if edge_info == "count": | ||||||||||||||||||||||||||||||||
edge_details = str(label) + "\n" + str(attribute) | ||||||||||||||||||||||||||||||||
elif edge_info == "none": | ||||||||||||||||||||||||||||||||
edge_details = str(label) | ||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||
edge_details = f"{label}\n{float(attribute):.2f}" | ||||||||||||||||||||||||||||||||
Comment on lines
207
to
213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
These are the changes we'd need to make if using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another option is to do this:
Since |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
@@ -258,8 +258,7 @@ def create_figure( | |||||||||||||||||||||||||||||||
:type filename: str | ||||||||||||||||||||||||||||||||
:param edge_info: Optional - Chooses which summary measure to be displayed on | ||||||||||||||||||||||||||||||||
edges. Value can take: "count", "prior", "posterior", "probability" | ||||||||||||||||||||||||||||||||
:param edge_info: Optional - Chooses which summary measure to be displayed on edges. Defaults to "count". Options: ["count", "prior", "posterior", "probability", "none"] | ||||||||||||||||||||||||||||||||
:type edge_info: str | ||||||||||||||||||||||||||||||||
:return: The event tree Image object. | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comments as in |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comments as in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Literal["count", "prior", "posterior", "probability"]
-- this says that only "count", "prior", "posterior" or "probability" are acceptable input parameters.|
-- this means "or"None
-- None is its own type in Python, and so we shouldn't be using"none"
as a string.With the above setting, the user will need to explicitly pass
None
for no information to be displayed.Alternatively, we can make
None
the default, so the user needs to explicitly pass one of the acceptable string entries for any information to be displayed.What do you think?