1

Does the IBM Watson Tradeoff Analytics support CSV? Looks like the API only accepts JSON. How do I transform a problem from CSV to JSON?

Radiodef
  • 37,180
  • 14
  • 90
  • 125
Ken
  • 21
  • 1

1 Answers1

1

The input can only be JSON but you can generate a JSON from CSV using this tool: http://tradeoff-analytics-csvtojson.mybluemix.net/

An example of a valid JSON is:

{
  "subject": "phone",
  "columns": [{
    "key": "price",
    "type": "numeric",
    "goal": "min",
    "full_name": "Price",
    "is_objective": true,
    "format": "€####0.00"
  }, {
    "key": "brand",
    "type": "categorical",
    "goal": "min",
    "full_name": "Brand",
    "is_objective": true,
    "range": ["Samsung", "Apple", "HTC", "LG", "Nokia", "Sony"],
    "preference": ["Samsung", "Apple", "HTC", "LG", "Nokia", "Sony"]
  }, {
    "key": "RAM",
    "type": "numeric",
    "goal": "max",
    "full_name": "RAM (MB)",
    "is_objective": false
  }, {
    "key": "screen_size",
    "type": "numeric",
    "goal": "max",
    "full_name": "Screen (inch)",
    "is_objective": true
  }, {
    "key": "camera",
    "type": "numeric",
    "goal": "max",
    "full_name": "Camera",
    "is_objective": false,
    "format": "####0 MP"
  }, {
    "key": "memory_size",
    "type": "numeric",
    "goal": "max",
    "full_name": "Memory",
    "is_objective": false,
    "format": "####0 GB"
  }, {
    "key": "battery",
    "type": "numeric",
    "goal": "max",
    "full_name": "Battery (mAh)",
    "is_objective": false
  }, {
    "key": "weight",
    "type": "numeric",
    "goal": "min",
    "full_name": "Weight",
    "is_objective": true,
    "format": "####0 g"
  }, {
    "key": "rDate",
    "type": "datetime",
    "goal": "max",
    "full_name": "Release Date",
    "is_objective": false
  }],
  "options": [{
    "key": "1",
    "name": "Samsung Galaxy S4 White",
    "values": {
      "weight": 130,
      "price": 239,
      "RAM": 2048,
      "battery": 2600,
      "camera": 13,
      "memory_size": 16,
      "screen_size": 5,
      "brand": "Samsung",
      "rDate": "2013-04-29T00:00:00Z"
    }
  }, {
    "key": "2",
    "name": "Samsung Galaxy S4 Black",
    "values": {
      "weight": 130,
      "price": 239,
      "RAM": 2048,
      "battery": 2600,
      "camera": 13,
      "memory_size": 16,
      "screen_size": 5,
      "brand": "Samsung",
      "rDate": "2013-04-29T00:00:00Z"
    }
  }, {
    "key": "3",
    "name": "Samsung Galaxy S3 White",
    "values": {
      "weight": 133,
      "price": 79,
      "RAM": 2048,
      "battery": 2100,
      "camera": 8,
      "memory_size": 16,
      "screen_size": 4.8,
      "brand": "Samsung",
      "rDate": "2012-05-29T00:00:00Z"
    }
  }]
}
German Attanasio
  • 22,217
  • 7
  • 47
  • 63