Last active
September 30, 2019 17:08
-
-
Save Sharadh/fdb6c8ab124b5aabf23d098a768deb0f to your computer and use it in GitHub Desktop.
Amazon Sagemaker + Nerdwallet ML Platform - Blog Post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> nwml train | |
Starting local training for nwpy-ml-iris | |
Loading the ml.train entry point... | |
* Success! | |
... | |
Done! | |
> nwml batch-predict | |
... | |
Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
resources: | |
instance_type: ml.m5.xlarge | |
instance_count: 1 | |
volume_size: 1 | |
input_data_files: | |
- name: train | |
source: s3_prefix | |
uri: <transit-bucket>/test-data/iris/train | |
distribution: full |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> tree | |
. | |
├── Jenkinsfile | |
├── README.md | |
├── VERSION | |
├── app.yml | |
├── data | |
│ ├── batch-predict | |
│ │ └── raw | |
│ │ └── sample.txt | |
│ └── train | |
│ └── raw | |
├── ml.yml | |
├── requirements.txt | |
├── setup.cfg | |
├── setup.py | |
└── src | |
└── nwml | |
├── __init__.py | |
└── iris | |
├── __init__.py | |
└── model.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> indy new python-ml-lib | |
name [your-lib]: iris | |
module_namespace [yourlib]: iris | |
description [Test ML Pipeline]: | |
... | |
Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from setuptools import setup | |
setup( | |
# ... | |
entry_points={ | |
# ... | |
"ml": [ | |
"batch-predict = nwml.iris.model:batch_predict", | |
"load-model = nwml.iris.model:load_model", | |
"save-model = iris.loft.model:save_model", | |
"train = nwml.iris.model:train", | |
], | |
} | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def train(params, inputs, output_dir): | |
"""Train a model from inputs and hyper parameters""" | |
pass | |
def save_model(model_data, output_dir): | |
"""Serialize the model returned by `train` to disk""" | |
pass | |
def load_model(output_dir): | |
"""Load a model from the folder written by `save_model`""" | |
pass | |
def batch_predict(model_data, inputs, output_dir): | |
""" | |
Make batch predictions from a model (from `train` or `load_model`), | |
and some inputs, and write to disk. | |
""" | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment