8.3.6 Unsupervised GraphWiseモデルの埋込みの推測

トレーニング済モデルを使用すると、次のステップに示すように、表示されないノードの埋込みを推測してデータベースに格納できます。

  1. 次のコードに示すように、Unsupervised GraphWiseモデルの埋込みを推測します。
    JShellを使用した埋込みの推測
    opg4j> var vertexVectors = model.inferEmbeddings(fullGraph, fullGraph.getVertices()).flattenAll();
    opg4j> vertexVectors.write().
        db().
        name("vertex vectors").
        tablename("vertexVectors").  // indicate the name of the table in which the data should be stored
        overwrite(true).             // indicate that if there is a table with the same name, it will be overwritten (truncated)
        store();
    Javaを使用した埋込みの推測
    PgxFrame vertexVectors = model.inferEmbeddings(fullGraph,fullGraph.getVertices()).flattenAll();
    vertexVectors.write()
        .db()
        .name("vertex vectors")
        .tablename("vertexVectors") // indicate the name of the table in which the data should be stored
        .overwrite(true)            // indicate that if there is a table with the same name, it will be overwritten (truncated)
        .store();
    Pythonを使用した埋込みの推測
    vertexVectors = model.infer_embeddings(fullGraph,fullGraph.getVertices()).flattenAll()
    vertexVectors.write().db(name="vertex vectors", "tablename", overwrite=True)
    vertexVectorsのスキーマは、フラット化せずに次のようになります(flattenAllはベクトル列を個別のdouble値列に分割します)。
    
    +---------------------------------------------------------------+
    | vertexId                                | embedding           |
    +---------------------------------------------------------------+

    ノート:

    前述のすべての例では、現在ログインしているデータベースでモデルの埋込みを推測することを前提としています。別のデータベースでモデルの埋込みを推測する必要がある場合は、別のデータベースでのモデルの埋込みの推測の例を参照してください。