GSgnnLPEvaluator
- class graphstorm.eval.GSgnnLPEvaluator(eval_frequency, eval_metric, use_early_stop=False, early_stop_burnin_rounds=0, early_stop_rounds=3, early_stop_strategy='average_increase')
Bases:
objectTemplate class for user defined evaluator.
Parameters
- eval_frequency: int
The frequency (number of iterations) of doing evaluation.
- eval_metric: list of string
Evaluation metric used during evaluation.
- use_early_stop: bool
Set true to use early stop.
- early_stop_burnin_rounds: int
Burn-in rounds before start checking for the early stop condition.
- early_stop_rounds: int
The number of rounds for validation scores used to decide early stop.
- early_stop_strategy: str
The early stop strategy. GraphStorm supports two strategies: 1) consecutive_increase and 2) average_increase.
- do_eval(total_iters, epoch_end=False)
Decide whether to do the evaluation in current iteration or epoch
Parameters
- epoch: int
The epoch number
- total_iters: int
The total number of iterations has been taken.
- epoch_end: bool
Whether it is the end of an epoch
Returns
Whether do evaluation: bool
- abstract evaluate(val_scores, test_scores, total_iters)
GSgnnLinkPredictionModel.fit() will call this function to do user defined evalution.
Note: Make sure each trainer will get the same validation scores. The early stop and model saving progress rely on certain scores.
Parameters
- val_scores: dict of tensors
The rankings of validation edges for each edge type.
- test_scores: dict of tensors
The rankings of testing edges for each edge type.
- total_iters: int
The current interation number.
Returns
- eval_score: float
Validation score
- test_score: float
Test score