Skip to content

GNNEstimator.score()

Submits a scoring job that runs inference on the validation split and computes evaluation metrics. Jobs initiated by the score() method are of type inference and can be monitored using the returned JobMonitor object.

Unlike predict(), score() never exports predictions. It only computes error metrics (such as accuracy, F1, or RMSE, depending on the task type) and returns them in the job result.

Model Selection:

A model must be specified using one of the following options:

  • registered_model_key: Use a specific registered model. The convention followed for the name is database_name.schema_name.registered_model_name.version.
  • model_run_id: Use a specific model run ID.

Validation Table Selection:

The validation split to score against is resolved as follows:

  • dataset: Score against the validation table of the provided dataset.
  • validation_table: Use the dataset the model was trained on to construct the graph, and score against the provided validation_table.
  • Neither dataset nor validation_table provided: Use the dataset the model was trained on and score against its validation table.

The validation table must contain the label column (node tasks) or the source and target entity columns (link tasks) so the metrics can be computed.

NameTypeDescriptionOptional
datasetRelationalDatasetDataset to score against. If not provided, the training dataset is used. Cannot be used together with validation_table.Yes
validation_tablestrFully qualified path to a custom validation table. Uses the training graph with this table replacing the original validation split. Cannot be used together with dataset.Yes
validation_batch_sizeintBatch size to use during scoring. Defaults to 128.Yes
model_run_idstrScore using this specific model run ID. You can obtain the model run id from your training job using train_job.model_run_id. Either a model_run_id or a registered_model_key must be provided.Yes
registered_model_keystrThe full identifier of a registered model in the format: database_name.schema_name.registered_model_name.version. Either a model_run_id or a registered_model_key must be provided.Yes
align_dtypesboolIf True and a dataset is provided, automatically align the dataset’s column data types to the model’s expected types after schema validation. Defaults to False.Yes

An instance of a JobMonitor object. Retrieve the computed metrics via job.get_status()["result"]["validation_metrics"].

Scoring a Trained Model on Its Validation Split

Section titled “Scoring a Trained Model on Its Validation Split”

After training completes, you can compute evaluation metrics for the model on the dataset’s validation split:

score_job = estimator.score(
model_run_id=train_job.model_run_id
)
# Retrieve the computed metrics once the job completes
metrics = score_job.get_status()["result"]["validation_metrics"]

You can score against a different validation table without creating a new RelationalDataset, while keeping the original dataset for graph construction:

score_job = estimator.score(
model_run_id=train_job.model_run_id,
validation_table="DATABASE.SCHEMA.VALIDATION"
)
  • Neither model_run_id nor registered_model_key provided — You must specify exactly one of the two to select the model to score.
  • Both model_run_id and registered_model_key provided — Choose one or the other, not both.
  • Both dataset and validation_table provided — Choose one or the other, not both.
  • No validation table is reachable — Provide a dataset or validation_table that includes a validation split, or ensure the training dataset defines one.
  • The validation table is missing columns required to compute metrics — Ensure the validation table contains the label column (node tasks) or the source and target entity columns (link tasks).