输入文件的权衡分析在IBM沃森



IBM Watson权衡分析是否支持CSV?看起来API只接受JSON。如何将问题从CSV转换为JSON?

输入只能是JSON,但您可以使用以下工具从CSV生成JSON: http://tradeoff-analytics-csvtojson.mybluemix.net/

一个有效的JSON示例是:
{
  "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"
    }
  }]
}

最新更新