graphorge.gnn_base_model.predict.prediction.compute_sample_prediction_loss¶
- compute_sample_prediction_loss(model, loss_nature, loss_function, features_out, targets, is_normalized_loss=False)[source]¶
Compute loss of sample output features prediction.
Assumes that provided output features and targets are denormalized.
- Parameters:
model (GNNEPDBaseModel) – Graph Neural Network model.
loss_nature ({'node_features_out', 'global_features_out'}) – Loss nature.
loss_function (torch.nn._Loss) – PyTorch loss function.
features_out (torch.Tensor) – Predicted output features stored as a torch.Tensor(2d).
targets ({torch.Tensor, None}) – Output features ground-truth stored as a torch.Tensor(2d).
is_normalized_loss (bool, default=False) – If True, then samples prediction loss are computed from normalized output data, False otherwise. Normalization of output data requires that model data scalers are available.
- Returns:
loss – Loss of sample output features prediction. Set to None if output features ground-truth is not available.
- Return type:
{float, None}