The application demonstrates usage of IBM Watson Machine Learning Bluemix offering.
Application is based on Node.js and Express framework and utilizes IBM Watson Machine Learning REST API.
Within this sample scoring application you are able to:
Also a custom model can also be used; the requirement is that its input schema matches following schema:
[{"name": "AGE", "type": "integer"},
{"name": "SEX", "type": "string"},
{"name": "BP", "type": "string"},
{"name": "CHOLESTEROL", "type": "string"},
{"name": "NA", "type": "decimal(12,6)"},
{"name": "K", "type": "decimal(13,6)"}]
For a fast start, you can deploy the pre-built app to Bluemix either by clicking the button
or using Watson Machine Learning Dashboard -> Samples -> (+) button.
Note: the application is fully functional only if binded with an instance of IBM Watson Machine Learning service, which needs to be done manually. Check instructions how to do it.
As an alternative to the button, the application can be manually deployed to Bluemix by pushing it with Cloud Foundry commands, as described in next section. Manual deployment is also required when you want to deploy modified source code. Manual deployment consists of pushing the application to Bluemix followed with binding IBM Watson Machine Learning service to deployed application.
To push an application to Bluemix, open a shell, change to directory of your application and execute:
cf api <region>
where <region> part may be https://api.ng.bluemix.net or https://api.eu-gb.bluemix.net depending on the Bluemix region you want to work with (US or Europe, respectively)cf login
which is interactive; provide all required datacf push <app-name>
where <app-name> is the application name of your choicecf push
can also read the manifest file, see Cloud Foundry Documentation. If you decide to use manifest, you can hardcode the name of your instance of IBM Watson Machine Learning service instead of binding it manually, see services section manifest.yml.template file.
If this is your first Bluemix Node.js application, refer documentation of node-helloworld project to gain general experience.
See instructions
Running the application locally is useful when you want to test your changes before deploying them to Bluemix. To see how to work with source code, see Source code changes.
When the changes are ready, open a shell, change directory to your cloned repository and execute npm run build && npm start
to start the application. The running application is available in a browser at http://localhost:6001 url.
Application run locally can also use Bluemix IBM Watson Machine Learning service, see instructions how to link it.
The repository comes with pre-build app. If you want to rebuild application after modifying the sources:
npm install
npm run build
The source code placed in service-client.js file is an example of how to call IBM Watson Machine Learning REST API through JavaScript code. It demonstrates following aspects:
As stated in Requirements section, from Bluemix catalog order an instance of IBM Watson Machine Learning service if you don't yet have it. Next step is to connect your deployed application with service, which is called binding. There are a few options to achieve that in Bluemix environment, link describes binding either by Bluemix user interface or by using cf cli.
npm start
. You should be able to interact with the IBM Watson Machine Learning service e.g. by listing the deployments.The code is available under the Apache License, Version 2.0.