|
21 | 21 | "## Defining Training Metrics (Amazon SageMaker Python SDK)\n", |
22 | 22 | "Define the metrics that you want to send to CloudWatch by specifying a list of metric names and regular expressions as the metric_definitions argument when you initialize an Estimator object. For example, if you want to monitor both the train:error and validation:error metrics in CloudWatch, your Estimator initialization would look like the following:\n", |
23 | 23 | "```python \n", |
24 | | - "estimator = Estimator(image_name=ImageName,\n", |
25 | | - " role='SageMakerRole', train_instance_count=1,\n", |
26 | | - " train_instance_type='ml.c4.xlarge', \n", |
27 | | - " k=10,\n", |
28 | | - " metric_definitions=[\n", |
29 | | - " {'Name': 'train:error', 'Regex': 'Train_error=(.*?);'},\n", |
30 | | - " {'Name': 'validation:error', 'Regex': 'Valid_error=(.*?);'}\n", |
31 | | - " ])\n", |
| 24 | + "estimator = TensorFlow(base_job_name='cifar10',\n", |
| 25 | + " entry_point='cifar10_keras_sm.py',\n", |
| 26 | + " source_dir='training_script',\n", |
| 27 | + " role=role,\n", |
| 28 | + " framework_version='1.12.0',\n", |
| 29 | + " py_version='py3',\n", |
| 30 | + " metric_definitions=[\n", |
| 31 | + " {'Name': 'train:error', 'Regex': 'Train_error=(.*?);'},\n", |
| 32 | + " {'Name': 'validation:error', 'Regex': 'Valid_error=(.*?);'}\n", |
| 33 | + " ],\n", |
| 34 | + " hyperparameters={'epochs' : 20},\n", |
| 35 | + " train_instance_count=1, train_instance_type='ml.p3.2xlarge')\n", |
32 | 36 | "```" |
33 | 37 | ] |
34 | 38 | }, |
|
60 | 64 | "cell_type": "markdown", |
61 | 65 | "metadata": {}, |
62 | 66 | "source": [ |
63 | | - "Run the previous job, this time. add the ```metric_definitions=metric_definitions``` argument. \n", |
| 67 | + "Continue with the notebook and run the same job as before (Same estimator configuration). this time, add the ```metric_definitions=metric_definitions``` argument. \n", |
64 | 68 | "Run the job for 20 epochs" |
65 | 69 | ] |
66 | 70 | }, |
|
0 commit comments