Search code examples
curlnlpibm-cloudibm-watsonnl-classifier

when training data using IBM Bluemix natural language classifier api, return data too small


When I follow "Getting started with the Natural Language Classifier service" guide line, I meet problem at Stage 2: Create and train a classifier:

$ curl -i -u "<username>":"<password>" \
-F training_data=@<path_to_file>/weather_data_train.csv \
-F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\"}" \
"https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers"

It returns:

{
  "code" : 400,
  "error" : "Data too small",
  "description" : "The number of training entries received = 1, which is smaller
 than the required minimum of 5"
}

Any one could kindly help how to solve this problem. Thanks a lot~

Here is the guide line link: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/nl-classifier/get_start.shtml#create


Solution

  • Just tried following the tutorial step by step and it works fine for me. I received the response "The classifier instance is in its training phase, not yet ready to accept classify requests" meaning that the training process started.

    Please double check that you specified a correct path and that the content of the weather_data_train.csv file is correct: it should contain 50 lines.

    I've used the following command (I executed the command within the same directory containing the .csv file):

    $ curl -i -u "myusername":"mypwd" \
    -F training_data=@./weather_data_train.csv \
    -F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\"}" \
    "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers"