awslabs / predictive-maintenance-using-machine-learning

Set up end-to-end demo architecture for predictive maintenance issues with Machine Learning using Amazon SageMaker
Apache License 2.0
100 stars 58 forks source link

Feature suggestion -- add support to sagemaker endpoint for end2end sample purpose #5

Open racheliurui opened 4 years ago

racheliurui commented 4 years ago

I have tried to workout an end-2-end example with iot events sample, https://github.com/aws-samples/aws-iot-events-accelerators

What I have found is the existing sample for predictive-maintenance only support batch processing to do prediction, while I was trying to add endpoint to the trained model, it failed.

Tried to dig the root reason, sound like the transform_fn function in this sample hardcoded to decode the payload which causing lambda ->apiGateway json payload fail (as while calling the api endpoint, it's trying to passing through json string and won't support binary python json object which is hardcoded in transform_fn function implemented here.

BTW, I don't know why the sample deployed by cfn do not allow me to modify the script, I tried to modify the transform_fn but failed even I gave enough access to the notebook execution role.

vishaalkapoor commented 4 years ago

This is an interesting suggestion. If you do want to modify the AWS Lambda function, you can edit transform_fn in source/notebooks/sagemaker_predictive_maintenance_entry_point/predictive_maintenance_entry_point.py.

Then you can create a package to update Lambda by running build-s3-dist.sh from the deployment directory. You can update Lambda with the package created in deployment/dist.

racheliurui commented 4 years ago

Thanks @vishaalkapoor I will give it a try :)