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

服务 · Machine Learning · 基于 AIF-C01

Amazon SageMaker automatic model tuning

Pick a search strategy, set ranges and an objective metric, and balance speed, quality and cost.

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

你在AI Practitioner中已学过

  • A hyperparameter is a setting chosen before training. Weights are learned.
  • Common ones: learning rate, batch size, epochs and regularization.
  • Automatic model tuning runs many training jobs to find good values.
阅读AI Practitioner课程
  • Bayesian

    How it picks
    Learns from past jobs
    Use when
    Few jobs, limited budget
  • Random

    How it picks
    Independent samples
    Use when
    Many parallel jobs
  • Grid

    How it picks
    Every categorical combination
    Use when
    A small, exact set
  • Hyperband

    How it picks
    Stops weak jobs early
    Use when
    Iterative models
Four tuning strategies.

1 / 2

  • Bayesian

    How it picks
    Learns from past jobs
    Use when
    Few jobs, limited budget
  • Random

    How it picks
    Independent samples
    Use when
    Many parallel jobs
  • Grid

    How it picks
    Every categorical combination
    Use when
    A small, exact set

2 / 2

  • Hyperband

    How it picks
    Stops weak jobs early
    Use when
    Iterative models
Four tuning strategies.
Tuning job
Training jobs
Objective metric
  1. 1The tuner starts training jobs with chosen values.
  2. 2Each job reports the objective metric, read from its logs.
  3. 3The tuner uses the results to choose the next values, until it reaches the limits.
The tuning loop.

是什么

A tuning job takes a training job definition, a range for each hyperparameter, an objective metric to maximize or minimize, and limits. It launches training jobs, reads each job’s metric and chooses what to try next. Ranges can be continuous, integer or categorical. For a range that spans orders of magnitude, such as a learning rate from 0.0001 to 0.1, use logarithmic scaling so values are sampled evenly across powers of ten.

是什么

Strategies. Bayesian optimization (the default) learns from earlier results to choose better values, so it needs few jobs, but it learns less when many jobs run at once. Random search samples independently, so you can run many jobs in parallel. Grid search tries every combination, and only works with categorical values. Hyperband stops weak jobs early and gives more resources to strong ones. It needs an iterative algorithm that reports the metric at each step, such as a neural network.

是什么

The objective metric comes from the algorithm: built-in algorithms emit it for you. For your own script, give a metric definition, a name and a regular expression that finds the number in the training logs.

是什么

Limits: the maximum number of training jobs, and the maximum number running in parallel. More parallel jobs finish sooner but give Bayesian search less to learn from, so quality can drop. Early stopping (set to Auto) ends jobs unlikely to beat the best so far. With Hyperband leave it off, because Hyperband has its own. Warm start reuses results from earlier tuning jobs, so a new job begins informed. Cost: you pay for every training job it runs, so the maximum number of jobs times the cost of one job is the ceiling.

要记住

  • Strategies: Bayesian (default), random, grid (categorical only) and Hyperband.
  • Use logarithmic scaling for ranges that cross orders of magnitude.
  • Objective metric: built in, or a regular expression on the logs for your script.
  • More parallel jobs: faster, but less learning for Bayesian search.

要记住

  • Early stopping and Hyperband save time and cost. Warm start reuses earlier results.
  • You pay for every training job. The maximum number of jobs caps the cost.

考试中

  • “Find the best learning rate and batch size automatically” points to SageMaker automatic model tuning.
  • “Tune a neural network and stop poor runs early” points to the Hyperband strategy.
  • “Try only these exact combinations of categorical values” points to grid search.
  • “Run many jobs at once, each independent of the last” points to random search.