Code Monkey home page Code Monkey logo

Comments (5)

ZHUI avatar ZHUI commented on August 23, 2024 2

您好!

因 ErnieSAGE 节点分类场景使用较少,本repo暂未将节点分类的例子迁移。
由于目前PGL的 ErnieSAGE节点分类的例子暂时移除了。您可以参考下面的PR,来修改适配节点分类任务。
https://github.com/PaddlePaddle/PGL/pull/116/files

主要需要修改的点,是数据
https://github.com/PaddlePaddle/PGL/pull/116/files#diff-c8e8737ec50e6d7af7b3228e18fcd9c67a6d43e447870b1e8904f7496af4ce24R128
和 模型
https://github.com/PaddlePaddle/PGL/pull/116/files#diff-562552ce495899a7dba6b0891cd6a49d3f8fd495a2da6e60ef8149c8d8305caaR78
这两块的代码。

如果想使用ErnieSAGE做节点分类的用户较多,我们后面可以考虑新增节点分类的例子。
如果您可以参考PGL实现节点分类的例子,也非常欢迎您给我们贡献代码。

from paddlenlp.

 avatar commented on August 23, 2024

您好!

因 ErnieSAGE 节点分类场景使用较少,本repo暂未将节点分类的例子迁移。
由于目前PGL的 ErnieSAGE节点分类的例子暂时移除了。您可以参考下面的PR,来修改适配节点分类任务。
https://github.com/PaddlePaddle/PGL/pull/116/files

主要需要修改的点,是数据
https://github.com/PaddlePaddle/PGL/pull/116/files#diff-c8e8737ec50e6d7af7b3228e18fcd9c67a6d43e447870b1e8904f7496af4ce24R128
和 模型
https://github.com/PaddlePaddle/PGL/pull/116/files#diff-562552ce495899a7dba6b0891cd6a49d3f8fd495a2da6e60ef8149c8d8305caaR78
这两块的代码。

如果想使用ErnieSAGE做节点分类的用户较多,我们后面可以考虑新增节点分类的例子。
如果您可以参考PGL实现节点分类的例子,也非常欢迎您给我们贡献代码。

你好,感谢你的回复。我在你发的https://github.com/WeiyueSu/PGL/tree/main/examples 的库里发现了unsup_graphsage,但是与一般的unsup_graphsage不同的是此版本没有提供节点的初始特征,请问应该在哪部分初始化自己的节点特征?

from paddlenlp.

ZHUI avatar ZHUI commented on August 23, 2024

你好,感谢你的回复。我在你发的https://github.com/WeiyueSu/PGL/tree/main/examples 的库里发现了unsup_graphsage,但是与一般的unsup_graphsage不同的是此版本没有提供节点的初始特征,请问应该在哪部分初始化自己的节点特征?

此处unsup_graphsage,使用了可学习的 embeding参数作为特征, https://github.com/PaddlePaddle/PGL/blob/main/legacy/examples/unsup_graphsage/train.py#L104
如果想加入节点的特征,可以在此处将 embedding 特征和 节点初始特征相加。

节点初始特征,可以加入图结构中,然后到 graph_wrapper中去取出来。

from paddlenlp.

 avatar commented on August 23, 2024

你好,感谢你的回复。我在你发的https://github.com/WeiyueSu/PGL/tree/main/examples 的库里发现了unsup_graphsage,但是与一般的unsup_graphsage不同的是此版本没有提供节点的初始特征,请问应该在哪部分初始化自己的节点特征?

此处unsup_graphsage,使用了可学习的 embeding参数作为特征, https://github.com/PaddlePaddle/PGL/blob/main/legacy/examples/unsup_graphsage/train.py#L104
如果想加入节点的特征,可以在此处将 embedding 特征和 节点初始特征相加。

节点初始特征,可以加入图结构中,然后到 graph_wrapper中去取出来。

    batch_negative_label = fluid.layers.reshape(
        fluid.layers.range(0, batch_size, 1, "int64"), [-1, 1])
    batch_negative_label = fluid.layers.one_hot(batch_negative_label,
                                                batch_size)

用同一批次中的其他样本作为负样本,会不会导致正样本作为负样本训练?

from paddlenlp.

ZHUI avatar ZHUI commented on August 23, 2024

用同一批次中的其他样本作为负样本,会不会导致正样本作为负样本训练?

    batch_size = args.batch_size
    batch_negative_label = fluid.layers.reshape(
        fluid.layers.range(0, batch_size, 1, "int64"), [-1, 1])
    batch_negative_label = fluid.layers.one_hot(batch_negative_label,
                                                batch_size)
    batch_loss_weight = (batch_negative_label *
                         (batch_size - 2) + 1.0) / (batch_size - 1)

这里把对角线上的正样本权重设置为0了。

from paddlenlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.