Skip to content

doc: add link to Amazon algorithm estimator parent class to clarify **kwargs #1179

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

Merged
merged 6 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
20 changes: 16 additions & 4 deletions src/sagemaker/amazon/amazon_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/factorization_machines.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/ipinsights.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/kmeans.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/knn.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/lda.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/linear_learner.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/ntm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/object2vec.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/pca.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/sagemaker/amazon/randomcutforest.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__(
Expand Down