## Layout of the SageMaker ModelBuild Project Template
The template provides a starting point for bringing your SageMaker Pipeline development to production.
```
|-- codebuild-buildspec.yml
|-- CONTRIBUTING.md
|-- pipelines
| |-- autopilot
| | |-- evaluate.py
| | |-- __init__.py
| | |-- pipeline.py
| | `-- preprocess.py
| |-- get_pipeline_definition.py
| |-- __init__.py
| |-- run_pipeline.py
| |-- _utils.py
| `-- __version__.py
|-- README.md
|-- sagemaker-pipelines-project.ipynb
|-- setup.cfg
|-- setup.py
```
## Start here
This is a sample code repository that demonstrates how you can organize your code for an ML business solution. This code repository is created as part of creating a Project in SageMaker.
In this example, we are solving the adult data set class prediction problem using the UCI adult dataset (see below for more on the dataset). The following section provides an overview of how the code is organized and what you need to modify. In particular, `pipelines/pipelines.py` contains the core of the business logic for this problem. It has the code to express the ML steps involved in generating an ML model. You will also find the code for that supports preprocessing and evaluation steps in `preprocess.flow` and `evaluate.py` files respectively.
Once you understand the code structure described below, you can inspect the code and you can start customizing it for your own business case. This is only sample code, and you own this repository for your business use case. Please go ahead, modify the files, commit them and see the changes kick off the SageMaker pipelines in the CICD system.
You can also use the `sagemaker-pipelines-project.ipynb` notebook to experiment from SageMaker Studio before you are ready to checkin your code.
A description of some of the artifacts is provided below:
Your codebuild execution instructions. This file contains the instructions needed to kick off an execution of the SageMaker Pipeline in the CICD system (via CodePipeline). You will see that this file has the fields definined for naming the Pipeline, ModelPackageGroup etc. You can customize them as required.
```
|-- codebuild-buildspec.yml
```
Your pipeline artifacts, which includes a pipeline module defining the required `get_pipeline` method that returns an instance of a SageMaker pipeline, a preprocessing script that is used in feature engineering, and a model evaluation script to measure the Mean Squared Error of the model that's trained by the pipeline. This is the core business logic, and if you want to create your own folder, you can do so, and implement the `get_pipeline` interface as illustrated here.
```
|-- pipelines
| |-- autopilot
| | |-- evaluate.py
| | |-- __init__.py
| | |-- pipeline.py
| | `-- preprocess.flow
```
Utility modules for getting pipeline definition jsons and running pipelines (you do not typically need to modify these):
```
|-- pipelines
| |-- get_pipeline_definition.py
| |-- __init__.py
| |-- run_pipeline.py
| |-- _utils.py
| `-- __version__.py
```
Python package artifacts:
```
|-- setup.cfg
|-- setup.py
```
## Dataset for the Example Autopilot Pipeline
The dataset used is the [UCI Machine Learning Adult Data Set](https://archive.ics.uci.edu/ml/datasets/adult) [1]. Prediction task is to determine whether a person makes over 50K a year.
The dataset contains several features - age of the adult, education, workclass, marital-status, occupation, race, sex, capital gain & loss, hours per week and native country.
We'll upload the data to a bucket we own. But first we gather some constants we can use later throughout the notebook.
[1] Dua, D. and Graff, C. (2019). [UCI Machine Learning Repository](http://archive.ics.uci.edu/ml). Irvine, CA: University of California, School of Information and Computer Science.