Skip to content

Commit 526bca1

Browse files
committed
Updates to docs
1 parent ded8eed commit 526bca1

11 files changed

+178
-225
lines changed

README.md

Lines changed: 72 additions & 149 deletions
Large diffs are not rendered by default.

docs/API_CONFIGURATION.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# API and Testing infrastructure Configuration
2+
3+
The API and Testing infrastructure stack reads configuration from context values in `cdk.json`. These values can also be override by passing arguments to the cdk deploy command eg:
4+
5+
```
6+
cdk deploy ab-testing-api -c stage_name=dev -c endpoint_prefix=sagemaker-ab-testing-pipeline
7+
```
8+
9+
Following is a list of the context parameters and their defaults.
10+
11+
| Property | Description | Default |
12+
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
13+
| `api_name` | The API Gateway Name | "ab-testing" |
14+
| `stage_name` | The stage namespace for resource and API Gateway path | "dev" |
15+
| `endpoint_prefix` | A prefix to filter Amazon SageMaker endpoints the API can invoke. | "sagemaker-" |
16+
| `api_lambda_memory` | The [lambda memory](https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html) allocation for API endpoint. | 768 |
17+
| `api_lambda_timeout` | The lambda timeout for the API endpoint. | 10 |
18+
| `metrics_lambda_memory` | The [lambda memory](https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html) allocated for metrics processing Lambda | 768 |
19+
| `metrics_lambda_timeout` | The lambda timeout for the processing lambda. | 10 |
20+
| `dynamodb_read_capacity` | The [Read Capacity](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html) for the DynamoDB tables | 5 |
21+
| `dynamodb_write_capacity` | The [Write Capacity](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html) for the DynamoDB tables | 5 |
22+
| `delivery_sync` | When`true` metrics will be written directly to DynamoDB, instead of the Amazon Kinesis for processing. | false |
23+
| `firehose_interval` | The [buffering](https://docs.aws.amazon.com/firehose/latest/dev/create-configure.html) interval in seconds which firehose will flush events to S3. | 60 |
24+
| `firehose_mb_size` | The buffering size in MB before the firehose will flush its events to S3. | 1 |
25+
| `log_level` | Logging level for AWS Lambda functions | "INFO" |

docs/CONTRIBUTING.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

docs/CUSTOM_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Customize the Deployment Pipeline
2+
3+
The [ab-testing-pipeline.yml](../ab-testing-pipeline.yml) is included as part of this distribution, and doesn't require updating unless you change the `infra/pipeline_stack.py` implementation.
4+
5+
To generate a new pipeline you can run the following command.
6+
7+
```
8+
cdk synth ab-testing-pipeline --path-metadata=false > ab-testing-pipeline.yml
9+
```
10+
11+
This template will output a new Policy to attach to the `AmazonSageMakerServiceCatalogProductsUseRole` service role. This policy is not required as this managed role already has these permissions. In order for this to run within Amazon SageMaker Studio, you will need to remove this policy. I recommend you diff the original to see where changes need to be made. If there are additional roles or policies the project might not be validate when used inside of Amazon SageMaker Studio.
12+
13+
```
14+
git diff ab-testing-pipeline.yml
15+
```
File renamed without changes.

OPERATIONS.md renamed to docs/OPERATIONS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ In addition to the above, you must specify the `champion` and `challenger` model
4949

5050
These will be loaded from the two Model Package Groups in the registry that include the project name and suffixed with `champion` or `challenger` for example project name `ab-testing-pipeline` these model package groups in the sample notebook:
5151

52-
![\[Model Registry\]](docs/ab-testing-pipeline-model-registry.png)
52+
![\[Model Registry\]](ab-testing-pipeline-model-registry.png)
5353

5454
**Latest Approved Versions**
5555

@@ -238,4 +238,4 @@ The API Lambda functions are instrumented with [AWS X-Ray](https://aws.amazon.co
238238
* Amazon SageMaker
239239
* Kinesis Firehose
240240

241-
![\[AB Testing Pipeline X-Ray\]](docs/ab-testing-pipeline-xray.png)
241+
![\[AB Testing Pipeline X-Ray\]](ab-testing-pipeline-xray.png)

docs/SERVICE_CATALOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# AWS Service Catalog Provisioning
2+
3+
If you have an existing AWS Service Catalog Portfolio, or would like to create the Product manually, follow these steps:
4+
5+
1. Sign in to the console with the data science account.
6+
2. On the AWS Service Catalog console, under **Administration**, choose **Portfolios**.
7+
3. Choose **Create a new portfolio**.
8+
4. Name the portfolio `SageMaker Organization Templates`.
9+
5. Download the [AB testing template](../ab-testing-pipeline.yml) to your computer.
10+
6. Choose the new portfolio.
11+
7. Choose **Upload a new product.**
12+
8. For **Product name**¸ enter `A/B Testing Deployment Pipeline`.
13+
9. For **Description**, enter `Amazon SageMaker Project for A/B Testing models`.
14+
10. For **Owner**, enter your name.
15+
11. Under **Version details**, for **Method**, choose **Use a template file**.
16+
12. Choose **Upload a template**.
17+
13. Upload the template you downloaded.
18+
14. For **Version title**, enter `1.0`.
19+
20+
The remaining parameters are optional.
21+
22+
15. Choose **Review**.
23+
16. Review your settings and choose **Create product**.
24+
17. Choose **Refresh** to list the new product.
25+
18. Choose the product you just created.
26+
19. On the **Tags** tab, add the following tag to the product:
27+
- **Key**`sagemaker:studio-visibility`
28+
- **Value**`True`
29+
30+
Finally we need to add launch constraint and role permissions.
31+
32+
20. On the **Constraints** tab, choose Create constraint.
33+
21. For **Product**, choose **AB Testing Pipeline** (the product you just created).
34+
22. For **Constraint type**, choose **Launch**.
35+
23. Under **Launch Constraint**, for **Method**, choose **Select IAM role**.
36+
24. Choose **AmazonSageMakerServiceCatalogProductsLaunchRole**.
37+
25. Choose **Create**.
38+
26. On the **Groups, roles, and users** tab, choose **Add groups, roles, users**.
39+
27. On the **Roles** tab, select the role you used when configuring your SageMaker Studio domain.
40+
28. Choose **Add access**.
41+
42+
If you don’t remember which role you selected, in your data science account, go to the SageMaker console and choose **Amazon SageMaker Studio**. In the Studio **Summary** section, locate the attribute **Execution role**. Search for the name of this role in the previous step.
15.9 KB
Loading
-58 KB
Loading

lambda/api/algorithm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import random
22
import math
33

4-
# Consider modify these algorithms to be random operators that could be used with PlanOut
5-
# see: https://facebook.github.io/planout/docs/random-operators.html
4+
# Contains pure python class implementations for WeightedSampling, EpsilonGreedy, UCB1 and ThompsonSampling.
5+
# For maths and theory behind these algorithms see the following resource:
6+
# https://lilianweng.github.io/lil-log/2018/01/23/the-multi-armed-bandit-problem-and-its-solutions.html#ucb1
67

78

89
class AlgorithmBase:
@@ -13,7 +14,7 @@ class AlgorithmBase:
1314
3. Thompson Smampling
1415
"""
1516

16-
def __init__(self, variant_metrics):
17+
def __init__(self, variant_metrics: list):
1718
pass
1819

1920
@staticmethod

0 commit comments

Comments
 (0)