In this Project, we are a given dataset (Bank-marketing dataset) which is trained using Azure ML. The completed model is then deployed and the endpoint is consumed.
The steps include:
-
Loading the given dataset and importing to Azure ML studio
-
Running the Automated ML experiment with the dataset and finding the best performing model with maximum accuracy.
-
To select the Best Model from the top performing models in Auto ML and deploying them.
-
Enabling Application insights in order to check performance of the deployed model's endpoint.
-
Swagger.json file is used for POST requests in the local host. This is done to see if the model is reponsive with POST requests.
-
Consuming the model by running endpoint.py file which will take features from the swagger.json file.
-
Enabling an automated ML pipeline.
This step was not needed as a Virtual Machine was used where the authentication was already done.
Data
The dataset used in this project can be found here.
This dataset is first registered in the Auto ML Studio, shown in the image below.
The ML experiment run in ML Studio is completed, as shown in the image below.
After the experiment is completely run, few of the best performing models are listed with the highest accuracies. The top model is shown in the image below:
The best model is selected from the Auto ML model.
The accuracy is close to 92% which shows that this model will be perfect for our dataset. The image below shows the details of the best chosen model.
After deploying the model we need to enable the application insights. The configuration information in the form of config.json can be downloaded from the subscription of ML Studio. Then, keeping the config.json file in the same directory of the project, we can run the log.py file after adding the system.update(enable_application_insights=TRUE).
After running logs.py:
This will enable the application insights of our model.
The swagger.json file is downloaded from the deployed model's details. This file is then kept inside the swagger file of the project directory with swagger.sh and serve.py file.
The swagger.sh is run to check if the POST requests are responsive. The serve.py is executed the POST request.
The contents of the page running in the localhost are shown below:
The restAPI URI and the primary key can be obtained from the deployed model as shown in the image below.
In the endpoint.py file, the rest API and primary key should be copied from the model and replaced in the variables 'scoring_uri' and 'key'.
The endpoint.py is executed against the API producing JSON output from the model. The image below shows the action:
The automation of model experiments and deployment are shown in this section.
After loading the starter code and filling out the necessary model names, workspaces and clusters used, a new pipepline is created. The pipeline created successfully is shown in the Pipeline bar:
The Completed Pipeline Graph:
Published Model Endpoint:
Rest Endpoint shown to be ACTIVE:
Pipeline Run-Widget:
Bankmarketing Dataset in the AutoML module:
Scheduled Pipeline Run:
The pipeline is shown to be "Active" from the image below.
The screencast of the project in given here.