-
Notifications
You must be signed in to change notification settings - Fork 162
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
Graph Profiler class to create a profile of an input graph #546
Conversation
Head branch was pushed to by a user without write access
396b004
to
dade783
Compare
Head branch was pushed to by a user without write access
53d0b0a
to
2e4e13c
Compare
Head branch was pushed to by a user without write access
""" | ||
The following functions compute case-specific properties for the graph profile | ||
""" | ||
def _compute_conditional_probabilities(self): | ||
return | ||
def _compute_end_state_probabilities(self): | ||
return | ||
def _compute_link_probabilities(self): | ||
return | ||
def _compute_activation_probabilities(self): | ||
return | ||
def _compute_deactivation_probabilities(self): | ||
return |
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.
cut these out since not doing yet
if profile_key == "<PROP>": | ||
if "<PROP>" in calcs_dict_keys: | ||
continue | ||
profile.pop(profile_key) |
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.
need to update these specific to the props we are tracking
self._load_data() | ||
|
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.
let's remove this
list_edges = [] | ||
list_nodes = set() | ||
|
||
for line in range(0, len(csv_as_list)): |
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.
is this supposed to be updated?
6911437
to
8082e0a
Compare
self.assertTrue(True, True) | ||
|
||
# WIP | ||
def test_diff(self): |
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.
sounds weird, but maybe just validate not implemented and that we raise the expected error str
|
||
# WIP | ||
def test_report(self): | ||
self.assertTrue(True, True) |
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.
same as above, we should raise not implemented for this as well.
def setUp(self): | ||
self.graph = nx.Graph() | ||
self.graph.add_nodes_from([1, 2, 3, 4]) | ||
self.graph.add_edges_from( | ||
[ | ||
(1, 2, {"id": 1, "weight": 2.5}), | ||
(2, 3, {"id": 2, "weight": 1.7}), | ||
(3, 4, {"id": 3, "weight": 1.8}), | ||
(4, 1, {"id": 4, "weight": 4.1}), | ||
(1, 3, {"id": 4, "weight": 2.1}), | ||
] | ||
) | ||
self.graph_profile = GraphProfile("graph") |
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.
this will run before every test.
we can do a setUpTestData
to do it once at class init
need to add the classmethod dec and change self -> cls
|
||
class TestGraphProfiler(unittest.TestCase): | ||
def setUp(self): | ||
self.graph = nx.Graph() |
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.
we need to ensure the GraphProfile can ingest a GraphData
, hence ideal if we setup our own GraphData class.
We could mock it such that create a GraphData Class and set the values to be this graph.
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.
or mock the class
|
||
# WIP | ||
def test_init(self): | ||
self.assertTrue(True, True) |
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.
we should test being able to init and that the proper checks occur. given setup. e.g. base conditions
def test_continuous_distribution(self): | ||
self.assertTrue(True) | ||
|
||
# WIP | ||
def test_categorical_distribution(self): | ||
self.assertTrue(True) |
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.
are we able to get values for these to tests from the graph?
for profile_key in profile_keys: | ||
# need to add props | ||
if profile_key == "num_nodes": | ||
if "num_nodes" in calcs_dict_keys: | ||
continue | ||
if profile_key == "num_edges": | ||
if "num_edges" in calcs_dict_keys: | ||
continue | ||
if profile_key == "categorical_attributes": | ||
if "categorical_attributes" in calcs_dict_keys: | ||
continue | ||
if profile_key == "continuous_attributes": | ||
if "continuous_attributes" in calcs_dict_keys: | ||
continue | ||
if profile_key == "avg_node_degree": | ||
if "avg_node_degree" in calcs_dict_keys: | ||
continue | ||
if profile_key == "global_max_component_size": | ||
if "global_max_component_size" in calcs_dict_keys: | ||
continue | ||
if profile_key == "continuous_distribution": | ||
if "continuous_distribution" in calcs_dict_keys: | ||
continue | ||
if profile_key == "categorical_distribution": | ||
if "categorical_distribution" in calcs_dict_keys: | ||
continue |
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.
could we reduce this with a list and:
for profile_key in profile_keys:
# need to add props
if profile_key in ["num_nodes", ....]:
if profile_key in calcs_dict_keys:
continue
Head branch was pushed to by a user without write access
…_csv_df from data_utils, optimize load, add class doc
550042b
to
a4d10ca
Compare
Head branch was pushed to by a user without write access
from collections import defaultdict | ||
|
||
import networkx as nx | ||
import utils |
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.
this is internal so should be moved below
…stribution functions
The graph profiler computes the following:
WIP: case-specific properties, testing distributions