8.2.8.1 別のデータベースでのモデルの埋込みの推測
ログインに使用したものとは異なるデータベースでトレーニング済モデルの埋込みを推測して格納できます。
次のコードは、別のデータベースで埋込みを推測して格納する方法を示しています。
JShellを使用した埋込みの推測
opg-jshell> var vertexVectors = model.inferEmbeddings(fullGraph, fullGraph.getVertices()).flattenAll()
opg-jshell> vertexVectors.write()
.db()
.username("user") // DB user to use for storing the model
.password("password") // password of the DB user
.jdbcUrl("jdbcUrl") // jdbc url to the 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()
.username("user") // DB user to use for storing the model
.password("password") // password of the DB user
.jdbcUrl("jdbcUrl") // jdbc url to the 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(username="user", password="password", jdbc_url="jdbcUrl",
name="vertex vectors", "tablename", overwrite=True)