GSgnnPredictionEvalInterface
- class graphstorm.eval.GSgnnPredictionEvalInterface
Bases:
objectInterface for Prediction evaluation functions.
The interface set the two abstract methods for prediction tasks, i.e., Classification and Regression, which should be implemented if inherit this interface.
1.
evaluate()method, which will be called by different Trainers in theireval()function to provide evaluation results of validation and test sets during training process.compute_score()method, which computes the scores for given predictions and labels.
- abstract evaluate(val_pred, test_pred, val_labels, test_labels, total_iters)
Evaluate Prediction results on validation and test sets.
Classification and regression evaluators should provide both predictions and labels of validation and test sets to this method.
Parameters
- val_predtensor
The tensor stores the prediction results on the validation nodes or edges.
- test_predtensor
The tensor stores the prediction results on the test nodes or edges.
- val_labelstensor
The tensor stores the labels of the validation nodes or edges.
- test_labelstensor
The tensor stores the labels of the test nodes or edges.
- total_iters: int
The current iteration number.
Returns
- eval_score: dict
Validation scores of different metrics in the format of {metric: val_score}.
- test_score: dict
Test scores of different metrics in the format of {metric: test_score}.
- abstract compute_score(pred, labels, train=True)
Compute evaluation score of Prediction results.
Classification and regression evaluators should provide both predictions and labels to this method.
Parameters
- pred: tensor
The tensor stores the prediction results.
- labels: tensor
The tensor stores the labels.
- train: bool
If in model training.
Returns
dict: Evaluation scores of different metrics in the format of {metric: score}.