Model development with Databases
Decision Optimization model development process requires data so that different model formulations can be tested. While some people always prefer to work with local files snapshots (e.g. CSV files), it is sometimes very useful to directly connect the model development tools to databases. This is now very easy to do in Decision Optimization for Watson Studio.
Following these simple steps, you will be able, within a few minutes, to test the data connection into the Decision Optimization in Watson Studio model builder Beta.
The three steps are:
- Create a DB with some data
- Connect data from a Watson Studio project
- Create a DO model and use this data
1. Create a DB on Cloud Trial instance
One easy way to test the DB connection from the model builder is to use some trial DB2 on cloud instance. You can do this here: https://cloud.ibm.com/catalog/services/db2.
After you create the free trial instance, you should go into the instance and create some credentials that you will need to connect from Watson Studio.
Note than from IBM Cloud, you can also access a console to easily create and explore your database. You can even drop data file to create tables, so just drop your preferred CSV files.
2. Create Watson Studio connections and connected data
In a Watson Studio project, the first thing to do is to create a new connection.
Among the possible types of connection, choose DB2 on cloud.
in the last screen, you enter your credentials copied previously:
Once the connection is created, you can create as many connected data on different tables using this connection.
In the project create new connected data:
In the next screen you can choose your connection and explore to select the table you want to connect.
3. Use connected data in the model builder
The last step if to create an optimization model using the model builder. This post provides some quick start hints..
In the data preparation step, the connected data will appear as candidates to be imported.
As you import connected data into a scenario, a snapshot of the DB table is taken. That ensures the data is not modified under the hood. If you want to take another snapshot, just re-import this connected data and select replacement option.
All model builder functionality is compatible with connected data, you can create different scenarios, create visualizations, with OPL, Python or the Modeling Assistant.
Deployment
When models are deployed to be integrated into production application, you can still use connected data. For that, use reference data instead of inline data in the job creation payload (or in the python configuration). The structure is described in this documentation.
alain.chabrier@ibm.com