python - How to create a Spektral graph with edge weights and edge features
问题描述
I want to create a Graph in Spektral which has both edged weights and edge labels. I have three matrices: a nxn adjacency matrix, an nx4 feature matrix for the nodes, and an nxnx2 matrix which represents the label for each edge. I do not know how to incorporate this third matrix into my Graph so that the edges will be labeled. I would also be happy to label the edges manually, but I don't know how to do that either. Thanks!
解决方案
spektral.data.Graph
数据结构有一个属性调用来e
存储边缘属性。因此,如果您将数据存储到 numpy 数组中,您可以执行以下操作:
g = Graph(x=x, a=a, e=e)
e
你的边缘属性矩阵在哪里。
如果您使用它们,它们将被数据加载器自动拾取。
在此处查看文档。
推荐阅读
- javascript - 使用 Lodash/Javascript 的过滤器获取过滤后的数据
- flutter - 出现错误:SPAN_EXCLUSIVE_EXCLUSIVE 跨度的长度不能为零
- c# - 如何使用 ParseExact 从字符串中解析日期?
- function - 数据洞察 - 自动聚合功能
- integromat - 如何在其中写入带有空格的参数名称?自定义 Integromat 应用程序
- c# - C#中的Helix Toolkit显示层点云
- c - 与 C 中的 fgets 和 getchar 相关的问题
- c - 尝试在自定义函数中传递一个int数组,在自定义函数中获取不到数组的内容
- integromat - 无法更改 Integromat 正在测试的自定义 Integromat 应用程序的元数据
- integromat - 如何为我的自定义 Integromat 应用程序制作不同颜色的徽标?