watson自然语言分类器 - 尝试使用training_data创建分类器时获取415 FAIL

时间:2016-02-15 14:13:38

标签: ibm-cloud ibm-watson nl-classifier

就在几个月前,我使用training_data参数创建了几个自然语言分类器,将训练数据作为json字符串发送。当我现在尝试它时,它失败并返回代码415,即使具有完全相同的呼叫和训练数据。改变了什么,需要做些什么才能纠正这个问题?

我正在使用runco​​pe来训练分类器。以下是几个月前开始工作的电话,而不是现在:

POST
https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic <removed>
Connection: keep-alive
Content-Type: application/json

体:

{
"language": "en",
"name": "Ami Classifier",
"training_data": [
{"classes": ["blue"],"text": "house"},
{"classes": ["blue"],"text": "cube"},
{"classes": ["blue"],"text": "box"},
{"classes": ["red"],"text": "ball"},
{"classes": ["red"],"text": "sphere"},
{"classes": ["red"],"text": "round"}
]
}

这是过去几天的回复:

Content-Type:
Date: Mon, 15 Feb 2016 04:09:17 GMT
Server: -
Set-Cookie: <Ami-removed>
X-Backside-Transport: FAIL FAIL
X-Client-Ip: 54.174.130.249
X-Dp-Watson-Tran-Id: csf_platform_prod_dp02-135442457
X-Global-Transaction-Id: 135442457

BODY view raw
(empty)

3 个答案:

答案 0 :(得分:0)

请检查Bluemix状态(https://developer.ibm.com/bluemix/support/#status)。我注意到,目前云基础设施存在一些问题,这些问题正在影响NLC培训机制的某些实例。 您应该与Bluemix支持团队一起打开支持服务单,此处的说明就在这里(https://developer.ibm.com/bluemix/support/#support)。

答案 1 :(得分:0)

IBM支持的答案是:

“自然语言分类器(NLC)服务在过去几个月内发生了一些变化。纯REST接口通过https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers的训练分类器不再可用,因此您会收到此错误。”

我确实尝试过卷曲,它在那里工作。但是这没有意义,因为curl只是使用相同的协议对同一个端点进行http调用,因此应该可以使用runco​​pe这样的工具。到目前为止,我还没能在runco​​pe中复制curl调用,但是如果我这样做的话,它会在这里发布。

答案 2 :(得分:0)

您应该将培训数据添加为file attachment。这是成功的请求标头查找我的请求的方式:

POST /natural-language-classifier/api/v1/classifiers HTTP/1.1
HOST: gateway.watsonplatform.net
authorization: Basic hereyourownbase64encryptedcredentials==
content-type: multipart/form-data; boundary=----WebKitFormBoundaryiRs1zY19qkzRUzPn
content-length: 2207

------WebKitFormBoundaryiRs1zY19qkzRUzPn
Content-Disposition: form-data; name="training_data"; filename="weather_test_sample.csv"
Content-Type: application/vnd.ms-excel

How hot is it today?,temperature
Is it hot outside?,temperature
Will it be uncomfortably hot?,temperature
Will it be sweltering?,temperature
How cold is it today?,temperature
Is it cold outside?,temperature
Will it be uncomfortably cold?,temperature
Will it be frigid?,temperature
What is the expected high for today?,temperature
What is the expected temperature?,temperature
Will high temperatures be dangerous?,temperature
Is it dangerously cold?,temperature
When will the heat subside?,temperature
Is it hot?,temperature
Is it cold?,temperature
How cold is it now?,temperature
Will we have a cold day today?,temperature
When will the cold subside?,temperature
What highs are we expecting?,temperature
What lows are we expecting?,temperature
Is it warm?,temperature
Is it chilly?,temperature
What's the current temp in Celsius?,temperature
What is the temperature in Fahrenheit?,temperature
Is it windy?,conditions
Will it rain today?,conditions
What are the chances for rain?,conditions
Will we get snow?,conditions
Are we expecting sunny conditions?,conditions
Is it overcast?,conditions
Will it be cloudy?,conditions
How much rain will fall today?,conditions
How much snow are we expecting?,conditions
Is it windy outside?,conditions
How much snow do we expect?,conditions
Is the forecast calling for snow today?,conditions
Will we see some sun?,conditions
When will the rain subside?,conditions
Is it cloudy?,conditions
Is it sunny now?,conditions
Will it rain?,conditions
Will we have much snow?,conditions
Are the winds dangerous?,conditions
What is the expected snowfall today?,conditions
Will it be dry?,conditions
Will it be breezy?,conditions
Will it be humid?,conditions
What is today's expected humidity?,conditions
Will the blizzard hit us?,conditions
Is it drizzling?,conditions
------WebKitFormBoundaryiRs1zY19qkzRUzPn
Content-Disposition: form-data; name="training_metadata"

{"language":"en","name":"My Classifier"}
------WebKitFormBoundaryiRs1zY19qkzRUzPn--
相关问题