From 71ccc13626f9af7090b4c9ce189d8c7548731e83 Mon Sep 17 00:00:00 2001 From: Lauren Yu <6631887+laurenyu@users.noreply.github.com> Date: Fri, 13 Dec 2019 12:27:01 -0800 Subject: [PATCH] doc: add link to Amazon algorithm estimator parent class to clarify **kwargs This commit also fixes some minor Sphinx syntax issues in the docstrings. --- src/sagemaker/amazon/amazon_estimator.py | 20 +++++++++++++++---- .../amazon/factorization_machines.py | 8 +++++++- src/sagemaker/amazon/ipinsights.py | 8 +++++++- src/sagemaker/amazon/kmeans.py | 8 +++++++- src/sagemaker/amazon/knn.py | 8 +++++++- src/sagemaker/amazon/lda.py | 8 +++++++- src/sagemaker/amazon/linear_learner.py | 8 +++++++- src/sagemaker/amazon/ntm.py | 8 +++++++- src/sagemaker/amazon/object2vec.py | 8 +++++++- src/sagemaker/amazon/pca.py | 8 +++++++- src/sagemaker/amazon/randomcutforest.py | 8 +++++++- 11 files changed, 86 insertions(+), 14 deletions(-) diff --git a/src/sagemaker/amazon/amazon_estimator.py b/src/sagemaker/amazon/amazon_estimator.py index 6ff9275a50..d7b1d06854 100644 --- a/src/sagemaker/amazon/amazon_estimator.py +++ b/src/sagemaker/amazon/amazon_estimator.py @@ -49,15 +49,27 @@ def __init__( """Initialize an AmazonAlgorithmEstimatorBase. Args: - role: - train_instance_count: - train_instance_type: + role (str): An AWS IAM role (either name or full ARN). The Amazon + SageMaker training jobs and APIs that create Amazon SageMaker + endpoints use this role to access training data and model + artifacts. After the endpoint is created, the inference code + might use the IAM role, if it needs to access an AWS resource. + train_instance_count (int): Number of Amazon EC2 instances to use + for training. + train_instance_type (str): Type of EC2 instance to use for training, + for example, 'ml.c4.xlarge'. data_location (str or None): The s3 prefix to upload RecordSet objects to, expressed as an S3 url. For example "s3://example-bucket/some-key-prefix/". Objects will be saved in a unique sub-directory of the specified location. If None, a default data location will be used. - **kwargs: + **kwargs: Additional parameters passed to + :class:`~sagemaker.estimator.EstimatorBase`. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.EstimatorBase`. """ if "enable_network_isolation" in kwargs: diff --git a/src/sagemaker/amazon/factorization_machines.py b/src/sagemaker/amazon/factorization_machines.py index 4ae36d5697..c4122f9c6c 100644 --- a/src/sagemaker/amazon/factorization_machines.py +++ b/src/sagemaker/amazon/factorization_machines.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -205,6 +205,12 @@ def __init__( that takes effect when factors_init_method parameter is 'constant'. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(FactorizationMachines, self).__init__( role, train_instance_count, train_instance_type, **kwargs diff --git a/src/sagemaker/amazon/ipinsights.py b/src/sagemaker/amazon/ipinsights.py index 3b4e6bd930..148fda761f 100644 --- a/src/sagemaker/amazon/ipinsights.py +++ b/src/sagemaker/amazon/ipinsights.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -119,6 +119,12 @@ def __init__( weight_decay (float): Optional. Weight decay coefficient. Adds L2 regularization. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(IPInsights, self).__init__(role, train_instance_count, train_instance_type, **kwargs) self.num_entity_vectors = num_entity_vectors diff --git a/src/sagemaker/amazon/kmeans.py b/src/sagemaker/amazon/kmeans.py index bac1758c61..bcbac8c47b 100644 --- a/src/sagemaker/amazon/kmeans.py +++ b/src/sagemaker/amazon/kmeans.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -135,6 +135,12 @@ def __init__( is provided, the score shall be reported in terms of all requested metrics. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(KMeans, self).__init__(role, train_instance_count, train_instance_type, **kwargs) self.k = k diff --git a/src/sagemaker/amazon/knn.py b/src/sagemaker/amazon/knn.py index 4c1e4ee4b0..aaf5c169a5 100644 --- a/src/sagemaker/amazon/knn.py +++ b/src/sagemaker/amazon/knn.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -128,6 +128,12 @@ def __init__( faiss_index_pq_m (int): Optional. Number of vector sub-components to construct in the index, if index_type is "faiss.IVFPQ". **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(KNN, self).__init__(role, train_instance_count, train_instance_type, **kwargs) diff --git a/src/sagemaker/amazon/lda.py b/src/sagemaker/amazon/lda.py index a92994a2b8..39a2e932ca 100644 --- a/src/sagemaker/amazon/lda.py +++ b/src/sagemaker/amazon/lda.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -106,6 +106,12 @@ def __init__( tol (float): Optional. Target error tolerance for the ALS phase of the algorithm. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ # this algorithm only supports single instance training if kwargs.pop("train_instance_count", 1) != 1: diff --git a/src/sagemaker/amazon/linear_learner.py b/src/sagemaker/amazon/linear_learner.py index c581de0ef3..edb22d9e76 100644 --- a/src/sagemaker/amazon/linear_learner.py +++ b/src/sagemaker/amazon/linear_learner.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -318,6 +318,12 @@ def __init__( which give each class equal importance in the loss function. Only used when predictor_type is multiclass_classifier. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(LinearLearner, self).__init__( role, train_instance_count, train_instance_type, **kwargs diff --git a/src/sagemaker/amazon/ntm.py b/src/sagemaker/amazon/ntm.py index fca3eac7f9..5ac46ac215 100644 --- a/src/sagemaker/amazon/ntm.py +++ b/src/sagemaker/amazon/ntm.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -139,6 +139,12 @@ def __init__( regularization. learning_rate (float): Optional. Learning rate for the optimizer. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(NTM, self).__init__(role, train_instance_count, train_instance_type, **kwargs) diff --git a/src/sagemaker/amazon/object2vec.py b/src/sagemaker/amazon/object2vec.py index a3423e6854..d48ffc14bc 100644 --- a/src/sagemaker/amazon/object2vec.py +++ b/src/sagemaker/amazon/object2vec.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -255,6 +255,12 @@ def __init__( enc1_freeze_pretrained_embedding (bool): Optional. Freeze pretrained embedding weights **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(Object2Vec, self).__init__(role, train_instance_count, train_instance_type, **kwargs) diff --git a/src/sagemaker/amazon/pca.py b/src/sagemaker/amazon/pca.py index 84418e198c..d8943b65ee 100644 --- a/src/sagemaker/amazon/pca.py +++ b/src/sagemaker/amazon/pca.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -113,6 +113,12 @@ def __init__( default value equal to the maximum of 10 and num_components will be used. Valid for randomized mode only. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(PCA, self).__init__(role, train_instance_count, train_instance_type, **kwargs) self.num_components = num_components diff --git a/src/sagemaker/amazon/randomcutforest.py b/src/sagemaker/amazon/randomcutforest.py index 2cbf633236..659e4b4d3f 100644 --- a/src/sagemaker/amazon/randomcutforest.py +++ b/src/sagemaker/amazon/randomcutforest.py @@ -1,4 +1,4 @@ -# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of @@ -104,6 +104,12 @@ def __init__( precision, recall, and f1 scores. If test data is provided, the score shall be reported in terms of all requested metrics. **kwargs: base class keyword argument values. + + .. tip:: + + You can find additional parameters for initializing this class at + :class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and + :class:`~sagemaker.estimator.EstimatorBase`. """ super(RandomCutForest, self).__init__(