Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In AlgoOperator abstraction, we decouple the train/prediction into two operators, namely Metapath2vecTrainOp MetaPath2VecTrainOp and Metapath2vecPredictOpMetaPath2VecPredictOp.

Below are the code snippets.

Code Block
languagejava
// User code

TableSourceOp edges, nodeLabels; // used for training, can be constructed from Table
TableSourceOp nodeIds; // used for prediction, can be constructed from Table
AlgoOperator modelOp = new MetaPath2vecTrainOpMetaPath2VecTrainOp()
      .linkFrom(edges, nodeLabels);
AlgoOperator result = new MetaPath2vecPredictOpMetaPath2VecPredictOp()
      .linkFrom(modelOp, nodeIds);

// Developer code

public class MetaPath2vecTrainOpMetaPath2VecTrainOp extends AlgoOperator<MetaPath2vecTrainOp>AlgoOperator<MetaPath2VecTrainOp> {

       @Internal 
       @Override
       public Table[] compute(Table… inputs) {
               // do the computation logic
       }

}

public class MetaPath2VecPredictOp extends AlgoOperator<MetaPath2VecPredictOp> {
       
       @Internal 
       @Override
       public Table[] compute(Table… inputs) {
              // do the computation logic
       }

}

Express the algorithms that are used/covered by machine learning libraries but usually not implemented as a transformer/estimator.

...