|
| 1 | +.. image:: branding/icon/sagemaker-banner.png |
| 2 | + :height: 100px |
| 3 | + :alt: SageMaker |
| 4 | + |
| 5 | +==================== |
1 | 6 | SageMaker Python SDK
|
2 | 7 | ====================
|
3 | 8 |
|
4 | 9 | SageMaker Python SDK is an open source library for training and deploying machine learning models on Amazon SageMaker.
|
5 | 10 |
|
6 | 11 | With the SDK, you can train and deploy models using popular deep learning frameworks: **Apache MXNet** and **TensorFlow**. You can also train and deploy models with **Amazon algorithms**, these are scalable implementations of core machine learning algorithms that are optimized for SageMaker and GPU training. If you have **your own algorithms** built into SageMaker compatible Docker containers, you can train and host models using these as well.
|
7 | 12 |
|
| 13 | +For detailed API reference please go to: `Read the Docs <https://readthedocs.org/projects/sagemaker/>`_ |
| 14 | + |
8 | 15 | Table of Contents
|
9 | 16 | -----------------
|
10 | 17 |
|
@@ -1417,7 +1424,45 @@ Amazon SageMaker provides several built-in machine learning algorithms that you
|
1417 | 1424 |
|
1418 | 1425 | The full list of algorithms is available on the AWS website: https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html
|
1419 | 1426 |
|
1420 |
| -SageMaker Python SDK includes Estimator wrappers for the AWS K-means, Principal Components Analysis, and Liner Learner algorithms. |
| 1427 | +SageMaker Python SDK includes Estimator wrappers for the AWS K-means, Principal Components Analysis, and Linear Learner algorithms. |
| 1428 | +
|
| 1429 | +Definition and usage |
| 1430 | +~~~~~~~~~~~~~~~~~~~~ |
| 1431 | +Estimators that wrap Amazon's built-in algorithms define algorithm's hyperparameters with defaults. When a default is not possible you need to provide the value during construction: |
| 1432 | +
|
| 1433 | +- ``KMeans`` Estimator requires parameter ``k`` to define number of clusters |
| 1434 | +- ``PCA`` Estimator requires parameter ``num_components`` to define number of principal components |
| 1435 | +
|
| 1436 | +Interaction is identical as any other Estimators. There are additional details about how data is specified. |
| 1437 | +
|
| 1438 | +Input data format |
| 1439 | +^^^^^^^^^^^^^^^^^ |
| 1440 | +Please note that Amazon's built-in algorithms are working best with protobuf ``recordIO`` format. |
| 1441 | +The data is expected to be available in S3 location and depending on algorithm it can handle dat in multiple data channels. |
| 1442 | +
|
| 1443 | +This package offers support to prepare data into required fomrat and upload data to S3. |
| 1444 | +Provided class ``RecordSet`` captures necessary details like S3 location, number of records, data channel and is expected as input parameter when calling ``fit()``. |
| 1445 | +
|
| 1446 | +Function ``record_set`` is available on algorithms objects to make it simple to achieve the above. |
| 1447 | +It takes 2D numpy array as input, uploads data to S3 and returns ``RecordSet`` objects. By default it uses ``train`` data channel and no labels but can be specified when called. |
| 1448 | +
|
| 1449 | +Please find an example code snippet for illustration: |
| 1450 | +
|
| 1451 | +.. code:: python |
| 1452 | +
|
| 1453 | + from sagemaker import PCA |
| 1454 | + pca_estimator = PCA(role='SageMakerRole', train_instance_count=1, train_instance_type='ml.m4.xlarge', num_components=3) |
| 1455 | +
|
| 1456 | + import numpy as np |
| 1457 | + records = pca_estimator.record_set(np.arange(10).reshape(2,5)) |
| 1458 | +
|
| 1459 | + pca_estimator.fit(records) |
| 1460 | +
|
| 1461 | +
|
| 1462 | +Predictions support |
| 1463 | +~~~~~~~~~~~~~~~~~~~ |
| 1464 | +Calling inference on deployed Amazon's built-in algorithms requires specific input format. By default, this library creates a predictor that allows to use just numpy data. |
| 1465 | +Data is converted so that ``application/x-recordio-protobuf`` input format is used. Received response is deserialized from the protobuf and provided as result from the ``predict`` call. |
1421 | 1466 |
|
1422 | 1467 |
|
1423 | 1468 | BYO Docker Containers with SageMaker Estimators
|
|
0 commit comments