ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

概念

Automated testing in ML pipelines

Which tests to automate for ML code, data and models, and where each one runs.

本课尚未翻译,暂以英文显示。

  • Unit tests

    It checks
    Transform and feature code
    Runs in
    CodeBuild, every commit
  • Data validation

    It checks
    Schema, nulls, ranges
    Runs in
    Glue Data Quality or Processing
  • Quality gate

    It checks
    Metric above a threshold
    Runs in
    Pipelines Condition step
  • Regression test

    It checks
    Not worse than production
    Runs in
    Evaluation step
  • Integration test

    It checks
    Requests and answers work end to end
    Runs in
    Staging endpoint
  • Load test

    It checks
    Latency and errors under load
    Runs in
    Staging endpoint
Six automated tests and where each one runs.

1 / 2

  • Unit tests

    It checks
    Transform and feature code
    Runs in
    CodeBuild, every commit
  • Data validation

    It checks
    Schema, nulls, ranges
    Runs in
    Glue Data Quality or Processing
  • Quality gate

    It checks
    Metric above a threshold
    Runs in
    Pipelines Condition step

2 / 2

  • Regression test

    It checks
    Not worse than production
    Runs in
    Evaluation step
  • Integration test

    It checks
    Requests and answers work end to end
    Runs in
    Staging endpoint
  • Load test

    It checks
    Latency and errors under load
    Runs in
    Staging endpoint
Six automated tests and where each one runs.
Commit
Unit tests
Train and evaluate
Metric above threshold?
Staging tests
Promote
yestests pass
  1. 1A commit starts the pipeline.
  2. 2Unit tests run in CodeBuild.
  3. 3The pipeline trains and evaluates the model, and a gate checks the metric.
Cheap tests first, then gates, then staging.

是什么

An ML pipeline needs more tests than code alone. Unit tests check transform and feature code with small fixed inputs. They run in AWS CodeBuild on every commit, before any training. Data validation checks the new data for schema, missing values and ranges, for example with AWS Glue Data Quality or a SageMaker AI Processing step. Bad data stops the run before it costs training time.

是什么

After training, a model quality gate compares an evaluation metric with a fixed threshold in a Condition step. A regression test compares the new model with the current production model on the same held-out data and fails if it is worse. Then deploy to a staging endpoint. An integration test sends real-shaped requests and checks the format and the answers. A load test checks latency and error rate at the expected traffic, with a load tool run from CodeBuild.

是什么

Order the tests from cheap to costly: unit tests first, then data checks, then training and the quality gate, then staging tests, then an approval before production. A failure at any gate stops the pipeline. Keep the test data and the thresholds in version control so runs are repeatable.

要记住

  • Unit tests: transform and feature code, in CodeBuild on each commit.
  • Data validation: schema, nulls and ranges before training.
  • Quality gate: a metric threshold in a Condition step.
  • Regression test: the new model must not be worse than the current one.
  • Integration and load tests run against a staging endpoint.

要记住

  • Run cheap tests first. Any failed gate stops the pipeline.

考试中

  • “Stop the pipeline when new data has unexpected nulls” points to a data validation gate before training.
  • “Do not promote a model that scores below the production model” points to a regression test against the champion.
  • “Check p95 latency before production” points to a load test on a staging endpoint.
  • “Test the feature code on every commit” points to unit tests in CodeBuild.