Model input and output data adaptation
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.
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.csv
file 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
.dat
file or an.lp
file) 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 allowing you to reference data on an “IBM Db2 on Cloud service”
instance. 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.csv
file 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 allowing you to reference files stored in an “IBM Cloud Object
Service” instance. 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.xls
file 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.csv
file 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:
"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" } }] }
You can combine different adaptations in the same request.
With this data asset type there are many different connections available. For more information, see Batch deployment details.