在神经网络中使用图属性作为输入

时间:2019-01-05 19:51:04

标签: machine-learning deep-learning

我有将近1000个熊猫DataFrame,并将其转换为图形。现在,我可以访问这些图的边缘和节点。对于一个DataFrame,它看起来如下:

nx.edges(FG)

Out[59]: EdgeView([('Dy0O7', 'Dy1O6'), ('Dy0O7', 'Dy2O6'), ('Dy0O7', 'Dy3O7'), ('Dy0O7', 'Dy4O6'), ('Dy1O6', 'Dy3O7'), ('Dy1O6', 'Dy5O6'), ('Dy2O6', 'Dy4O6'), ('Dy3O7', 'Dy4O6'), ('Dy3O7', 'Dy5O6')])

nx.nodes(FG)

Out[61]: NodeView(('Dy0O7', 'Dy1O6', 'Dy2O6', 'Dy3O7', 'Dy4O6', 'Dy5O6'))

我还可以有一个邻接视图,该视图提供了具有相应权重的已连接节点的信息。

FG.adj

Out[64]: AdjacencyView({'Dy0O7': {'Dy1O6': {'weight': 3.0}, 'Dy2O6': {'weight': 1.0}, 'Dy3O7': {'weight': 2.0}, 'Dy4O6': {'weight': 1.0}}, 'Dy1O6': {'Dy0O7': {'weight': 3.0}, 'Dy3O7': {'weight': 1.0}, 'Dy5O6': {'weight': 1.0}}, 'Dy2O6': {'Dy0O7': {'weight': 1.0}, 'Dy4O6': {'weight': 1.0}}, 'Dy3O7': {'Dy0O7': {'weight': 2.0}, 'Dy1O6': {'weight': 1.0}, 'Dy4O6': {'weight': 3.0}, 'Dy5O6': {'weight': 1.0}}, 'Dy4O6': {'Dy0O7': {'weight': 1.0}, 'Dy2O6': {'weight': 1.0}, 'Dy3O7': {'weight': 3.0}}, 'Dy5O6': {'Dy1O6': {'weight': 1.0}, 'Dy3O7': {'weight': 1.0}}})

我想将这样的图形属性用作NN等机器学习算法的输入,我们该怎么做?

1 个答案:

答案 0 :(得分:1)

有很多算法可以将Graph转换为特征向量。两个著名的例子是:

它们的实现存在于GitHub上。

这些方法之间的基本思想几乎相同:1)随机游走2)生成一些序列3)word2vec(跳过图)或其他DL方法4)在其他Task中将输出用作特征向量。

enter image description here