{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Getting Started\n", "\n", "The Purpose of this game day is to learn how to quickly develop and deploy machine learning models in a competitive environment. We will do this by developing models to play the game battleship!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Game Description and Rules\n", "Your team will create ML models to play \"AI Command\" which is like battleships! (as in \"you sunk my battleship!\") Each team will have a board they place their ships on and will try to guess the placement of the opposing team's ships. During each round of guess, the teams will pick a location on the opposing teams board which will be revealed as either a hit or miss. The first team to find all of the opposing teams ships wins!\n", "\n", "In order to play the game, each team will need to create two ML models: a layout model that places ships on the board and a shoot model the guesses locations of the other teams ships. \n", "\n", "\n", "### Rules\n", "- __Board__: Each team in each game will place their ships on a rectangular game board and then guess/shoot the opposing ships board. Board size will be given to you. \n", "- __Layout__:\n", " - Ships: Ships can be __any shape__ as long as they follow the constraints given for the scenario. The details of these constraints will be in the Layout Endpoint Instructions\n", "- __shoot__: Teams will take one shot at a time until one of the following happens:\n", " 1. One team sinks all the ships of the opposing team\n", " 2. The max number of shooting rounds is reached. The Max number of shooting rounds is equal to the area of the game board. So if a Game Board is 10x10 then there are max 100 shots per team per game\n", "- __Scoring__: team scores will be tracked along three dimensions\n", " 1. Games Won\n", " 1. Total number of hits against opponents \n", " 1. Total number of hits by opponents" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Architecture\n", "\n", "\n", "\n", "The engine for game works like this:\n", "1. An [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/) alarm triggers the __launcher lambda__ every 30s (or some other time interval)\n", "2. The Launcher Lambda reads from the __team [Amazon DynamoDB](https://aws.amazon.com/dynamodb/) table__ (which is written to when you register your team) and writes to the Game SQS queue where game config for each pair of teams is stored. \n", "3. The __Game lambda__ reads objects from the game queue and runs each game by\n", " 1. calling each teams __layout endpoint__\n", " 2. repeatedly calling each teams __shoot endpoint__ and updating score\n", " 3. when the game is finished, it writes the game data to the __game [Amazon DynamoDB](https://aws.amazon.com/dynamodb/) table__\n", " 4. if there are any errors from the teams, it writes the error to the team's __error SNS topic__\n", "4. The __game DynamoDb__ table streams to the stream lambda which:\n", " 1. writes the game data to an __Amazon Kinesis Firehose__ which writes the data to an __S3 bucket__ (for the teams to consume and download) and an __Elasticsearch database__ (for the game admins to debug).\n", " 1. when new data is written to the S3 bucket a __SNS topic__ is trigger to notify teams of new data\n", " 2. writes the score updates to a __redis cluster__" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Set Up\n", "Your teams success will depend on:\n", "\n", "- Ability to work together \n", "- Ability to deploy models quickly\n", "- Use time effectively\n", "- ML knowledge\n", "\n", "\n", "\n", "### Organize your Team\n", "To help your team work together and deploy models quickly, we recommend that you organize your team into three groups: Operations, Defense, and Offense. Each group will have their own skills and responsibilities and will work with the other groups to win the game. \n", "\n", "\n", "1. __Defensive Group__: Responsible for researching and developing the Layout endpoint. Members who have strong data science skills or python programing skills will do well in this team.\n", "1. __Offensive Group__: Responsible for researching and developing the Shooting endpoint. Members with strong machine learning skills will do will in this team.\n", "1. __Operations__: Members who do not fit well into the Offensive of Defensive Groups can work in this group: \n", " 1. Managing/Deploying the Infrastructure \n", " 2. Deploying models\n", " 3. Communicating errors and feedback to Layout and Shoot groups\n", "\n", "You also need to give your team a name! \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Schedule\n", "To help your team use your time effectively, we suggest the following schedule for your team and each group. We also recommend you work in \"small batch sizes\". Try to do many small changes and deployments quickly instead of doing a few large deployments.\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Code \n", "\n", "### Organization\n", "The code required should already be installed onto your SageMaker notebook instance. The root directory of the project is in /home/ec2-user/SageMaker/GameDayRepo and any paths given in any following notebooks will be relative to this directory. In the root of the project there are a couple of directories and files to be aware of\n", "\n", "\n", "```\n", "bin/ #A directory of scripts to help you with common tasks\n", "├── athena_info.sh\n", "├── register_outputs.sh\n", "├── startPipeline.js\n", "├── testLayout.py\n", "├── testShoot.py\n", "├── upload_code.sh\n", "├── download_data.sh\n", "└── upload_data.sh\n", "\n", "layout-config.json # Deploy/Train config for layout endpoint\n", "shoot-config.json # Deploy/Train config for shoot endpoint\n", "\n", "containers/ #contains all the code for you Amazon [Amazon Sagemaker](https://aws.amazon.com/sagemaker/) training jobs and endpoints\n", "├── Layout # code for the layout endpoint\n", "│   ├── 2vs3\n", "│   │   ├── host.py\n", "│   │   ├── test.py\n", "│   │   └── train.py\n", "└── Shoot # code for the shoot endpoint\n", " ├── CNN # code for Deep learning CNN model\n", " │   ├── cnn.py\n", " │   ├── host.py\n", " │   ├── mock\n", " │   │   ├── data # directory to put sample data for local testing\n", " │   │   └── out\n", " │   ├── test.py\n", " │   ├── train.py\n", " ├── line # code for line shooting model\n", " │   ├── host.py\n", " │   ├── test.py\n", " │   └── train.py\n", " \n", "notebooks/ # Jupyter notebooks/Tutorials for your team to help you through the day\n", "├── Athena.ipynb\n", "├── Endpoint_Reference.ipynb\n", "├── defense\n", "│   ├── Analytics.ipynb\n", "│   └── getting_started.ipynb\n", "├── getting_started.ipynb\n", "├── offensive\n", "│   ├── CNN.ipynb\n", "│   └── getting_started.ipynb\n", "└── operations\n", " └── getting_started.ipynb\n", " \n", "data/ # Directory where the game data is downloaded and saved to.\n", "```\n", "\n", "### Deployment\n", "Each group will work in an [Amazon Sagemaker](https://aws.amazon.com/sagemaker/) notebook instance. The following diagrams shows how each notebook push or pulls changes to the main codecommit repo (this repo was already created for you)\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Break into your groups!\n", "break into your three groups and work through the corresponding tutorials\n", "\n", "- [Operations Notebook](./operations/getting_started.ipynb)\n", "- [Offensive Notebook](./offensive/getting_started.ipynb)\n", "- [Defensive Notebook](./defense/getting_started.ipynb)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "conda_python3", "language": "python", "name": "conda_python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }