8.1.10.1 Loading a Pre-Trained Model From Another Database

You can load models from a different database other than the one used for login.

You can load a pre-trained model from a model store table in database as described in the following code:

opg4j> var model = analyst.<modelLoader>.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
                modelstore("modeltablename"). // name of the model store table
                modelname("model").           // model name (primary key of model store table)
                load()
where <modelLoader> applies as follows:
  • loadDeepWalkModel(): Loads a Deepwalk model
  • loadSupervisedGraphWiseModel(): Loads a Supervised GraphWise model
  • loadUnsupervisedGraphWiseModel(): Loads a Unsupervised GraphWise model
  • loadPg2vecModel(): Loads a Pg2vec model
<modeltype> model = analyst.<modelLoader>.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
     .modelstore("modeltablename") // name of the model store table
     .modelname("model")           // model name (primary key of model store table)
     .load();

where <modeltype> can have the following values based on the model to be loaded:

  • DeepWalkModel: represents a Deepwalk model
  • SupervisedGraphWiseModel: represents a Supervised GraphWise model
  • UnsupervisedGraphWiseModel: represents a Unsupervised GraphWise model
  • Pg2vecModel: represents a Pg2vec model
where <modelLoader> applies as follows:
  • loadDeepWalkModel(): Loads a Deepwalk model
  • loadSupervisedGraphWiseModel(): Loads a Supervised GraphWise model
  • loadUnsupervisedGraphWiseModel(): Loads a Unsupervised GraphWise model
  • loadPg2vecModel(): Loads a Pg2vec model
model = analyst.<modelLoader>.db(username="user",     # DB user to use for storing the model
                  password="password",                # password of the DB user
                  jdbc_url="jdbc_url",                # jdbc url to the DB
                  model_store="modelstoretablename",  # name of the model store table
                  model_name="model")                 # model name (primary key of model store table)
where <modelLoader> applies as follows:
  • get_deepwalk_model_loader(): Loads a Deepwalk model
  • get_supervised_graphwise_model_loader(): Loads a Supervised GraphWise model
  • get_unsupervised_graphwise_model_loader(): Loads a Unsupervised GraphWise model
  • get_pg2vec_model_loader(): Loads a Pg2vec model