Skip to content

Conversation

@FilippoOlivo
Copy link
Member

No description provided.

@FilippoOlivo FilippoOlivo self-assigned this Mar 3, 2025
@FilippoOlivo FilippoOlivo added v0.2 pr-to-fix Label for PR that needs modification labels Mar 3, 2025
@dario-coscia
Copy link
Collaborator

dario-coscia commented Mar 3, 2025

@FilippoOlivo I rebased on 0.2, cuz the history was a bit unclean

@dario-coscia dario-coscia force-pushed the graph-condition branch 3 times, most recently from 8696366 to 39b4252 Compare March 3, 2025 08:42
@FilippoOlivo FilippoOlivo force-pushed the graph-condition branch 3 times, most recently from 3ad2c8a to f8f966c Compare March 3, 2025 08:59
@FilippoOlivo FilippoOlivo force-pushed the graph-condition branch 2 times, most recently from 0115673 to ca3de7c Compare March 3, 2025 16:58
@FilippoOlivo
Copy link
Member Author

@dario-coscia, I moved the extract logic of PinaBatch inside Graph. Batch object will have extract method in this way

@FilippoOlivo FilippoOlivo added pr-to-review Label for PR that are ready to been reviewed and removed pr-to-fix Label for PR that needs modification labels Mar 3, 2025
@FilippoOlivo FilippoOlivo marked this pull request as ready for review March 3, 2025 17:00
@dario-coscia
Copy link
Collaborator

@FilippoOlivo ok perfect! I will review the PR. Can you first clean the github history?

@FilippoOlivo FilippoOlivo force-pushed the graph-condition branch 2 times, most recently from 4a2bc6a to 9bfd926 Compare March 3, 2025 20:51
Copy link
Collaborator

@dario-coscia dario-coscia left a comment

Choose a reason for hiding this comment

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

I am still missing the tests to review fully, but there are some questions on the new graph structure dataset and condition first to understand. Besides that I think it is a very great job, let's simplify a bit and then it is ready to go!

"InputOutputPointsCondition",
"GraphInputOutputCondition",
"GraphDataCondition",
"GraphInputEquationCondition",
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this really useful? I think this is useful only if you want to differentiate wrt graph tensors (node features, or others). Is it correct?

# The split between GraphInputOutputCondition and GraphDataCondition
# distinguishes different types of graph conditions passed to problems.
# This separation simplifies consistency checks during problem creation.
class GraphDataCondition(GraphCondition):
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the difference between graphDatacondition and GraphCondition?



class GraphInputOutputCondition(GraphCondition):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not implemented?

if k != "equation"
# Equations are NEVER dataloaded
}
if offset + stage_len >= len_condition:
Copy link
Collaborator

Choose a reason for hiding this comment

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

why now = is off? It was put in #465 for solving a bug

return wrapper

@staticmethod
def _extract_cond_vars(func):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand _extract_output and why it exists, but what is the purpose of _extract_cond_vars?

:param torch.Tensor pos: The position tensor.
"""
if pos is not None:
check_consistency(pos, (torch.Tensor, LabelTensor))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why this change

edge_index = to_undirected(edge_index)
return edge_index

def extract(self, labels):
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe a better option would be def extract(self, labels, attr='x') where attr is where you want to extract the label from.


def __new__(cls, *args, **kwargs):

if sorted(list(kwargs.keys())) == sorted(["input_", "output_"]):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would start writing input, target. And for graph make another problem. supervised problems are defined on an input and on a target, having only one value is misleading

y = y[0]
edge_index = graph[0].edge_index
graph = Data(x=x, pos=pos, edge_index=edge_index, y=y)
condition = Condition(graph=graph)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like this, is very complicated to understand from a user perspective. If there is an input and a target we must specify that in the condition, otherwise the problem is unsupervised and you just use the data condition

@dario-coscia dario-coscia added pr-to-fix Label for PR that needs modification and removed pr-to-review Label for PR that are ready to been reviewed labels Mar 4, 2025
Copy link
Collaborator

@GiovanniCanali GiovanniCanali left a comment

Choose a reason for hiding this comment

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

Thank you for implementing the graph condition @FilippoOlivo!
I just noticed a print statement. Remove it if not needed.

def __new__(cls, conditions_dict, **kwargs):
if len(conditions_dict) == 0:
raise ValueError("No conditions provided")
print(conditions_dict)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I came across this print. Is it intentional?

@dario-coscia
Copy link
Collaborator

closing, moving to #475

@dario-coscia dario-coscia deleted the graph-condition branch March 10, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-to-fix Label for PR that needs modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants