Auto generate a modern web application to showcase your KNIME models

Prakash Gupta
5 min readMay 10, 2020

KNIME is a free and open source data analytics, reporting and integration platform. It allows us to create workflows to ingest data, analyse it, pre-process, train and build Data Science models. It has great support for exporting different kinds of models built on its platform into PMML format.

In this article we will

  • Create a workflow in KNIME to load Bank Marketing Dataset and train a Gradient Boosting model to predict recommendations for the next marketing campaign for the bank.
  • Export above model to a PMML file.
  • Deploy above PMML on Clouderizer Showcase and auto generate a cool scoring web front end application.

Pre-requisites

Building Model

  • Launch KNIME and go to File -> New -> New KNIME Workflow to create a new project. Give it a name BankMarketing.
  • First we need to load our data. From the bottom left Node Repository, search for File Reader and drag it to your project canvas. Double click on this node to open its configuration. Browse and select the dataset file bank.csv here.
  • Bank dataset contains many fields as strings. These string inputs need to be converted into enums for ML models to consume them. We will need to add a Domain Calculator node for this. Search for it from Node Repository and drag in front of File Reader node. Then connect output of File Reader to input of Domain Calculator. No configuration is needed for this node.
  • We will now add a Gradient Boosted Trees Learner (Classification) node to train our model. Search for it from the Node Repository and drag it in front of the Domain Calculator and connect it. Now double click on this node to configure it. Target column is the field we want to predict. Select Y for target column. This is the column which states whether the bank should target this customer for the next marketing campaign or not. Also, attribute duration has very high influence on the output so we will exclude it from training.
  • We will now add two more nodes to our workflow, Gradient Boosted Trees to PMML and PMML Writer. This is to export our trained model into a PMML file. Double click on PMML writer and specify the output file path.
  • Great. Our workflow is now ready. We can press the Execute All button to run all nodes. Once run successfully, our model will be built and saved in PMML file format.

Deploy the Model

  • Login to your Clouderizer console and go to the Showcase section.
  • Press New Project to create a new project. Give it a name “BankMarketing KNIME” and some description.
  • Select PMML as model type and press Next. Upload the PMML file built above on the next screen and press Finish.
  • This should upload your model to Clouderizer. Once upload is complete, Clouderizer will auto parse the model and show model inputs. These inputs will match exactly with the fields we have in our original dataset. Press Save.
  • Press Deploy on the top right corner of the Showcase project page. This will show us options where we can deploy our model. If we have linked our Clouderizer account with our AWS or GCP account, we can deploy this model to AWS or GCP in one click.
  • We can also deploy our model on our local Ubuntu or Mac machine. Press Mac from the menu above. This will show a bash command to deploy this model on your local machine. Copy this command and run it on a bash terminal on your Mac

Note: Docker is a prerequisite to run Clouderizer Showcase projects locally on Ubuntu or Mac

  • Once you run the bash command, Clouderizer Showcase project will start showing “Deploying” status. It takes around a minute for the project to get deployed (it might take a little more on first run as docker image will get downloaded).
  • Once deployment is complete, you should see a Showcase URL on the bottom left of your Clouderizer project.

That’s it! Your BankMarketing model is now deployed. With above few steps, Clouderizer Showcase did the following for you behind the scenes

  • Deploy your model on cloud infra of your choice (or your local machine) behind a robust, fault tolerant, fast, REST API server.
  • Auto generated an out of box scoring web UI on top of the REST API server for you to easily try out and showcase your model to your team, customers and patrons.
  • Set Up an analytics pipeline to keep a historical record of all input requests made to your model. This historical input list can be viewed from Showcase project -> Analytics.

Feel free to try Clouderizer Showcase for your model deployment and in case you have any query, you can post it on our forum here.

--

--

Prakash Gupta

Passionate about designing and developing scalable software platforms.