watson natural language classifier - Getting 415 FAIL when trying to create a classifier with training_data

356 views Asked by At

Just a couple of month ago, I created a couple of natural language classifiers with the training_data param to send training data as a json string. When I try it now, it fails with return code 415, even with exactly the same call and training data. What changed, and what needs to be done to correct this?

I am using runscope to train the classifier. The following is a call that worked a couple months ago and not now:

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

Body:

{
"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"}
]
}

This is the response in the last few days:

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

There are 3 answers

1
Daniel Toczala On

Please check the Bluemix status (https://developer.ibm.com/bluemix/support/#status). It came to my attention that there are currently some issues with the cloud infrastructure that is impacting some instances of the NLC training mechanisms. You should open a support ticket with the Bluemix support team, directions on this are here (https://developer.ibm.com/bluemix/support/#support).

0
Ami Assayag On

The answer from IBM support is:

"There is some changes in Natural Language Classifier (NLC) service within the last several months. Training classifier from pure REST interface via https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers is no longer available thus you get this error."

I did try it with curl and it works there. However that does not make sense because curl is just making an http call to the same endpoint using the same protocol, so it should be possible to do using a tool like runscope. So far, I haven't been able to replicate the curl call in runscope, but will post it here if I do.

0
Galileo_Galilei On

You should add the training data as file attachment. This is how a successful request header looks for my requests:

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