17.3.12 Evaluating Model Performance
You can use the evaluate
convenience method to evaluate
various metrics for the model:
opg4j> model.evaluate(fullGraph, testEdges).print()
model.evaluate(fullGraph,testEdges).print();
model.evaluate(full_graph,test_edges).print()
Similar to inferring labels, if the task is a classification task, you can add the decision threshold as an extra parameter:
opg4j> model.evaluate(fullGraph, testEdges, 6f).print()
model.evaluate(fullGraph,testEdges, 6f).print();
model.evaluate(full_graph,test_edges, 6).print()
For a classification model, the output will be similar to the following:
+------------------------------------------+
| Accuracy | Precision | Recall | F1-Score |
+------------------------------------------+
| 0.8488 | 0.8523 | 0.831 | 0.8367 |
+------------------------------------------+
For a regression model, the output will be similar to the following:
+--------------------+
| MSE |
+--------------------+
| 0.9573243436116953 |
+--------------------+
Note that for a classification model, the evaluateLabels
method is also available and this is equivalent to the evaluate
method.