Skip to content
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

feat: init train v2 #308

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: init train v2 #308

wants to merge 2 commits into from

Conversation

jsolaas
Copy link
Contributor

@jsolaas jsolaas commented Dec 1, 2023

Why is this pull request needed?

Initialize the work on a common train, where the features of all current train-models should be handled.

@@ -27,11 +27,11 @@ def add_node(self, node: TNode) -> Self:
self.nodes[node.id] = node
return self

def add_edge(self, from_id: NodeID, to_id: NodeID) -> Self:
def add_edge(self, from_id: NodeID, to_id: NodeID, **kwargs) -> Self:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring? intention behind kwargs ... different properties based on type of edge etc?

@@ -49,6 +49,15 @@ def get_successors(self, node_id: NodeID, recursively=False) -> List[NodeID]:
else:
return list(self.graph.successors(node_id))

def get_successor(self, node_id: NodeID) -> NodeID:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current limitation that we want to have now, or always, to use "crossovers" when there are more than 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not always, currently it's used when it's supposed to only be one, but we could of course just use get_successors()[0]. I was thinking we could have both get_successor and get_successors. I think we already have both for either successors or predecessors.

@@ -58,6 +67,10 @@ def get_predecessor(self, node_id: NodeID) -> NodeID:
)
return predecessors[0]

def get_predecessors(self, node_id: NodeID) -> List[NodeID]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why > 1 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably easier to see that by looking at where it's used. get_predecessors is used to get all consumers connected to a driver, get_successor is used to get driver for consumer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants