1

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

我正在使用 runscope 来训练分类器。以下是几个月前有效的电话,而不是现在:

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)
4

3 回答 3

0

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

于 2016-02-15T21:47:03.463 回答
0

您应该将训练数据添加为文件附件。这是成功的请求标头查找我的请求的方式:

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--
于 2016-11-16T18:41:06.017 回答
0

IBM 支持人员的回答是:

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

我确实用 curl 尝试过,它在那里工作。然而,这没有任何意义,因为 curl 只是使用相同的协议对相同的端点进行 http 调用,所以应该可以使用 runscope 之类的工具来实现。到目前为止,我还无法在 runscope 中复制 curl 调用,但如果可以,我会在此处发布。

于 2016-02-16T18:08:13.240 回答