使用 Neo4j 和 GraphSAGE 将具有多种属性类型(int、float、string)的节点转换为嵌入?

Convert a node with multiple attributes types (int, float, string) to an embedding using Neo4j and GraphSAGE?

如果我的节点看起来像:

{id: 1, name: "John", last_name: "Doe", age: 40, city: "New York", credit_score: 5.5}
{id: 2, name: "Linda", last_name: "Lumbo", age: 32, city: "Washington", credit_score: 5.5}
{id: 3, name: "Greg", last_name: "Tanta", age: 28, city: "New York", credit_score: 5.5}
{id: 4, name: "Donald", last_name: "Greenboim", age: 64, city: "Tel Aviv", credit_score: 5.5}
{id: 5, name: "Leo", last_name: "Greenhouse", age: 98, city: "Paris", credit_score: 5.5}
{id: 6, name: "John", last_name: "Opelbaum", age: 80, city: "Moscow", credit_score: 1}
{id: 7, name: "John", last_name: "Vein", age: 21, city: "Los Angeles", credit_score: 0.35}
{id: 8, name: "Dino", last_name: "Lodz", age: 34, city: "New York", credit_score: 1.5}
{id: 9, name: "Kurt", last_name: "Kreston", age: 89, city: "New York", credit_score: 5.3}
{id: 10, name: "Alex", last_name: "Mulo", age: 22, city: "Moscow", credit_score: 2.5}
{id: 11, name: "John", last_name: "Tolo", age: 32, city: "Liverpool", credit_score: 0.5}
{id: 12, name: "Trent", last_name: "Benson", age: 57, city: "London", credit_score: 5.114}
{id: 13, name: "Tom", last_name: "Richardson", age: 23, city: "New York", credit_score: 0.986}
....

考虑到所有这些都是相互关联的,我想在属性上应用 GraphSAGE 算法。 出于某种原因,当我的属性是字符串时,我无法获得嵌入。请指导我如何在具有字符串类型属性的节点上应用 GraphSAGE 算法?或混合(浮点数、整数、字符串)。

Failed to invoke procedure gds.graph.create: Caused by: java.lang.UnsupportedOperationException: Loading of values of type String is currently not supported

如果要应用到运行 GraphSAGE 上的字符串类型属性,您需要应用一种热编码或其他一些技术将它们转换成数字列表中的数字。 属性 类型不能是各种数据类型的混合,它必须在所有属性中保持一致。 据我所知,这对任何包含 GraphSAGE 的库都有效,而不仅仅是 Neo4j GDS。

您可能可以跳过 ID 属性,因为它不会带来任何其他信息。对于城市、姓名和姓氏,您可以使用一种热编码或词嵌入将这些属性包含在 GraphSAGE 中,决定权在您。