Skip to content

Commit

Permalink
fix experiments sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
camila-buzzni committed Jun 30, 2024
1 parent 78f7adf commit 891d9c8
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions aws-sagemaker/2.experiment_training/keras_experiment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import boto3\n",
"import sagemaker\n",
"from sagemaker.session import Session\n",
"from sagemaker import get_execution_role\n",
"from sagemaker.experiments.run import Run"
]
},
Expand Down Expand Up @@ -121,8 +118,8 @@
"default_bucket = sagemaker_session.default_bucket()\n",
"\n",
"# sagemaker를 사용\n",
"sm = sagemaker_session.client(\"sagemaker\")\n",
"region = sagemaker_session.region_name"
"sm = boto_session.client(\"sagemaker\")\n",
"region = boto_session.region_name"
]
},
{
Expand Down Expand Up @@ -192,8 +189,7 @@
" train_path,\n",
")\n",
"s3.download_file(\n",
" f\"sagemaker-example-files-prod-{\n",
" region}\", \"datasets/image/MNIST/numpy/input_test.npy\", test_path\n",
" f\"sagemaker-example-files-prod-{region}\", \"datasets/image/MNIST/numpy/input_test.npy\", test_path\n",
")\n",
"s3.download_file(\n",
" f\"sagemaker-example-files-prod-{region}\",\n",
Expand Down Expand Up @@ -357,9 +353,9 @@
"# The Keras Callback class provides a method on_epoch_end which emits metrics at the end of each epoch.\n",
"# All emitted metrics will be logged in the run passed to the callback.\n",
"class ExperimentCallback(keras.callbacks.Callback):\n",
" def __init__(self, run, model, x_test, y_test):\n",
" def __init__(self, run, trained_model, x_test, y_test):\n",
" self.run = run\n",
" self.model = model\n",
" self.trained_model = trained_model\n",
" self.x_test = x_test\n",
" self.y_test = y_test\n",
"\n",
Expand Down

1 comment on commit 891d9c8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MODEL METRICS

Training variance explained: 33.0%
Test variance explained: 32.0%

Data viz

feature_importance
residuals

Please sign in to comment.