GSgnnRegressionEvaluator
- class graphstorm.eval.GSgnnRegressionEvaluator(eval_frequency, eval_metric_list=None, use_early_stop=False, early_stop_burnin_rounds=0, early_stop_rounds=3, early_stop_strategy='average_increase')
Bases:
GSgnnBaseEvaluator,GSgnnPredictionEvalInterfaceEvaluator for regression tasks.
A built-in evaluator for regression tasks. It uses
rmseas the default evaluation metric.Parameters
- eval_frequency: int
The frequency (number of iterations) of doing evaluation.
- eval_metric_list: list of string
Evaluation metric used during evaluation. Default: [“rmse”].
- use_early_stop: bool
Set true to use early stop. Default: False.
- early_stop_burnin_rounds: int
Burn-in rounds (number of evaluations) before starting to check for the early stop condition. Default: 0.
- early_stop_rounds: int
The number of rounds (number of evaluations) for validation scores used to decide early stop. Default: 3.
- early_stop_strategy: str
The early stop strategy. GraphStorm supports two strategies: 1)
consecutive_increase, and 2)average_increase. Default:average_increase.
- evaluate(val_pred, test_pred, val_labels, test_labels, total_iters)
Compute regression scores on validation and test sets.
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 regression metrics in the format of {metric: val_score}.
- test_score: dict
Test scores of different regression metrics in the format of {metric: test_score}.
- compute_score(pred, labels, train=True)
Compute regression evaluation score.
Parameters
- pred: tensor
The tensor stores the prediction results.
- labels: tensor
The tensor stores the labels.
- train: bool
If in model training.
Returns
- scores: dict
Evaluation scores of different regression metrics in the format of {metric: score}. If either pred or labels are None, the score will be “N/A”.