creating NLC classifier on bluemix

169 views Asked by At

when i try to create a new classifier of NLC, based on this documentation: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/natural-language-classifier/api/v1/?node#create_classifier

I can't create a new classifier. This is the error:

{ code: 400, error: undefined }

I shouldn't receive that kind of error.

The CSV file is very small, just for test.

Maybe i am doing something wrong. But that error: "undefined" doesn't say nothing...


This is the code (The same as the documentation)

var params = {
            language: 'es',
            name: "Train_NODE",
            training_data: fs.createReadStream('./public/uploads/'+req.files.file.name)
        };
        natural_language_classifier.create(params, function(err, response) {
            if (err){
                console.log(err);
                res.status(500).render('./APIs/NLC/', {
                    title: err.description
                });
            }else{
                console.log(JSON.stringify(response, null, 2));
                res.status(200).render('./APIs/NLC/', {
                    title: 'Natural Language Classifer'
                });
            }
        });

Somebody knows what to do?

1

There are 1 answers

0
Daniel Toczala On

Issue here was with the file path being used. It returned a file that did not exist. Once the file path to the training.csv was hardcoded in, everything worked fine.

So we got the 400 error when we used './public/uploads/'+req.files.file.name, but it worked when we used './public/uploads/MyTrainingFile.csv'.

We would anticipate some more descriptive error message though.