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 isdatabase_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 provideddataset.validation_table: Use the dataset the model was trained on to construct the graph, and score against the providedvalidation_table.- Neither
datasetnorvalidation_tableprovided: 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.
Parameters
Section titled “Parameters”| Name | Type | Description | Optional |
|---|---|---|---|
dataset | RelationalDataset | Dataset to score against. If not provided, the training dataset is used. Cannot be used together with validation_table. | Yes |
validation_table | str | Fully 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_size | int | Batch size to use during scoring. Defaults to 128. | Yes |
model_run_id | str | Score 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_key | str | The 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_dtypes | bool | If 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 |
Returns
Section titled “Returns”An instance of a JobMonitor object. Retrieve the computed metrics via job.get_status()["result"]["validation_metrics"].
Examples
Section titled “Examples”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 completesmetrics = score_job.get_status()["result"]["validation_metrics"]Scoring on a Custom Validation Table
Section titled “Scoring on a Custom Validation Table”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")Common Validation Errors
Section titled “Common Validation Errors”- Neither
model_run_idnorregistered_model_keyprovided — You must specify exactly one of the two to select the model to score. - Both
model_run_idandregistered_model_keyprovided — Choose one or the other, not both. - Both
datasetandvalidation_tableprovided — Choose one or the other, not both. - No validation table is reachable — Provide a
datasetorvalidation_tablethat 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).