8.2.7 Inferring the Vertex Labels for a Supervised GraphWise Model

You can infer the labels for vertices on any graph (including vertices or graphs that were not seen during training) as described in the following code:

opg4j> var labels = model.inferLabels(fullGraph, testVertices)
opg4j> labels.head().print()
PgxFrame labels = model.inferLabels(fullGraph,testVertices);
labels.head().print();
labels = model.infer_labels(full_graph, test_vertices)
labels.print()
The output will be similar to the following example output:

+----------------------------------+
| vertexId | label                 |
+----------------------------------+
| 2        | Neural Networks       |
| 6        | Theory                |
| 7        | Case Based            |
| 22       | Rule Learning         |
| 30       | Theory                |
| 34       | Neural Networks       |
| 47       | Case Based            |
| 48       | Probabalistic Methods |
| 50       | Theory                |
| 52       | Theory                |
+----------------------------------+

Similarly, you can also get the model confidence for each class by inferring the prediction logits as described in the following code:

opg4j> var logits = model.inferLogits(fullGraph, testVertices)
opg4j> labels.head().print()
PgxFrame logits = model.inferLogits(fullGraph,testVertices);
logits.head().print();
logits = model.infer_logits(full_graph, test_vertices)
logits.print()