Model input and output data adaptation (Decision Optimization)
When submitting your job you can include your data inline or reference your data in your request. This data will be mapped to a file named with data identifier and used by the model. The data identifier extension will define the format of the file used.
Note: Including inline credentials to directly access a
data asset is longer be supported and will generate an error. As a replacement, you can use a
connection asset, which stores details of the connection in your deployment space. The connection
can be used along with a particular location that points to your input data. See Implement a new
approach to credentials for Decision Optimization in Watson Machine Learning for more
information.
The following adaptations are supported:
- Tabular inline data to embed your data in your request. For
example:
This will generate the corresponding"input_data": [{ "id":"diet_food.csv", "fields" : ["name","unit_cost","qmin","qmax"], "values" : [ ["Roasted Chicken", 0.84, 0, 10] ] }]diet_food.csvfile that is used as the model input file. Only csv adaptation is currently supported. - Inline data, that is, non-tabular data (such as an OPL
.datfile or an.lpfile) to embed data in your request. For example:"input_data": [{ "id":"diet_food.csv", "content":"Input data as a base64 encoded string" }] - Db2 referenced data (This is now deprecated, see Connection assets) allowing you to
reference data on an “IBM Db2 on Cloud service” instance. Note: Including inline credentials to directly access a data asset is longer be supported and will generate an error. As a replacement, you can use a connection asset, which stores details of the connection in your deployment space. The connection can be used along with a particular location that points to your input data. See Implement a new approach to credentials for Decision Optimization in Watson Machine Learning for more information.For example:
This will generate the corresponding"input_data_references": [{ "id":"diet_food.csv", "type": "db2", "connection": { "host": " XXXXXXXXX", "db": " XXXXXXXXX", "username": "XXXXXXXXX", "password": "XXXXXXXXX" }, "location": { "schemaname": " XXXXXXXXX", "tablename": "diet_food" } }]diet_food.csvfile that is used as the model input file. Only csv adaptation is currently supported. You can find connection information in the Service credentials section of your “IBM DB2 on Cloud Service” page. - COS/S3 referenced data (This is now deprecated, see Connection assets) allowing you to
reference files stored in an “IBM Cloud Object Service” instance. Note: Including inline credentials to directly access a data asset is longer be supported and will generate an error. As a replacement, you can use a connection asset, which stores details of the connection in your deployment space. The connection can be used along with a particular location that points to your input data. See Implement a new approach to credentials for Decision Optimization in Watson Machine Learning for more information.For example:
This will copy the corresponding"input_data_references": [{ "type": "s3", "id": "diet_food.xls", "connection": { "endpoint_url": "https://s3.us-south.cloud-object-storage.appdomain.cloud", "access_key_id": " XXXXXXXXX", "secret_access_key": " XXXXXXXXX" }, "location": { "bucket": "XXXXXXXXX", "path": "diet_food.xls" } }]diet_food.xlsfile that is used as the model input file. You can find connection information in the Service credentials section of your “IBM Cloud Object Service” page. Your service credential entry must be created with the inline configuration parameter:{"HMAC":true}. This configuration parameter will add the following section to instance credentials that are used in connection fields,
The endpoint URL is located on your bucket configuration page, corresponding to your bucket regional endpoint (for example: https://s3-api.us-geo.objectstorage.softlayer.net )"cos_hmac_keys": { "access_key_id": " XXXXXXXXX ", "secret_access_key": " XXXXXXXXX " } - URL referenced data allowing you to reference files stored at a particular URL or REST
data service. For example:
This will copy the corresponding"input_data_references": { "type": "url", "id": "diet_food.csv", "connection": { "verb": "GET", "url": "https://myserver.com/diet_food.csv", "headers": { "Content-Type": "application/x-www-form-urlencoded" } }, "location": {} }diet_food.csvfile that is used as the model input file. - Data assets allowing you to reference any data asset or connected data asset present in
your space and benefit from the data connector integration capabilities. For
example:
With this data asset type there are many different connections available. For more information, see Batch deployment details."input_data_references": [{ "name": "test_ref_input", "type": "data_asset", "connection": {}, "location": { "href": "/v2/assets/ASSET-ID?space_id=SPACE-ID" } }], "output_data_references": [{ "type": "data_asset", "connection": {}, "location": { "href": "/v2/assets/ASSET-ID?space_id=SPACE-ID" } }] - Connection assets allowing you to reference any data and then refer
to the connection, without having to specify credentials each time. Referencing a secure connection
without having to use inline credentials in the payload also offers you better security. See Using
a connection asset to secure credentials for more information.
For example, to connect to a COS/S3 via a Connection asset:
{ "type" : "connection_asset", "id" : "diet_food.csv", "type" : "connection_asset", "connection" : { "id" : <connection_guid> }, "location" : { "file_name" : "FILENAME.csv", "bucket" : "BUCKET-NAME" } }For information about the parameters used in these examples, see Deployment job definitions.
Another example showing you how to connect to a DB2 asset via a connection asset:{ "type" : "connection_asset", "id" : "diet_food.csv", "type" : "connection_asset", "connection" : { "id" : <connection_guid> }, "location" : { "table_name" : "TABLE-NAME", "schema_name" : "SCHEMA-NAME" } }
With this connection asset type there are many different connections available. For more information, see Batch deployment details.
You can combine different adaptations in the same request. For more information about data definitions see Adding data to an analytics project.