LukasZahradnik / PyNeuraLogic

PyNeuraLogic lets you use Python to create Differentiable Logic Programs
https://pyneuralogic.readthedocs.io/
MIT License
281 stars 18 forks source link

[✨ Feature Request]: to_logic_form() and edge_attr #24

Closed borisrakovan closed 2 years ago

borisrakovan commented 2 years ago

Is your feature request related to a problem? Please describe.

The to_logic_form() method defined here doesn't seem to consider the 'edge_attr' attribute.

Describe the solution you'd like

Should't it initialize the edge predicate weights with the values passed to edge_attr? Something in the lines of

Relation.get(edge_name)(int(u), int(v), int(w))[1].fixed() for u, v, w in zip(self.edge_index[0], self.edge_index[1], self.edge_attr[:, 0])

Describe alternatives you've considered

No response

Additional context

No response

LukasZahradnik commented 2 years ago

Hi, thanks for the feature request.

I added support for edge_attr in the latest version of PyNeuraLogic (neuralogic==0.1.1).

Here, you can check basic usage (and how features are encoded) in torch, NumPy, and native python tests.