Skip to content

Commit b9d0033

Browse files
authored
Merge branch 'master' into fix/estimator-hyperparameters
2 parents 8b6edc8 + fe604ff commit b9d0033

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

doc/frameworks/sklearn/using_sklearn.rst

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ With Scikit-learn Estimators, you can train and host Scikit-learn models on Amaz
77
For information about supported versions of Scikit-learn, see the `AWS documentation <https://docs.aws.amazon.com/sagemaker/latest/dg/sklearn.html>`__.
88
We recommend that you use the latest supported version because that's where we focus most of our development efforts.
99

10-
You can visit the Scikit-learn repository at https://github.com/scikit-learn/scikit-learn.
10+
For more information about the framework, see the `Sciket-Learn <https://github.com/scikit-learn/scikit-learn>`_ repository.
1111
For general information about using the SageMaker Python SDK, see :ref:`overview:Using the SageMaker Python SDK`.
1212

1313
.. contents::
@@ -82,7 +82,8 @@ Because the SageMaker imports your training script, you should put your training
8282
(``if __name__=='__main__':``) if you are using the same script to host your model, so that SageMaker does not
8383
inadvertently run your training code at the wrong point in execution.
8484

85-
For more on training environment variables, please visit https://github.com/aws/sagemaker-containers.
85+
For more on training environment variables, please visit
86+
`SageMaker Training Toolkit <https://github.com/aws/sagemaker-training-toolkit>`_.
8687

8788
.. important::
8889
The sagemaker-containers repository has been deprecated,
@@ -124,7 +125,7 @@ Both ``requirements.txt`` and your training script should be put in the same fol
124125
You must specify this folder in ``source_dir`` argument when creating a Scikit-learn estimator.
125126
A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``.
126127
You can also specify the version of an item to install.
127-
For information about the format of a ``requirements.txt`` file, see `Requirements Files <https://pip.pypa.io/en/stable/user_guide/#requirements-files>`__ in the pip documentation.
128+
For information about the format of a ``requirements.txt`` file, see `Requirements Files <https://pip.pypa.io/en/stable/user_guide#requirements-files>`__ in the pip documentation.
128129

129130
Create an Estimator
130131
===================
@@ -241,7 +242,8 @@ Before a model can be served, it must be loaded. The SageMaker Scikit-learn mode
241242

242243
.. code:: python
243244
244-
def model_fn(model_dir)
245+
def model_fn(model_dir):
246+
...
245247
246248
SageMaker will inject the directory where your model files and sub-directories, saved by ``save``, have been mounted.
247249
Your model function should return a model object that can be used for model serving.
@@ -334,14 +336,16 @@ it should return an object that can be passed to ``predict_fn`` and have the fol
334336

335337
.. code:: python
336338
337-
def input_fn(request_body, request_content_type)
339+
def input_fn(request_body, request_content_type):
340+
...
338341
339-
Where ``request_body`` is a byte buffer and ``request_content_type`` is a Python string
342+
where ``request_body`` is a byte buffer and ``request_content_type`` is a Python string.
340343

341344
The SageMaker Scikit-learn model server provides a default implementation of ``input_fn``.
342345
This function deserializes JSON, CSV, or NPY encoded data into a NumPy array.
343346

344-
Default NPY deserialization requires ``request_body`` to follow the `NPY <https://docs.scipy.org/doc/numpy/neps/npy-format.html>`_ format. For Scikit-learn, the Python SDK
347+
Default NPY deserialization requires ``request_body`` to follow the
348+
`NPY <https://docs.scipy.org/doc/numpy/neps/npy-format.html>`_ format. For Scikit-learn, the Python SDK
345349
defaults to sending prediction requests with this format.
346350

347351
Default json deserialization requires ``request_body`` contain a single json list.
@@ -383,7 +387,8 @@ The ``predict_fn`` function has the following signature:
383387

384388
.. code:: python
385389
386-
def predict_fn(input_object, model)
390+
def predict_fn(input_object, model):
391+
...
387392
388393
Where ``input_object`` is the object returned from ``input_fn`` and
389394
``model`` is the model loaded by ``model_fn``.
@@ -426,7 +431,8 @@ The ``output_fn`` has the following signature:
426431

427432
.. code:: python
428433
429-
def output_fn(prediction, content_type)
434+
def output_fn(prediction, content_type):
435+
...
430436
431437
Where ``prediction`` is the result of invoking ``predict_fn`` and
432438
``content_type`` is the InvokeEndpoint requested response content-type.
@@ -481,38 +487,39 @@ To see what arguments are accepted by the ``SKLearnModel`` constructor, see :cla
481487
Your model data must be a .tar.gz file in S3. SageMaker Training Job model data is saved to .tar.gz files in S3,
482488
however if you have local data you want to deploy, you can prepare the data yourself.
483489

484-
Assuming you have a local directory containg your model data named "my_model" you can tar and gzip compress the file and
490+
Assuming you have a local directory containing your model data named "my_model", you can tar and gzip compress the file and
485491
upload to S3 using the following commands:
486492

487-
::
493+
.. code::
488494
489495
tar -czf model.tar.gz my_model
490496
aws s3 cp model.tar.gz s3://my-bucket/my-path/model.tar.gz
491497
492498
This uploads the contents of my_model to a gzip compressed tar file to S3 in the bucket "my-bucket", with the key
493499
"my-path/model.tar.gz".
494500

495-
To run this command, you'll need the aws cli tool installed. Please refer to our `FAQ <#FAQ>`__ for more information on
501+
To run this command, you'll need the AWS CLI tool installed. Please refer to our `FAQ <#FAQ>`__ for more information on
496502
installing this.
497503

498504
******************************
499505
Scikit-learn Training Examples
500506
******************************
501507

502-
Amazon provides an example Jupyter notebook that demonstrate end-to-end training on Amazon SageMaker using Scikit-learn:
503-
504-
https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-python-sdk
508+
To find example notebooks that demonstrate end-to-end training on Amazon SageMaker using Scikit-learn,
509+
see the `Amazon SageMaker example notebooks repository
510+
<https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-python-sdk>`_.
505511

506512
These are also available in SageMaker Notebook Instance hosted Jupyter notebooks under the "sample notebooks" folder.
507513

508514
******************************
509-
SageMaker scikit-learn Classes
515+
SageMaker Scikit-learn Classes
510516
******************************
511517

512-
For information about the different scikit-learn classes in the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/sagemaker.sklearn.html.
518+
For information about the different Scikit-learn classes in the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/sagemaker.sklearn.html.
513519

514520
****************************************
515521
SageMaker Scikit-learn Docker Containers
516522
****************************************
517523

518-
You can visit the SageMaker Scikit-Learn containers repository here: https://github.com/aws/sagemaker-scikit-learn-container
524+
To find the SageMaker-managed Scikit-learn containers,
525+
visit the `SageMaker Scikit-Learn containers repository <https://github.com/aws/sagemaker-scikit-learn-container>`_.

0 commit comments

Comments
 (0)