Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kmeans updates from 11/24 doc updates #51

Merged
merged 2 commits into from
Nov 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions sagemaker-python-sdk/1P_kmeans_highlevel/kmeans_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,6 @@
"bucket='<bucket-name>'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data_key = 'kmeans_example/data'\n",
"data_location = 's3://{}/{}'.format(bucket, data_key)\n",
"output_location = 's3://{}/kmeans_example/output'.format(bucket)\n",
"\n",
"print('training data will be uploaded to: {}'.format(data_location))\n",
"print('training artifacts will be uploaded to: {}'.format(output_location))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -149,6 +135,12 @@
"source": [
"from sagemaker import KMeans\n",
"\n",
"data_location = 's3://{}/kmeans_highlevel_example/data'.format(bucket)\n",
"output_location = 's3://{}/kmeans_example/output'.format(bucket)\n",
"\n",
"print('training data will be uploaded to: {}'.format(data_location))\n",
"print('training artifacts will be uploaded to: {}'.format(output_location))\n",
"\n",
"kmeans = KMeans(role=role,\n",
" train_instance_count=2,\n",
" train_instance_type='ml.c4.8xlarge',\n",
Expand Down Expand Up @@ -281,10 +273,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Uncomment and run to delete\n",
"\n",
"#import sagemaker\n",
"#sagemaker.Session().delete_endpoint(kmeans_predictor.endpoint)"
"import sagemaker\n",
"sagemaker.Session().delete_endpoint(kmeans_predictor.endpoint)"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,6 @@
"bucket='<bucket-name>'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data_key = 'kmeans_example/data'\n",
"data_location = 's3://{}/{}'.format(bucket, data_key)\n",
"output_location = 's3://{}/kmeans_example/output'.format(bucket)\n",
"\n",
"print('training data will be uploaded to: {}'.format(data_location))\n",
"print('training artifacts will be uploaded to: {}'.format(output_location))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -152,6 +138,10 @@
"import io\n",
"import boto3\n",
"\n",
"data_key = 'kmeans_lowlevel_example/data'\n",
"data_location = 's3://{}/{}'.format(bucket, data_key)\n",
"print('training data will be uploaded to: {}'.format(data_location))\n",
"\n",
"# Convert the training data into the format required by the SageMaker KMeans algorithm\n",
"buf = io.BytesIO()\n",
"write_numpy_to_dense_tensor(buf, train_set[0], train_set[1])\n",
Expand Down Expand Up @@ -190,6 +180,9 @@
" 'eu-west-1': '438346466558.dkr.ecr.eu-west-1.amazonaws.com/kmeans:latest'}\n",
"image = images[boto3.Session().region_name]\n",
"\n",
"output_location = 's3://{}/kmeans_example/output'.format(bucket)\n",
"print('training artifacts will be uploaded to: {}'.format(output_location))\n",
"\n",
"create_training_params = \\\n",
"{\n",
" \"AlgorithmSpecification\": {\n",
Expand Down Expand Up @@ -473,9 +466,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Uncomment and run to delete\n",
"\n",
"# sagemaker.delete_endpoint(EndpointName=endpoint_name)"
"sagemaker.delete_endpoint(EndpointName=endpoint_name)"
]
}
],
Expand Down