AWS Certified Machine Learning - Specialty: Hyperparameter Tuning for Video Classification | SageMaker Jupyter Notebook | Amazon AWS

Hyperparameter Tuning for Video Classification with TensorFlow in SageMaker Jupyter Notebook

Question

You work as a machine learning specialist for a security company that uses video feeds to identify criminal activity in a client company's retail environments.

You are building a convolutional neural network model using TensorFlow to use for your video classification.

The model is expected to classify video scenes as criminal, such as theft, or benign.

You have thousands of hours of video on which to train your model.

Therefore, you plan to leverage hyperparameter tuning to run multiple training jobs using different hyperparameter combinations.

The goal is to find the model with the best training result.

You are writing your hyperparameter tuning job in your SageMaker jupyter notebook.

When you create your HyperparameterTuner object in your python code, which parameters do you pass in the method? (Select TWO)

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answers: A and D.

Option A is correct.

When you create the HyperparameterTuner object in your python code, you need to specify the estimator you are using, in this case, TensorFlow, the ranges for your hyperparameters, the objective metric you wish to solve to, and resource configuration details, such as the number of training jobs to run in total and how many training jobs can be run in parallel.

Option B is incorrect.

You specify the training steps when you create your TensorFlow estimator in your python code.

Option C is incorrect.

You specify the evaluation steps when you create your TensorFlow estimator in your python code.

Option D is correct.

When you create the HyperparameterTuner object in your python code, you need to specify the estimator you are using, in this case, TensorFlow, the ranges for your hyperparameters, the objective metric you wish to solve to, and resource configuration details, such as the number of training jobs to run in total and how many training jobs can be run in parallel.

Option E is incorrect.

You specify the instance type when you create your TensorFlow estimator in your python code.

References:

Please see the Amazon SageMaker page titled Machine learning for every developer and data scientist (https://aws.amazon.com/machine-learning/accelerate-amazon-sagemaker/#Train_machine_learning_models),

The Amazon SageMaker Examples titled Hyperparameter Tuning using SageMaker Tensorflow Container (https://github.com/aws/amazon-sagemaker-examples/blob/master/hyperparameter_tuning/tensorflow_mnist/hpo_tensorflow_mnist.ipynb),

The Medium article titled Video Classification using CNNs (https://medium.com/analytics-vidhya/video-classification-using-cnns-db18bd2b7e72)

When creating a HyperparameterTuner object in Amazon SageMaker, you need to pass in several parameters that define the training job's configuration and the hyperparameters to optimize. The parameters you need to pass in are:

  1. TensorFlow estimator: You need to specify the estimator object that defines the TensorFlow training job. This object contains information such as the training script location, the input and output channels, and the instance type.

  2. Hyperparameter ranges: You need to specify the hyperparameters to optimize and their possible values. SageMaker supports both continuous and categorical hyperparameters. For example, you can specify the learning rate range, batch size range, number of hidden layers range, and activation function options.

  3. Instance type: You need to specify the instance type that SageMaker should use for the training jobs. SageMaker supports a wide range of instance types, from small CPU instances to large GPU instances. The instance type should be chosen based on the size of the training data, the complexity of the model, and the available budget.

  4. Training steps: You need to specify the number of training steps or epochs for each training job. This parameter defines how many times the model should iterate over the training data to update its parameters.

  5. Evaluation steps: You need to specify the number of evaluation steps for each training job. This parameter defines how many times the model should evaluate its performance on a validation dataset during training.

In summary, when creating a HyperparameterTuner object in Amazon SageMaker for your TensorFlow model, you need to pass in the TensorFlow estimator, hyperparameter ranges, instance type, training steps, and evaluation steps. By optimizing the hyperparameters through multiple training jobs, you can improve the model's accuracy and efficiency for video classification.