The goal of this challenge is to build a regression model and deploy it with docker. The dataset you will use for the challenge is available at https://archive.ics.uci.edu/ml/datasets/Energy+efficiency. You should be able to run the docker image and then curl the container by sending json containing the attributes of a new building and get a json response with the heating and cooling loads predicted by your trained model. The code should be written in python but you can use whichever libraries you like to train and deploy the model
I built a simple multivariate, Lasso model with Scikit-learn that is served with Flask.
You can see the notebook used to train the model at https://9whioydhmb.execute-api.us-east-1.amazonaws.com/carbonrelay.
Model can be tested by posting a dictionary of input values to an AWS endpoint, e.g.:
curl -d '{
"relative_compactness": 0.98,
"surface_area": 514.5,
"wall_area": 294.0,
"roof_area": 110.25,
"overall_height": 7.0,
"orientation": 2.0,
"glazing_area": 0.0,
"glazing_area_distribution": 0.0
}' -H 'Content-Type: application/json' https://9whioydhmb.execute-api.us-east-1.amazonaws.com/carbonrelay/predict
HTTP response is JSON containing an heating_load
and cooling_load
field.
- Running Docker client
Run $ docker-compose up
to train model and open webserver on port 5000. Once this completes, you
should be able to run:
curl -d '{
"relative_compactness": 0.98,
"surface_area": 514.5,
"wall_area": 294.0,
"roof_area": 110.25,
"overall_height": 7.0,
"orientation": 2.0,
"glazing_area": 0.0,
"glazing_area_distribution": 0.0
}' -H 'Content-Type: application/json' http://127.0.0.1:5000/predict
You can also view the Jupyter notebook with training information and model performance information at http://127.0.0.1:5000/.